From 50fb716f99215b586b471b5feea11ff481117783 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 7 May 2018 15:48:59 -0400 Subject: [PATCH] Top alert queue fix --- .../MVMCore/PresentationHandling/MVMCoreNavigationHandler.m | 5 +++++ .../MVMCore/PresentationHandling/MVMCoreNavigationObject.h | 1 + .../PresentationHandling/MVMCoreNavigationOperation.m | 6 +++++- MVMCore/MVMCore/Utility/MVMCoreBlockOperation.m | 1 - 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m index 4f89c71..b6aa0aa 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m @@ -16,6 +16,7 @@ #import "MVMCoreRequestParameters.h" #import "MVMCoreErrorConstants.h" #import "MVMCoreLoggingHandler.h" +#import "MVMCoreLoadingOverlayHandler.h" @interface MVMCoreNavigationHandler () @@ -90,6 +91,10 @@ - (void)startNavigationWithNavigationObject:(MVMCoreNavigationObject *)navigationObject delegate:(nullable NSObject*)delegate completionHandler:(nullable void (^)(void))completionBlock { + // In case it takes some time to happen. + [[MVMCoreLoadingOverlayHandler sharedLoadingOverlay] startLoading]; + navigationObject.stopLoadingOverlay = YES; + MVMCoreNavigationOperation *navigationOperation = [[MVMCoreNavigationOperation alloc] initWithNavigationObject:navigationObject]; navigationOperation.delegate = delegate; navigationOperation.completionBlock = completionBlock; diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationObject.h b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationObject.h index 71e7c72..527110f 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationObject.h +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationObject.h @@ -20,6 +20,7 @@ @property (nonatomic) NavigationType navigationType; @property (nonatomic) BOOL animated; @property (nonatomic) BOOL tryToReplaceFirst; +@property (nonatomic) BOOL stopLoadingOverlay; - (nullable instancetype)initWithViewController:(nullable UIViewController *)viewController navigationController:(nullable UINavigationController *)navigationController viewControllers:(nullable NSArray *)viewControllers animated:(BOOL)animated tryToReplaceFirst:(BOOL)tryToReplaceFirst navigationType:(NavigationType)navigationType; diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m index 45d8647..19f2743 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m @@ -11,6 +11,7 @@ #import "MVMCoreViewManagerProtocol.h" #import "MVMCoreViewControllerProtocol.h" #import "MVMCoreLoggingHandler.h" +#import "MVMCoreLoadingOverlayHandler.h" @interface MVMCoreNavigationOperation () @@ -209,7 +210,10 @@ } - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { - + if (self.navigationObject.stopLoadingOverlay) { + [[MVMCoreLoadingOverlayHandler sharedLoadingOverlay] stopLoading:YES]; + } + if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:willDisplayViewController:)]) { [self.delegate navigationController:navigationController willDisplayViewController:viewController]; } diff --git a/MVMCore/MVMCore/Utility/MVMCoreBlockOperation.m b/MVMCore/MVMCore/Utility/MVMCoreBlockOperation.m index 85a223a..f0fc8ce 100644 --- a/MVMCore/MVMCore/Utility/MVMCoreBlockOperation.m +++ b/MVMCore/MVMCore/Utility/MVMCoreBlockOperation.m @@ -22,7 +22,6 @@ return operation; } - - (void)main { // Always check for cancellation before launching the task.