为 TabBar 和扫码页补充 accessibilityIdentifier,并在模拟器/UI Test 中禁用真实相机采集。
预初始化各 Tab 路由容器,修正 iOS 17 ContentUnavailableView 调用,提升自定义 TabBar 与扫码流程的 UI Test 稳定性。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -81,16 +81,22 @@ final class AppRouter: ObservableObject {
|
||||
@Published var selectedTab: AppTab = .home
|
||||
@Published var selectedOrdersEntry: OrdersEntry = .storeOrders
|
||||
@Published private(set) var pendingOrderScanCode: String?
|
||||
@Published private var routers: [AppTab: RouterPath] = [:]
|
||||
private let routers: [AppTab: RouterPath]
|
||||
|
||||
/// 获取指定 Tab 对应的路由路径容器,不存在时自动创建。
|
||||
init() {
|
||||
routers = Dictionary(
|
||||
uniqueKeysWithValues: AppTab.allCases.map { tab in
|
||||
(tab, RouterPath())
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/// 获取指定 Tab 对应的路由路径容器。
|
||||
func router(for tab: AppTab) -> RouterPath {
|
||||
if let router = routers[tab] {
|
||||
return router
|
||||
guard let router = routers[tab] else {
|
||||
assertionFailure("Missing router path for tab: \(tab)")
|
||||
return RouterPath()
|
||||
}
|
||||
|
||||
let router = RouterPath()
|
||||
routers[tab] = router
|
||||
return router
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user