Merge branch 'bugfix/main_thread_navigation' into 'develop'

Main thread fix. Keychain consolidation

See merge request BPHV_MIPS/mvm_core!23
This commit is contained in:
Pan, Xinlei (Ryan) 2019-08-09 11:05:13 -04:00
commit db1e3fd04c

View File

@ -17,6 +17,7 @@
#import "MVMCoreErrorConstants.h"
#import "MVMCoreLoggingHandler.h"
#import "MVMCoreLoadingOverlayHandler.h"
#import "MVMCoreDispatchUtility.h"
@interface MVMCoreNavigationHandler ()
@ -275,7 +276,7 @@
#pragma mark - Presentation Extra
- (void)presentViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
[MVMCoreDispatchUtility performBlockOnMainThread:^{
UIViewController *controllerToPresentOn = self.viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
if (!controllerToPresentOn) {
// Log if we are attempting to add an alert to nothing.
@ -286,16 +287,19 @@
operation.delegate = delegate;
operation.completionBlock = completionBlock;
[self.presentationQueue addOperation:operation];
}
}];
}
- (void)dismissTopViewControllerAnimated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
[MVMCoreDispatchUtility performBlockOnMainThread:^{
// Dismiss on the main navigation controller.
UIViewController *controllerToPresentOn = self.viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
MVMCoreDismissViewControllerOperation *operation = [[MVMCoreDismissViewControllerOperation alloc] initAndDismissTopViewController:controllerToPresentOn animated:animated];
operation.completionBlock = completionBlock;
[[NSOperationQueue mainQueue] addOperation:operation];
}];
}
- (void)dismissViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
@ -306,12 +310,13 @@
}
- (void)dismissToBottom:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
[MVMCoreDispatchUtility performBlockOnMainThread:^{
// Dismiss on the main navigation controller.
UIViewController *controllerToPresentOn = self.viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
MVMCoreDismissViewControllerOperation *operation = [[MVMCoreDismissViewControllerOperation alloc] initAndDismissViewController:controllerToPresentOn animated:animated];
operation.completionBlock = completionBlock;
[[NSOperationQueue mainQueue] addOperation:operation];
}];
}
@end