feat: update app workflows and permissions
This commit is contained in:
@ -10,10 +10,34 @@ enum MainScanTabItem {
|
||||
|
||||
/// 构建扫码 TabBarItem,点击行为由 `MainTabBarController` 拦截。
|
||||
static func makeTabBarItem() -> UITabBarItem {
|
||||
let image = UIImage(named: "icon_scan")?.withRenderingMode(.alwaysOriginal)
|
||||
let image = makeScanImage()
|
||||
let item = UITabBarItem(title: nil, image: image, selectedImage: image)
|
||||
item.accessibilityLabel = "扫码核销"
|
||||
item.accessibilityIdentifier = "main.scan"
|
||||
return item
|
||||
}
|
||||
|
||||
private static func makeScanImage() -> UIImage {
|
||||
let diameter: CGFloat = 48
|
||||
let renderer = UIGraphicsImageRenderer(size: CGSize(width: diameter, height: diameter))
|
||||
return renderer.image { _ in
|
||||
let bounds = CGRect(origin: .zero, size: CGSize(width: diameter, height: diameter))
|
||||
AppColor.primary.setFill()
|
||||
UIBezierPath(ovalIn: bounds).fill()
|
||||
|
||||
let configuration = UIImage.SymbolConfiguration(pointSize: 25, weight: .semibold)
|
||||
guard let symbol = UIImage(systemName: "qrcode.viewfinder", withConfiguration: configuration) else {
|
||||
return
|
||||
}
|
||||
let image = symbol.withTintColor(.white, renderingMode: .alwaysOriginal)
|
||||
let symbolSize = CGSize(width: 28, height: 28)
|
||||
let symbolRect = CGRect(
|
||||
x: (diameter - symbolSize.width) / 2,
|
||||
y: (diameter - symbolSize.height) / 2,
|
||||
width: symbolSize.width,
|
||||
height: symbolSize.height
|
||||
)
|
||||
image.draw(in: symbolRect)
|
||||
}.withRenderingMode(.alwaysOriginal)
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,6 +67,7 @@ final class MainTabBarController: UITabBarController {
|
||||
|
||||
private func configureTabBarAppearance() {
|
||||
tabBar.tintColor = AppColor.primary
|
||||
tabBar.unselectedItemTintColor = AppColor.textTabInactive
|
||||
tabBar.backgroundColor = AppColor.cardBackground
|
||||
tabBar.shadowImage = UIImage()
|
||||
|
||||
@ -82,7 +83,7 @@ final class MainTabBarController: UITabBarController {
|
||||
let appearance = UITabBarAppearance()
|
||||
appearance.configureWithOpaqueBackground()
|
||||
appearance.backgroundColor = AppColor.cardBackground
|
||||
appearance.shadowColor = .clear
|
||||
appearance.shadowColor = AppColor.tabBarShadow
|
||||
appearance.stackedLayoutAppearance.normal.titleTextAttributes = normalAttributes
|
||||
appearance.stackedLayoutAppearance.selected.titleTextAttributes = selectedAttributes
|
||||
tabBar.standardAppearance = appearance
|
||||
|
||||
Reference in New Issue
Block a user