Add login flow, session routing, and MainTab shell aligned with reference UI.

Implement token-based root routing, Android-matched login screen, five-slot MainTabBar with scan action, and placeholder tab pages.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-06 15:12:34 +08:00
parent e290656322
commit b7d74905b7
70 changed files with 1588 additions and 48 deletions

View File

@ -0,0 +1,64 @@
//
// AppTab.swift
// suixinkan
//
import UIKit
/// Tab
enum AppTab: String, CaseIterable, Hashable {
case home
case orders
case statistics
case profile
var title: String {
switch self {
case .home: "首页"
case .orders: "订单"
case .statistics: "数据"
case .profile: "我的"
}
}
var selectedImageName: String {
switch self {
case .home: "tab_home_selected"
case .orders: "tab_order_selected"
case .statistics: "tab_data_selected"
case .profile: "tab_profile_selected"
}
}
var unselectedImageName: String {
switch self {
case .home: "tab_home_unselected"
case .orders: "tab_order_unselected"
case .statistics: "tab_data_unselected"
case .profile: "tab_profile_unselected"
}
}
/// TabBarItem
func makeTabBarItem() -> UITabBarItem {
let unselectedImage = UIImage(named: unselectedImageName)?.withRenderingMode(.alwaysOriginal)
let selectedImage = UIImage(named: selectedImageName)?.withRenderingMode(.alwaysOriginal)
let item = UITabBarItem(title: title, image: unselectedImage, selectedImage: selectedImage)
item.accessibilityIdentifier = "main.tab.\(rawValue)"
return item
}
/// Tab
func makeRootViewController() -> UIViewController {
switch self {
case .home:
return HomeViewController()
case .orders:
return OrdersViewController()
case .statistics:
return StatisticsViewController()
case .profile:
return ProfileViewController()
}
}
}