From 92fb1d96b8603405f1659b20677aea9a3b9003c5 Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Mon, 4 Jun 2018 13:20:04 -0400 Subject: [PATCH 01/10] tab bar swipe interactive transition --- .../MVMCoreLoadRequestOperation.m | 8 ++++++ .../MVMCoreNavigationHandler.m | 2 ++ .../MVMCoreNavigationOperation.m | 27 +++++++++++++++++-- .../MVMCorePresentationDelegateProtocol.h | 3 +++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index e989287..dca4a10 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -867,6 +867,14 @@ } } +- (id )navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id)animationController { + if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:interactionControllerForAnimationController:)]) { + return [self.delegate navigationController:navigationController interactionControllerForAnimationController:animationController]; + } else { + return nil; + } +} + - (void)viewController:(UIViewController *)presentingViewController willPresentViewController:(UIViewController *)presentedViewController { if ([self.delegate respondsToSelector:@selector(viewController:willPresentViewController:)]) { diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m index b6aa0aa..f46368c 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m @@ -193,6 +193,8 @@ MVMCoreNavigationObject *navigationObject = [[MVMCoreNavigationObject alloc] initWithViewController:viewController navigationController:navigationController viewControllers:nil animated:animated tryToReplaceFirst:replaceInStack navigationType:NavigationTypeReplaceTop]; [self startNavigationWithNavigationObject:navigationObject delegate:delegate completionHandler:completionBlock]; + + } - (void)replaceAfterRoot:(nonnull UIViewController *)viewController navigationController:(nullable UINavigationController *)navigationController animated:(BOOL)animated delegate:(nullable NSObject*)delegate replaceInStack:(BOOL)replaceInStack completionHandler:(nullable void (^)(void))completionBlock { diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m index a1fda67..ffd3c82 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m @@ -106,7 +106,10 @@ // Replaces the current view controller. NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:self.navigationObject.navigationController.viewControllers]; - [viewControllers replaceObjectAtIndex:([self.navigationObject.navigationController.viewControllers count] - 1) withObject:self.navigationObject.viewController]; + if (viewControllers.count > 1) { + [viewControllers removeObjectAtIndex:0]; + } + [viewControllers replaceObjectAtIndex:(viewControllers.count - 1) withObject:self.navigationObject.viewController]; [self setViewControllers:viewControllers]; } else { @@ -240,10 +243,30 @@ - (nullable id )navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC { if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:animationControllerForOperation:fromViewController:toViewController:)]) { - return [self.delegate navigationController:navigationController animationControllerForOperation:operation fromViewController:fromVC toViewController:toVC]; + id animatedTransitioning = [self.delegate navigationController:navigationController animationControllerForOperation:operation fromViewController:fromVC toViewController:toVC]; + [animatedTransitioning addObserver:self forKeyPath:@"interactiveTransitionCanceled" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil]; + return animatedTransitioning; } else { return nil; } } +- (nullable id )navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id)animationController { + if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:interactionControllerForAnimationController:)]) { + id interactiveTransitioning = [self.delegate navigationController:navigationController interactionControllerForAnimationController:animationController]; + return interactiveTransitioning; + } else { + return nil; + } +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + if ([keyPath isEqualToString:@"interactiveTransitionCanceled"]) { + BOOL transitionStoped = ((NSNumber*)change[NSKeyValueChangeNewKey]).boolValue; + if (transitionStoped) { + [self markAsFinished]; + } + } +} + @end diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h b/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h index 219abd8..b4c29c4 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h +++ b/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h @@ -24,6 +24,9 @@ fromViewController:(nonnull UIViewController *)fromVC toViewController:(nonnull UIViewController *)toVC NS_AVAILABLE_IOS(7_0); +- (nullable id )navigationController:(nonnull UINavigationController *)navigationController + interactionControllerForAnimationController:(nonnull id ) animationController NS_AVAILABLE_IOS(7_0); + // Called when a view controller will be presented on another view controller - (void)viewController:(nonnull UIViewController *)presentingViewController willPresentViewController:(nonnull UIViewController *)presentedViewController; From d3b078e984d64fc8d217b9d0b3ca77778bf5c266 Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Tue, 5 Jun 2018 09:41:10 -0400 Subject: [PATCH 02/10] remove destination view controller when transition canceled --- .../PresentationHandling/MVMCoreNavigationOperation.m | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m index ffd3c82..95f78cd 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m @@ -106,10 +106,7 @@ // Replaces the current view controller. NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:self.navigationObject.navigationController.viewControllers]; - if (viewControllers.count > 1) { - [viewControllers removeObjectAtIndex:0]; - } - [viewControllers replaceObjectAtIndex:(viewControllers.count - 1) withObject:self.navigationObject.viewController]; + [viewControllers replaceObjectAtIndex:([self.navigationObject.navigationController.viewControllers count] - 1) withObject:self.navigationObject.viewController]; [self setViewControllers:viewControllers]; } else { @@ -262,8 +259,10 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:@"interactiveTransitionCanceled"]) { - BOOL transitionStoped = ((NSNumber*)change[NSKeyValueChangeNewKey]).boolValue; - if (transitionStoped) { + BOOL transitionCanceled = ((NSNumber*)change[NSKeyValueChangeNewKey]).boolValue; + if (transitionCanceled) { + //When interactive transition canceled, the destination viewController should be removed from navigationController + [self.navigationObject.viewController removeFromParentViewController]; [self markAsFinished]; } } From 46f7c46b1aedb45d53421781e87ade0e59749a90 Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Tue, 5 Jun 2018 13:30:30 -0400 Subject: [PATCH 03/10] add delegate function for interactiveTransitionGetCanceled --- .../PresentationHandling/MVMCoreNavigationOperation.m | 9 +++++++-- .../MVMCorePresentationDelegateProtocol.h | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m index 95f78cd..c037aa4 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m @@ -250,8 +250,7 @@ - (nullable id )navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id)animationController { if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:interactionControllerForAnimationController:)]) { - id interactiveTransitioning = [self.delegate navigationController:navigationController interactionControllerForAnimationController:animationController]; - return interactiveTransitioning; + return [self.delegate navigationController:navigationController interactionControllerForAnimationController:animationController]; } else { return nil; } @@ -259,12 +258,18 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:@"interactiveTransitionCanceled"]) { + [object removeObserver:self forKeyPath:@"interactiveTransitionCanceled"]; BOOL transitionCanceled = ((NSNumber*)change[NSKeyValueChangeNewKey]).boolValue; if (transitionCanceled) { //When interactive transition canceled, the destination viewController should be removed from navigationController [self.navigationObject.viewController removeFromParentViewController]; [self markAsFinished]; + if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:interactiveTransitionGetCanceled:)]) { + [self.delegate navigationController:self.navigationObject.navigationController interactiveTransitionGetCanceled: true]; + } } + } else { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } } diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h b/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h index b4c29c4..c57afab 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h +++ b/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h @@ -19,6 +19,10 @@ // Called when a view controller has been displayed on a navigation controller - (void)navigationController:(nonnull UINavigationController *)navigationController displayedViewController:(nonnull UIViewController *)viewController; +// Called when interactive transition get canceled +- (void)navigationController:(nonnull UINavigationController *)navigationController interactiveTransitionGetCanceled:(BOOL)canceled; + + - (nullable id )navigationController:(nonnull UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(nonnull UIViewController *)fromVC From 1ecf4efe429446f4cbc0e0872629fe4ec37c353e Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Tue, 5 Jun 2018 13:47:11 -0400 Subject: [PATCH 04/10] revert changes --- .../MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m | 8 -------- .../PresentationHandling/MVMCoreNavigationHandler.m | 2 -- 2 files changed, 10 deletions(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index dca4a10..e989287 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -867,14 +867,6 @@ } } -- (id )navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id)animationController { - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:interactionControllerForAnimationController:)]) { - return [self.delegate navigationController:navigationController interactionControllerForAnimationController:animationController]; - } else { - return nil; - } -} - - (void)viewController:(UIViewController *)presentingViewController willPresentViewController:(UIViewController *)presentedViewController { if ([self.delegate respondsToSelector:@selector(viewController:willPresentViewController:)]) { diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m index f46368c..b6aa0aa 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m @@ -193,8 +193,6 @@ MVMCoreNavigationObject *navigationObject = [[MVMCoreNavigationObject alloc] initWithViewController:viewController navigationController:navigationController viewControllers:nil animated:animated tryToReplaceFirst:replaceInStack navigationType:NavigationTypeReplaceTop]; [self startNavigationWithNavigationObject:navigationObject delegate:delegate completionHandler:completionBlock]; - - } - (void)replaceAfterRoot:(nonnull UIViewController *)viewController navigationController:(nullable UINavigationController *)navigationController animated:(BOOL)animated delegate:(nullable NSObject*)delegate replaceInStack:(BOOL)replaceInStack completionHandler:(nullable void (^)(void))completionBlock { From dbedbfeac190880ef5a14ca9b8e5a0212d5de229 Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Wed, 6 Jun 2018 11:51:46 -0400 Subject: [PATCH 05/10] move protocol to core --- MVMCore/MVMCore.xcodeproj/project.pbxproj | 4 ++++ MVMCore/MVMCore/MVMCore.h | 1 + .../MVMCoreNavigationOperation.m | 9 ++++++--- .../MVMCorePresentationDelegateProtocol.h | 2 +- .../MVMCoreViewControllerAnimatedTransitioning.h | 16 ++++++++++++++++ 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 MVMCore/MVMCore/PresentationHandling/MVMCoreViewControllerAnimatedTransitioning.h diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index f1d48bc..6782c50 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -40,6 +40,7 @@ 8876D5F51FB50AB000EB2E3D /* UILabel+MFCustom.m in Sources */ = {isa = PBXBuildFile; fileRef = 8876D5E71FB50AB000EB2E3D /* UILabel+MFCustom.m */; }; 88D1FBE11FCCCBA100338A3A /* MVMCoreMainSplitViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 88D1FBDF1FCCCADC00338A3A /* MVMCoreMainSplitViewProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; 88D1FBE21FCCCBA500338A3A /* PanelProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 88D1FBE01FCCCB2C00338A3A /* PanelProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A332F33F20C7231700DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h in Headers */ = {isa = PBXBuildFile; fileRef = A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF26DDAE1FCE6A37004E8F65 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF26DDB01FCE6A37004E8F65 /* Localizable.strings */; }; AF43A5771FBA5B7C008E9347 /* MVMCoreJSONConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A5751FBA5B7C008E9347 /* MVMCoreJSONConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF43A5781FBA5B7C008E9347 /* MVMCoreJSONConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = AF43A5761FBA5B7C008E9347 /* MVMCoreJSONConstants.m */; }; @@ -166,6 +167,7 @@ 8876D5E71FB50AB000EB2E3D /* UILabel+MFCustom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+MFCustom.m"; sourceTree = ""; }; 88D1FBDF1FCCCADC00338A3A /* MVMCoreMainSplitViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreMainSplitViewProtocol.h; sourceTree = ""; }; 88D1FBE01FCCCB2C00338A3A /* PanelProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PanelProtocol.h; sourceTree = ""; }; + A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewControllerAnimatedTransitioning.h; sourceTree = ""; }; AF26DDAF1FCE6A37004E8F65 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; AF43A5751FBA5B7C008E9347 /* MVMCoreJSONConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreJSONConstants.h; sourceTree = ""; }; AF43A5761FBA5B7C008E9347 /* MVMCoreJSONConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreJSONConstants.m; sourceTree = ""; }; @@ -488,6 +490,7 @@ AFBB96771FBA3A9A0008D868 /* MVMCorePresentationDelegateProtocol.h */, AFBB96781FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.h */, AFBB96791FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.m */, + A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */, ); path = PresentationHandling; sourceTree = ""; @@ -619,6 +622,7 @@ 881D26951FCC9D180079C521 /* MVMCoreErrorObject.h in Headers */, AFBB96341FBA34310008D868 /* MVMCoreErrorConstants.h in Headers */, 88D1FBE21FCCCBA500338A3A /* PanelProtocol.h in Headers */, + A332F33F20C7231700DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h in Headers */, AFBB968D1FBA3A9A0008D868 /* MVMCoreNavigationHandler.h in Headers */, AFBB96A51FBA3A9A0008D868 /* MVMCoreTopAlertOperation.h in Headers */, AFBB96A11FBA3A9A0008D868 /* MVMCoreTopAlertAnimationDelegateProtocol.h in Headers */, diff --git a/MVMCore/MVMCore/MVMCore.h b/MVMCore/MVMCore/MVMCore.h index e3402cf..3dabd81 100644 --- a/MVMCore/MVMCore/MVMCore.h +++ b/MVMCore/MVMCore/MVMCore.h @@ -77,6 +77,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreVersionString[]; #import #import #import +#import // Action Handling #import diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m index c037aa4..60dfd9e 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m @@ -12,6 +12,7 @@ #import "MVMCoreViewControllerProtocol.h" #import "MVMCoreLoggingHandler.h" #import "MVMCoreLoadingOverlayHandler.h" +#import "MVMCoreViewControllerAnimatedTransitioning.h" @interface MVMCoreNavigationOperation () @@ -241,7 +242,9 @@ - (nullable id )navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC { if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:animationControllerForOperation:fromViewController:toViewController:)]) { id animatedTransitioning = [self.delegate navigationController:navigationController animationControllerForOperation:operation fromViewController:fromVC toViewController:toVC]; - [animatedTransitioning addObserver:self forKeyPath:@"interactiveTransitionCanceled" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil]; + if ([animatedTransitioning conformsToProtocol:@protocol(MVMCoreViewControllerAnimatedTransitioning)]) { + [animatedTransitioning addObserver:self forKeyPath:@"interactiveTransitionCanceled" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil]; + } return animatedTransitioning; } else { return nil; @@ -264,8 +267,8 @@ //When interactive transition canceled, the destination viewController should be removed from navigationController [self.navigationObject.viewController removeFromParentViewController]; [self markAsFinished]; - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:interactiveTransitionGetCanceled:)]) { - [self.delegate navigationController:self.navigationObject.navigationController interactiveTransitionGetCanceled: true]; + if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:interactiveTransitionWasCanceled:)]) { + [self.delegate navigationController:self.navigationObject.navigationController interactiveTransitionWasCanceled: true]; } } } else { diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h b/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h index c57afab..8dc27f4 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h +++ b/MVMCore/MVMCore/PresentationHandling/MVMCorePresentationDelegateProtocol.h @@ -20,7 +20,7 @@ - (void)navigationController:(nonnull UINavigationController *)navigationController displayedViewController:(nonnull UIViewController *)viewController; // Called when interactive transition get canceled -- (void)navigationController:(nonnull UINavigationController *)navigationController interactiveTransitionGetCanceled:(BOOL)canceled; +- (void)navigationController:(nonnull UINavigationController *)navigationController interactiveTransitionWasCanceled:(BOOL)canceled; - (nullable id )navigationController:(nonnull UINavigationController *)navigationController diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreViewControllerAnimatedTransitioning.h b/MVMCore/MVMCore/PresentationHandling/MVMCoreViewControllerAnimatedTransitioning.h new file mode 100644 index 0000000..9a4a384 --- /dev/null +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreViewControllerAnimatedTransitioning.h @@ -0,0 +1,16 @@ +// +// MVMCoreViewControllerAnimatedTransitioning.h +// MVMCore +// +// Created by Chen, Mingyuan on 6/5/18. +// Copyright © 2018 myverizon. All rights reserved. +// + +#import + +@protocol MVMCoreViewControllerAnimatedTransitioning + +@optional +@property (nonatomic) BOOL interactiveTransitionCanceled; + +@end From c398be416bda10388b05abe0c09130c0ef1708f9 Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Mon, 11 Jun 2018 14:28:29 -0400 Subject: [PATCH 06/10] code review changes --- .../MVMCore/PresentationHandling/MVMCoreNavigationOperation.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m index 60dfd9e..bb4f7f8 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m @@ -268,7 +268,7 @@ [self.navigationObject.viewController removeFromParentViewController]; [self markAsFinished]; if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:interactiveTransitionWasCanceled:)]) { - [self.delegate navigationController:self.navigationObject.navigationController interactiveTransitionWasCanceled: true]; + [self.delegate navigationController:self.navigationObject.navigationController interactiveTransitionWasCanceled:true]; } } } else { From 4ec9ffb62f0d12d037e24e9e3a678712b119274d Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Mon, 11 Jun 2018 15:07:20 -0400 Subject: [PATCH 07/10] code review change --- .../MVMCoreViewControllerAnimatedTransitioning.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreViewControllerAnimatedTransitioning.h b/MVMCore/MVMCore/PresentationHandling/MVMCoreViewControllerAnimatedTransitioning.h index 9a4a384..c5fc952 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreViewControllerAnimatedTransitioning.h +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreViewControllerAnimatedTransitioning.h @@ -10,7 +10,8 @@ @protocol MVMCoreViewControllerAnimatedTransitioning -@optional +@required + @property (nonatomic) BOOL interactiveTransitionCanceled; @end From 5a48811c5f464e64a0df48d50893b57272283400 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 25 Jul 2018 14:15:57 -0400 Subject: [PATCH 08/10] Tab bar control smarter, only fire off certain things when we commit to swipe --- MVMCore/MVMCore.xcodeproj/project.pbxproj | 4 ++++ MVMCore/MVMCore/MVMCore.h | 1 + .../MVMCoreViewManagerProtocol.h | 1 + ...MVMCoreViewManagerViewControllerProtocol.h | 23 +++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerViewControllerProtocol.h diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index 6782c50..c90029e 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -41,6 +41,7 @@ 88D1FBE11FCCCBA100338A3A /* MVMCoreMainSplitViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 88D1FBDF1FCCCADC00338A3A /* MVMCoreMainSplitViewProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; 88D1FBE21FCCCBA500338A3A /* PanelProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 88D1FBE01FCCCB2C00338A3A /* PanelProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; A332F33F20C7231700DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h in Headers */ = {isa = PBXBuildFile; fileRef = A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AF1201832108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF26DDAE1FCE6A37004E8F65 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF26DDB01FCE6A37004E8F65 /* Localizable.strings */; }; AF43A5771FBA5B7C008E9347 /* MVMCoreJSONConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A5751FBA5B7C008E9347 /* MVMCoreJSONConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF43A5781FBA5B7C008E9347 /* MVMCoreJSONConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = AF43A5761FBA5B7C008E9347 /* MVMCoreJSONConstants.m */; }; @@ -168,6 +169,7 @@ 88D1FBDF1FCCCADC00338A3A /* MVMCoreMainSplitViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreMainSplitViewProtocol.h; sourceTree = ""; }; 88D1FBE01FCCCB2C00338A3A /* PanelProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PanelProtocol.h; sourceTree = ""; }; A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewControllerAnimatedTransitioning.h; sourceTree = ""; }; + AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewManagerViewControllerProtocol.h; sourceTree = ""; }; AF26DDAF1FCE6A37004E8F65 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; AF43A5751FBA5B7C008E9347 /* MVMCoreJSONConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreJSONConstants.h; sourceTree = ""; }; AF43A5761FBA5B7C008E9347 /* MVMCoreJSONConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreJSONConstants.m; sourceTree = ""; }; @@ -401,6 +403,7 @@ children = ( AF43A71A1FC5BEBB008E9347 /* MVMCoreViewControllerProtocol.h */, AF43A71F1FC5D2BA008E9347 /* MVMCoreViewManagerProtocol.h */, + AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */, AF43A7401FC5FA6F008E9347 /* MVMCoreViewProtocol.h */, AFEEE8181FCDDE6B00B5EDD0 /* MVMCoreLoggingDelegateProtocol.h */, AF43A7001FC4B227008E9347 /* MVMCoreGlobalLoadProtocol.h */, @@ -614,6 +617,7 @@ AFBB968F1FBA3A9A0008D868 /* MVMCoreNavigationObject.h in Headers */, 8876D5EC1FB50AB000EB2E3D /* NSDictionary+MFConvenience.h in Headers */, AFFCFA651FCCC0D700FD0730 /* MVMCoreLoadingOverlayDelegateProtocol.h in Headers */, + AF1201832108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h in Headers */, AFBB96A31FBA3A9A0008D868 /* MVMCoreTopAlertObject.h in Headers */, AFBB96981FBA3A9A0008D868 /* MVMCoreAlertController.h in Headers */, 881D26961FCC9D180079C521 /* MVMCoreOperation.h in Headers */, diff --git a/MVMCore/MVMCore/MVMCore.h b/MVMCore/MVMCore/MVMCore.h index 3dabd81..2fd8fae 100644 --- a/MVMCore/MVMCore/MVMCore.h +++ b/MVMCore/MVMCore/MVMCore.h @@ -88,6 +88,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreVersionString[]; // Protocols #import #import +#import #import #import diff --git a/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerProtocol.h b/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerProtocol.h index a3609e6..b9ab523 100644 --- a/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerProtocol.h +++ b/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerProtocol.h @@ -5,6 +5,7 @@ // Created by Pfeil, Scott Robert on 11/22/17. // Copyright © 2017 myverizon. All rights reserved. // +// A protocol for custom view managers. #import diff --git a/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerViewControllerProtocol.h b/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerViewControllerProtocol.h new file mode 100644 index 0000000..962a689 --- /dev/null +++ b/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerViewControllerProtocol.h @@ -0,0 +1,23 @@ +// +// MVMCoreViewManagerViewControllerProtocol.h +// MVMCore +// +// Created by Pfeil, Scott Robert on 7/25/18. +// Copyright © 2018 myverizon. All rights reserved. +// +// A protocol for view controllers that can be added to a view manager. + +#import + +@protocol MVMCoreViewManagerViewControllerProtocol + +@optional + +// Notifies the view controller that it can be ready (usually means that it's committed to the screen). +- (void)viewControllerReadyInManager:(nonnull NSObject *)manager; + +// Notifies the current showing view controller that the manager is disappearing. +- (void)managerWillDisappear:(nonnull NSObject *)manager; + +@end + From 6275e0e829b1e10ff8125ace2a106023ef43fe54 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 25 Jul 2018 15:33:02 -0400 Subject: [PATCH 09/10] space --- .../MVMCore/PresentationHandling/MVMCoreNavigationOperation.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m index bb4f7f8..a7e637d 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m @@ -262,7 +262,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:@"interactiveTransitionCanceled"]) { [object removeObserver:self forKeyPath:@"interactiveTransitionCanceled"]; - BOOL transitionCanceled = ((NSNumber*)change[NSKeyValueChangeNewKey]).boolValue; + BOOL transitionCanceled = ((NSNumber *)change[NSKeyValueChangeNewKey]).boolValue; if (transitionCanceled) { //When interactive transition canceled, the destination viewController should be removed from navigationController [self.navigationObject.viewController removeFromParentViewController]; From 6b2ee27c5d002cec02c5f22e92e73a9f8c7f92f9 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 21 Aug 2018 14:35:18 -0400 Subject: [PATCH 10/10] fixed panning when not interacting. always use animation for direction Add missing protocol call --- .../MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index b01a990..7f00738 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -880,6 +880,14 @@ } } +- (nullable id )navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id)animationController { + if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:interactionControllerForAnimationController:)]) { + return [self.delegate navigationController:navigationController interactionControllerForAnimationController:animationController]; + } else { + return nil; + } +} + - (void)viewController:(UIViewController *)presentingViewController willPresentViewController:(UIViewController *)presentedViewController { if ([self.delegate respondsToSelector:@selector(viewController:willPresentViewController:)]) {