ONEAPP-5208: Review feedback

This commit is contained in:
Scott Pfeil 2023-08-28 11:13:40 -04:00
parent caab123781
commit e8fcf1ac5d
2 changed files with 20 additions and 20 deletions

View File

@ -43,29 +43,27 @@ import Combine
*/
@MainActor
public func subscribe() {
NavigationHandler.shared().onNavigationWillBegin.sink { [weak self] operation in
NavigationHandler.shared().onNavigation.sink { [weak self] (event, operation) in
guard let self = self,
self == operation.navigationType.getNavigationController(),
let viewController = NavigationHandler.shared().getViewControllers(for: self).last,
let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController) else { return }
if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) {
MVMCoreViewManagerViewControllerProtocolHelper.helpSetManager(self, viewController: controller)
}
if let model = getNavigationModel(from: newViewController) {
self.setNavigationItem(with: model, for: viewController)
self.setNavigationBarUI(with: model)
}
self.manager?.willDisplay?(newViewController)
}.store(in: &cancellables)
NavigationHandler.shared().onNavigationDidFinish.sink { [weak self] operation in
guard let self = self,
self == operation.navigationType.getNavigationController(),
let viewController = NavigationHandler.shared().getViewControllers(for: self).last,
let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController) else { return }
self.manager?.displayedViewController?(newViewController)
if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) {
controller.viewControllerReady?(inManager: self)
switch event {
case .willNavigate:
if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) {
MVMCoreViewManagerViewControllerProtocolHelper.helpSetManager(self, viewController: controller)
}
if let model = getNavigationModel(from: newViewController) {
self.setNavigationItem(with: model, for: viewController)
self.setNavigationBarUI(with: model)
}
self.manager?.willDisplay?(newViewController)
case .didNavigate:
self.manager?.displayedViewController?(newViewController)
if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) {
controller.viewControllerReady?(inManager: self)
}
@unknown default: break
}
}.store(in: &cancellables)
}

View File

@ -356,7 +356,9 @@ open class NotificationHandler {
/// Registers to know when pages change.
private func registerForPageChanges() {
cancellable = NavigationHandler.shared().onNavigationDidFinish.sink { [weak self] operation in
cancellable = NavigationHandler.shared().onNavigation
.filter({ $0.0 == .didNavigate })
.sink { [weak self] (event, operation) in
guard let self = self else { return }
Task {
// Update displayable for each top alert operation when page type changes, in top queue priority order.