Main thread fix. Keychain consolidation
This commit is contained in:
parent
f2b7973d77
commit
8df4a3c123
@ -17,6 +17,7 @@
|
|||||||
#import "MVMCoreErrorConstants.h"
|
#import "MVMCoreErrorConstants.h"
|
||||||
#import "MVMCoreLoggingHandler.h"
|
#import "MVMCoreLoggingHandler.h"
|
||||||
#import "MVMCoreLoadingOverlayHandler.h"
|
#import "MVMCoreLoadingOverlayHandler.h"
|
||||||
|
#import "MVMCoreDispatchUtility.h"
|
||||||
|
|
||||||
@interface MVMCoreNavigationHandler ()
|
@interface MVMCoreNavigationHandler ()
|
||||||
|
|
||||||
@ -275,27 +276,30 @@
|
|||||||
#pragma mark - Presentation Extra
|
#pragma mark - Presentation Extra
|
||||||
|
|
||||||
- (void)presentViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
|
- (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;
|
UIViewController *controllerToPresentOn = self.viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||||
if (!controllerToPresentOn) {
|
if (!controllerToPresentOn) {
|
||||||
// Log if we are attempting to add an alert to nothing.
|
// 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]];
|
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];
|
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||||
} else {
|
} else {
|
||||||
MVMCorePresentViewControllerOperation *operation = [[MVMCorePresentViewControllerOperation alloc] initWithPresentingViewController:controllerToPresentOn presentedViewController:viewController animated:animated];
|
MVMCorePresentViewControllerOperation *operation = [[MVMCorePresentViewControllerOperation alloc] initWithPresentingViewController:controllerToPresentOn presentedViewController:viewController animated:animated];
|
||||||
operation.delegate = delegate;
|
operation.delegate = delegate;
|
||||||
operation.completionBlock = completionBlock;
|
operation.completionBlock = completionBlock;
|
||||||
[self.presentationQueue addOperation:operation];
|
[self.presentationQueue addOperation:operation];
|
||||||
}
|
|
||||||
|
}
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dismissTopViewControllerAnimated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
|
- (void)dismissTopViewControllerAnimated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
|
||||||
|
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||||
// Dismiss on the main navigation controller.
|
// Dismiss on the main navigation controller.
|
||||||
UIViewController *controllerToPresentOn = self.viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
|
UIViewController *controllerToPresentOn = self.viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||||
MVMCoreDismissViewControllerOperation *operation = [[MVMCoreDismissViewControllerOperation alloc] initAndDismissTopViewController:controllerToPresentOn animated:animated];
|
MVMCoreDismissViewControllerOperation *operation = [[MVMCoreDismissViewControllerOperation alloc] initAndDismissTopViewController:controllerToPresentOn animated:animated];
|
||||||
operation.completionBlock = completionBlock;
|
operation.completionBlock = completionBlock;
|
||||||
[[NSOperationQueue mainQueue] addOperation:operation];
|
[[NSOperationQueue mainQueue] addOperation:operation];
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dismissViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
|
- (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 {
|
- (void)dismissToBottom:(BOOL)animated delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
|
||||||
|
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||||
// Dismiss on the main navigation controller.
|
// Dismiss on the main navigation controller.
|
||||||
UIViewController *controllerToPresentOn = self.viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
|
UIViewController *controllerToPresentOn = self.viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||||
MVMCoreDismissViewControllerOperation *operation = [[MVMCoreDismissViewControllerOperation alloc] initAndDismissViewController:controllerToPresentOn animated:animated];
|
MVMCoreDismissViewControllerOperation *operation = [[MVMCoreDismissViewControllerOperation alloc] initAndDismissViewController:controllerToPresentOn animated:animated];
|
||||||
operation.completionBlock = completionBlock;
|
operation.completionBlock = completionBlock;
|
||||||
[[NSOperationQueue mainQueue] addOperation:operation];
|
[[NSOperationQueue mainQueue] addOperation:operation];
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user