Merge branch 'develop' of gitlab.verizon.com:BPHV_MIPS/mvm_core into develop
This commit is contained in:
commit
b0c3e2b1ee
@ -14,7 +14,7 @@
|
|||||||
@class MVMCoreNavigationObject;
|
@class MVMCoreNavigationObject;
|
||||||
@class MVMCoreLoadObject;
|
@class MVMCoreLoadObject;
|
||||||
|
|
||||||
@interface MVMCoreNavigationHandler : NSObject
|
@interface MVMCoreNavigationHandler : NSObject <UINavigationControllerDelegate>
|
||||||
|
|
||||||
// Returns the shared instance of this singleton
|
// Returns the shared instance of this singleton
|
||||||
+ (nullable instancetype)sharedNavigationHandler;
|
+ (nullable instancetype)sharedNavigationHandler;
|
||||||
@ -25,6 +25,8 @@
|
|||||||
// reference to main navigation controller
|
// reference to main navigation controller
|
||||||
@property (nullable, weak, nonatomic) UINavigationController *navigationController;
|
@property (nullable, weak, nonatomic) UINavigationController *navigationController;
|
||||||
|
|
||||||
|
/// A list of possible delegates looking for information.
|
||||||
|
@property (nonnull, strong, nonatomic) NSHashTable<MVMCorePresentationDelegateProtocol> *delegates;
|
||||||
|
|
||||||
// Will navigate appropriately based on the load style
|
// Will navigate appropriately based on the load style
|
||||||
- (void)navigateWithLoadObject:(nullable MVMCoreLoadObject *)loadObject viewController:(nonnull UIViewController *)viewController delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock;
|
- (void)navigateWithLoadObject:(nullable MVMCoreLoadObject *)loadObject viewController:(nonnull UIViewController *)viewController delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock;
|
||||||
@ -35,6 +37,14 @@
|
|||||||
// pops or dimisses as needed
|
// pops or dimisses as needed
|
||||||
- (void)removeCurrentViewController;
|
- (void)removeCurrentViewController;
|
||||||
|
|
||||||
|
#pragma mark - Delegate Handling
|
||||||
|
|
||||||
|
/// Adds a listener for navigation delegate functions
|
||||||
|
- (void)addDelegate:(nonnull id <MVMCorePresentationDelegateProtocol>)delegate;
|
||||||
|
|
||||||
|
/// Removes a listener for navigation delegate functions
|
||||||
|
- (void)removeDelegate:(nullable id <MVMCorePresentationDelegateProtocol>)delegate;
|
||||||
|
|
||||||
#pragma mark - Navigation Simple
|
#pragma mark - Navigation Simple
|
||||||
// Uses the default navigation controller in app delegate
|
// Uses the default navigation controller in app delegate
|
||||||
|
|
||||||
|
|||||||
@ -47,10 +47,24 @@
|
|||||||
|
|
||||||
self.presentationQueue = [[NSOperationQueue alloc] init];
|
self.presentationQueue = [[NSOperationQueue alloc] init];
|
||||||
self.presentationQueue.maxConcurrentOperationCount = 1;
|
self.presentationQueue.maxConcurrentOperationCount = 1;
|
||||||
|
|
||||||
|
self.delegates = (NSHashTable <MVMCorePresentationDelegateProtocol>*)[NSHashTable weakObjectsHashTable];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Delegate Handling
|
||||||
|
|
||||||
|
- (void)addDelegate:(nonnull id <MVMCorePresentationDelegateProtocol>)delegate {
|
||||||
|
[self.delegates addObject:delegate];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)removeDelegate:(nullable id <MVMCorePresentationDelegateProtocol>)delegate {
|
||||||
|
[self.delegates removeObject:delegate];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Navigation Helpers
|
||||||
|
|
||||||
- (void)navigateWithLoadObject:(nullable MVMCoreLoadObject *)loadObject viewController:(nonnull UIViewController *)viewController delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
|
- (void)navigateWithLoadObject:(nullable MVMCoreLoadObject *)loadObject viewController:(nonnull UIViewController *)viewController delegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock {
|
||||||
|
|
||||||
BOOL shouldAnimate = !loadObject.requestParameters.shouldNotAnimatePush;
|
BOOL shouldAnimate = !loadObject.requestParameters.shouldNotAnimatePush;
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
#import "MVMCoreLoggingHandler.h"
|
#import "MVMCoreLoggingHandler.h"
|
||||||
#import "MVMCoreLoadingOverlayHandler.h"
|
#import "MVMCoreLoadingOverlayHandler.h"
|
||||||
#import "MVMCoreViewControllerAnimatedTransitioning.h"
|
#import "MVMCoreViewControllerAnimatedTransitioning.h"
|
||||||
|
#import "MVMCoreNavigationHandler.h"
|
||||||
|
|
||||||
@interface MVMCoreNavigationOperation ()
|
@interface MVMCoreNavigationOperation ()
|
||||||
|
|
||||||
@ -225,6 +226,8 @@
|
|||||||
[super markAsFinished];
|
[super markAsFinished];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Delegate
|
||||||
|
|
||||||
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
|
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
|
||||||
if (self.navigationObject.stopLoadingOverlay) {
|
if (self.navigationObject.stopLoadingOverlay) {
|
||||||
[[MVMCoreLoadingOverlayHandler sharedLoadingOverlay] stopLoading:YES];
|
[[MVMCoreLoadingOverlayHandler sharedLoadingOverlay] stopLoading:YES];
|
||||||
@ -234,6 +237,11 @@
|
|||||||
if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:willDisplayViewController:)]) {
|
if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:willDisplayViewController:)]) {
|
||||||
[self.delegate navigationController:navigationController willDisplayViewController:viewController];
|
[self.delegate navigationController:navigationController willDisplayViewController:viewController];
|
||||||
}
|
}
|
||||||
|
for (NSObject<MVMCorePresentationDelegateProtocol> *delegate in [MVMCoreNavigationHandler sharedNavigationHandler].delegates.allObjects) {
|
||||||
|
if (delegate && [delegate respondsToSelector:@selector(navigationController:willDisplayViewController:)]) {
|
||||||
|
[delegate navigationController:navigationController willDisplayViewController:viewController];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
|
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
|
||||||
@ -241,8 +249,13 @@
|
|||||||
if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:displayedViewController:)]) {
|
if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:displayedViewController:)]) {
|
||||||
[self.delegate navigationController:navigationController displayedViewController:viewController];
|
[self.delegate navigationController:navigationController displayedViewController:viewController];
|
||||||
}
|
}
|
||||||
|
for (NSObject<MVMCorePresentationDelegateProtocol> *delegate in [MVMCoreNavigationHandler sharedNavigationHandler].delegates.allObjects) {
|
||||||
|
if (delegate && [delegate respondsToSelector:@selector(navigationController:displayedViewController:)]) {
|
||||||
|
[delegate navigationController:navigationController displayedViewController:viewController];
|
||||||
|
}
|
||||||
|
}
|
||||||
[self markAsFinished];
|
[self markAsFinished];
|
||||||
// Notify that page has changed
|
// Legacy notify that page has changed
|
||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:MVMCoreNotificationViewControllerChanged object:nil];
|
[[NSNotificationCenter defaultCenter] postNotificationName:MVMCoreNotificationViewControllerChanged object:nil];
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MVMCorePresentAnimationOperation.h"
|
#import "MVMCorePresentAnimationOperation.h"
|
||||||
|
#import "MVMCoreNavigationHandler.h"
|
||||||
|
|
||||||
@interface MVMCorePresentAnimationOperation ()
|
@interface MVMCorePresentAnimationOperation ()
|
||||||
|
|
||||||
@ -39,12 +40,22 @@
|
|||||||
if (self.delegate && [self.delegate respondsToSelector:@selector(viewController:willPresentViewController:)]) {
|
if (self.delegate && [self.delegate respondsToSelector:@selector(viewController:willPresentViewController:)]) {
|
||||||
[self.delegate viewController:self.presentingViewController willPresentViewController:self.presentedViewController];
|
[self.delegate viewController:self.presentingViewController willPresentViewController:self.presentedViewController];
|
||||||
}
|
}
|
||||||
|
for (NSObject<MVMCorePresentationDelegateProtocol> *delegate in [MVMCoreNavigationHandler sharedNavigationHandler].delegates.allObjects) {
|
||||||
|
if (delegate && [delegate respondsToSelector:@selector(viewController:willPresentViewController:)]) {
|
||||||
|
[delegate viewController:self.presentingViewController willPresentViewController:self.presentedViewController];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[self.presentingViewController presentViewController:self.presentedViewController animated:self.animate completion:^{
|
[self.presentingViewController presentViewController:self.presentedViewController animated:self.animate completion:^{
|
||||||
|
|
||||||
if (self.delegate && [self.delegate respondsToSelector:@selector(viewController:didPresentViewController:)]) {
|
if (self.delegate && [self.delegate respondsToSelector:@selector(viewController:didPresentViewController:)]) {
|
||||||
[self.delegate viewController:self.presentingViewController didPresentViewController:self.presentedViewController];
|
[self.delegate viewController:self.presentingViewController didPresentViewController:self.presentedViewController];
|
||||||
}
|
}
|
||||||
|
for (NSObject<MVMCorePresentationDelegateProtocol> *delegate in [MVMCoreNavigationHandler sharedNavigationHandler].delegates.allObjects) {
|
||||||
|
if (delegate && [delegate respondsToSelector:@selector(viewController:didPresentViewController:)]) {
|
||||||
|
[delegate viewController:self.presentingViewController didPresentViewController:self.presentedViewController];
|
||||||
|
}
|
||||||
|
}
|
||||||
[self markAsFinished];
|
[self markAsFinished];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user