Files
汉秋 a1c031c9b7 Integrate CYLTabBar center scan button and unify UIKit navigation.
Add CYLTabBarController with a global scan entry, promote MainTabBarController to the window root after login, replace RouterPath-based navigation with AppNavigator, and fix Profile diffable cell reconfiguration crashes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 16:36:18 +08:00

35 lines
1.3 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// HomeMenuRouting.swift
// suixinkan
//
import UIKit
@MainActor
/// UIKit URI Tab Navigation push
enum HomeMenuRouting {
///
static func openMenu(_ item: HomeMenuItem, from viewController: UIViewController) {
openRoute(HomeMenuRouter.resolve(uri: item.uri, title: item.title), from: viewController)
}
/// URI
static func openRoute(_ route: HomeMenuResolvedRoute, from viewController: UIViewController) {
let services = AppServices.shared
switch route {
case .tab(let tab):
services.appNavigator.selectTab(tab)
case .orders(let entry):
services.appNavigator.openOrdersEntry(entry)
case .destination(let homeRoute):
services.appNavigator.push(.home(homeRoute), from: viewController)
case .unsupported(let uri, let title, _):
services.appNavigator.push(.home(.modulePlaceholder(uri: uri, title: title)), from: viewController)
case .placeholder(let uri, let title):
HomeRouteDiagnostics.recordUnknown(uri: uri, title: title)
services.appNavigator.push(.home(.modulePlaceholder(uri: uri, title: title)), from: viewController)
}
}
}