Fix home navigation bar visibility and hide scan tab title.

Home uses a custom top bar, so TabNavigationController now syncs system nav bar visibility with the stack top; remove the scan tab text label to show icon only.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-29 08:59:31 +08:00
parent 7469f92177
commit 1a6d4a1791
5 changed files with 81 additions and 2 deletions

View File

@ -35,7 +35,7 @@ final class MainScanTabItemTests: XCTestCase {
controller.loadViewIfNeeded()
let scanItem = try XCTUnwrap(controller.viewControllers?[2].tabBarItem)
XCTAssertEqual(scanItem.title, "扫码")
XCTAssertNil(scanItem.title)
XCTAssertEqual(scanItem.accessibilityIdentifier, "main.scan")
XCTAssertEqual(scanItem.accessibilityLabel, "扫码核销")
XCTAssertNotNil(scanItem.image)

View File

@ -27,6 +27,20 @@ final class AppNavigatorTests: XCTestCase {
XCTAssertTrue(homeStack.viewControllers.last is PaymentCollectionViewController)
}
/// push
func testHomeNavigationBarVisibilityFollowsTopViewController() {
let services = AppServices(apiClient: APIClient(session: AppNavigatorRecordingURLSession()))
let navigationController = TabNavigationController(tab: .home, services: services)
XCTAssertTrue(navigationController.isNavigationBarHidden)
navigationController.push(route: .home(.paymentCollection), animated: false)
XCTAssertFalse(navigationController.isNavigationBarHidden)
navigationController.popToRootViewController(animated: false)
XCTAssertTrue(navigationController.isNavigationBarHidden)
}
/// tabRoot Tab
func testTabRootSelectsTabResetsStackAndPushesRoute() {
let services = AppServices(apiClient: APIClient(session: AppNavigatorRecordingURLSession()))