Skip to content

Commit fffffe3

Browse files
committed
Push review details from notification after navigating to the menu tab.
1 parent 3e22354 commit fffffe3

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

WooCommerce/Classes/ViewRelated/Hub Menu/HubMenuCoordinator.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ final class HubMenuCoordinator: Coordinator {
2020

2121
private var notificationsSubscription: AnyCancellable?
2222

23-
private let willPresentReviewDetailsFromPushNotification: () -> Void
23+
private let willPresentReviewDetailsFromPushNotification: () async -> Void
2424

2525
init(navigationController: UINavigationController,
2626
pushNotificationsManager: PushNotesManager = ServiceLocator.pushNotesManager,
2727
storesManager: StoresManager = ServiceLocator.stores,
2828
noticePresenter: NoticePresenter = ServiceLocator.noticePresenter,
2929
switchStoreUseCase: SwitchStoreUseCaseProtocol,
30-
willPresentReviewDetailsFromPushNotification: @escaping () -> Void) {
30+
willPresentReviewDetailsFromPushNotification: @escaping () async -> Void) {
3131

3232
self.pushNotificationsManager = pushNotificationsManager
3333
self.storesManager = storesManager
@@ -37,7 +37,7 @@ final class HubMenuCoordinator: Coordinator {
3737
self.navigationController = navigationController
3838
}
3939

40-
convenience init(navigationController: UINavigationController, willPresentReviewDetailsFromPushNotification: @escaping () -> Void) {
40+
convenience init(navigationController: UINavigationController, willPresentReviewDetailsFromPushNotification: @escaping () async -> Void) {
4141
let storesManager = ServiceLocator.stores
4242
self.init(navigationController: navigationController,
4343
storesManager: storesManager,
@@ -94,13 +94,15 @@ final class HubMenuCoordinator: Coordinator {
9494
return
9595
}
9696

97-
self.willPresentReviewDetailsFromPushNotification()
98-
self.pushReviewDetailsViewController(using: parcel)
97+
Task { @MainActor in
98+
await self.willPresentReviewDetailsFromPushNotification()
99+
self.pushReviewDetailsViewController(using: parcel)
99100

100-
if siteChanged {
101-
let presenter = SwitchStoreNoticePresenter(siteID: Int64(siteID),
102-
noticePresenter: self.noticePresenter)
103-
presenter.presentStoreSwitchedNoticeWhenSiteIsAvailable(configuration: .switchingStores)
101+
if siteChanged {
102+
let presenter = SwitchStoreNoticePresenter(siteID: Int64(siteID),
103+
noticePresenter: self.noticePresenter)
104+
presenter.presentStoreSwitchedNoticeWhenSiteIsAvailable(configuration: .switchingStores)
105+
}
104106
}
105107
}
106108
}

WooCommerce/Classes/ViewRelated/MainTabBarController.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,11 @@ private extension MainTabBarController {
481481
func createHubMenuTabCoordinator() -> HubMenuCoordinator {
482482
HubMenuCoordinator(navigationController: hubMenuNavigationController,
483483
willPresentReviewDetailsFromPushNotification: { [weak self] in
484-
self?.navigateTo(.hubMenu)
484+
await withCheckedContinuation { [weak self] continuation in
485+
self?.navigateTo(.hubMenu) {
486+
continuation.resume(returning: ())
487+
}
488+
}
485489
})
486490
}
487491
}

0 commit comments

Comments
 (0)