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

View File

@ -356,7 +356,9 @@ open class NotificationHandler {
/// Registers to know when pages change. /// Registers to know when pages change.
private func registerForPageChanges() { 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 } guard let self = self else { return }
Task { Task {
// Update displayable for each top alert operation when page type changes, in top queue priority order. // Update displayable for each top alert operation when page type changes, in top queue priority order.