fix: route payment pushes to orders and prevent refresh crash
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user