fix: route payment pushes to orders and prevent refresh crash

This commit is contained in:
2026-09-08 09:59:51 +08:00
parent 10249776ad
commit c4b0e7798b
10 changed files with 333 additions and 47 deletions
@@ -67,16 +67,20 @@ final class MainTabBarController: UITabBarController {
/// 响应推送点击,切换到目标 Tab 并打开对应业务页面。
func openPushDestination(_ destination: PushDestination) {
let targetTab = AppTab.home
loadViewIfNeeded()
let targetTab: AppTab = destination == .orders ? .orders : .home
let wasAlreadyOnOrders = targetTab == .orders && selectedViewController === tabNavigationControllers[.orders]
selectTab(targetTab)
guard let navigationController = tabNavigationControllers[targetTab] else { return }
_ = navigationController.popToRootViewController(animated: false)
let controller: UIViewController?
switch destination {
case .paymentRecord:
controller = PaymentCollectionRecordViewController()
case .orders:
(navigationController.viewControllers.first as? OrdersViewController)?.openFromOrderNotification()
if wasAlreadyOnOrders { badgeViewModel.refreshPendingWriteOffCount() }
controller = nil
case .paymentDetails:
controller = PaymentCollectionDetailsViewController()
case .messageCenter: