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:
commit
db1e3fd04c
@ -17,6 +17,7 @@
|
||||
#import "MVMCoreErrorConstants.h"
|
||||
#import "MVMCoreLoggingHandler.h"
|
||||
#import "MVMCoreLoadingOverlayHandler.h"
|
||||
#import "MVMCoreDispatchUtility.h"
|
||||
|
||||
@interface MVMCoreNavigationHandler ()
|
||||
|
||||
@ -275,27 +276,30 @@
|
||||
#pragma mark - Presentation Extra
|
||||
|
||||
- (void)presentViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
|
||||
|
||||
UIViewController *controllerToPresentOn = self.viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
if (!controllerToPresentOn) {
|
||||
// Log if we are attempting to add an alert to nothing.
|
||||
MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:nil message:@"The viewControllerToPresent on property is nil and an attempt was made to present." code:ErrorCodeNoViewControllerToPresentOn domain:ErrorDomainNative location:[NSString stringWithFormat:@"ViewController:%@|Delegate:%@",viewController.description,delegate]];
|
||||
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||
} else {
|
||||
MVMCorePresentViewControllerOperation *operation = [[MVMCorePresentViewControllerOperation alloc] initWithPresentingViewController:controllerToPresentOn presentedViewController:viewController animated:animated];
|
||||
operation.delegate = delegate;
|
||||
operation.completionBlock = completionBlock;
|
||||
[self.presentationQueue addOperation:operation];
|
||||
}
|
||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||
UIViewController *controllerToPresentOn = self.viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
if (!controllerToPresentOn) {
|
||||
// Log if we are attempting to add an alert to nothing.
|
||||
MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:nil message:@"The viewControllerToPresent on property is nil and an attempt was made to present." code:ErrorCodeNoViewControllerToPresentOn domain:ErrorDomainNative location:[NSString stringWithFormat:@"ViewController:%@|Delegate:%@",viewController.description,delegate]];
|
||||
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||
} else {
|
||||
MVMCorePresentViewControllerOperation *operation = [[MVMCorePresentViewControllerOperation alloc] initWithPresentingViewController:controllerToPresentOn presentedViewController:viewController animated:animated];
|
||||
operation.delegate = delegate;
|
||||
operation.completionBlock = completionBlock;
|
||||
[self.presentationQueue addOperation:operation];
|
||||
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)dismissTopViewControllerAnimated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
|
||||
|
||||
// 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];
|
||||
[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 {
|
||||
|
||||
// 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];
|
||||
[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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user