Merge pull request #19 in BPHVB/mvm_core from feature/tabbar_animation to develop
* commit '6b2ee27c5d002cec02c5f22e92e73a9f8c7f92f9': fixed panning when not interacting. always use animation for direction Add missing protocol call space Tab bar control smarter, only fire off certain things when we commit to swipe code review change code review changes move protocol to core revert changes add delegate function for interactiveTransitionGetCanceled remove destination view controller when transition canceled tab bar swipe interactive transition
This commit is contained in:
commit
05068ec879
@ -40,6 +40,8 @@
|
||||
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, ); }; };
|
||||
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 */; };
|
||||
@ -165,6 +167,8 @@
|
||||
8876D5E71FB50AB000EB2E3D /* UILabel+MFCustom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+MFCustom.m"; sourceTree = "<group>"; };
|
||||
88D1FBDF1FCCCADC00338A3A /* MVMCoreMainSplitViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreMainSplitViewProtocol.h; sourceTree = "<group>"; };
|
||||
88D1FBE01FCCCB2C00338A3A /* PanelProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PanelProtocol.h; sourceTree = "<group>"; };
|
||||
A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewControllerAnimatedTransitioning.h; sourceTree = "<group>"; };
|
||||
AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewManagerViewControllerProtocol.h; sourceTree = "<group>"; };
|
||||
AF26DDAF1FCE6A37004E8F65 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
AF43A5751FBA5B7C008E9347 /* MVMCoreJSONConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreJSONConstants.h; sourceTree = "<group>"; };
|
||||
AF43A5761FBA5B7C008E9347 /* MVMCoreJSONConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreJSONConstants.m; sourceTree = "<group>"; };
|
||||
@ -397,6 +401,7 @@
|
||||
children = (
|
||||
AF43A71A1FC5BEBB008E9347 /* MVMCoreViewControllerProtocol.h */,
|
||||
AF43A71F1FC5D2BA008E9347 /* MVMCoreViewManagerProtocol.h */,
|
||||
AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */,
|
||||
AF43A7401FC5FA6F008E9347 /* MVMCoreViewProtocol.h */,
|
||||
AFEEE8181FCDDE6B00B5EDD0 /* MVMCoreLoggingDelegateProtocol.h */,
|
||||
AF43A7001FC4B227008E9347 /* MVMCoreGlobalLoadProtocol.h */,
|
||||
@ -486,6 +491,7 @@
|
||||
AFBB96771FBA3A9A0008D868 /* MVMCorePresentationDelegateProtocol.h */,
|
||||
AFBB96781FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.h */,
|
||||
AFBB96791FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.m */,
|
||||
A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */,
|
||||
);
|
||||
path = PresentationHandling;
|
||||
sourceTree = "<group>";
|
||||
@ -608,6 +614,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 */,
|
||||
@ -616,6 +623,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 */,
|
||||
|
||||
@ -880,6 +880,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (nullable id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id<UIViewControllerAnimatedTransitioning>)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:)]) {
|
||||
|
||||
@ -77,6 +77,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreVersionString[];
|
||||
#import <MVMCore/MVMCorePresentAnimationOperation.h>
|
||||
#import <MVMCore/MVMCorePresentViewControllerOperation.h>
|
||||
#import <MVMCore/MVMCoreNavigationOperation.h>
|
||||
#import <MVMCore/MVMCoreViewControllerAnimatedTransitioning.h>
|
||||
|
||||
// Action Handling
|
||||
#import <MVMCore/MVMCoreActionHandler.h>
|
||||
@ -87,6 +88,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreVersionString[];
|
||||
// Protocols
|
||||
#import <MVMCore/MVMCoreViewControllerProtocol.h>
|
||||
#import <MVMCore/MVMCoreViewManagerProtocol.h>
|
||||
#import <MVMCore/MVMCoreViewManagerViewControllerProtocol.h>
|
||||
#import <MVMCore/MVMCoreViewProtocol.h>
|
||||
#import <MVMCore/MVMCoreLoggingDelegateProtocol.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 <UIKit/UIKit.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 <Foundation/Foundation.h>
|
||||
|
||||
@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 <MVMCoreViewManagerProtocol>*)manager;
|
||||
|
||||
// Notifies the current showing view controller that the manager is disappearing.
|
||||
- (void)managerWillDisappear:(nonnull NSObject <MVMCoreViewManagerProtocol>*)manager;
|
||||
|
||||
@end
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#import "MVMCoreViewControllerProtocol.h"
|
||||
#import "MVMCoreLoggingHandler.h"
|
||||
#import "MVMCoreLoadingOverlayHandler.h"
|
||||
#import "MVMCoreViewControllerAnimatedTransitioning.h"
|
||||
|
||||
@interface MVMCoreNavigationOperation ()
|
||||
|
||||
@ -240,10 +241,39 @@
|
||||
|
||||
- (nullable id <UIViewControllerAnimatedTransitioning>)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];
|
||||
if ([animatedTransitioning conformsToProtocol:@protocol(MVMCoreViewControllerAnimatedTransitioning)]) {
|
||||
[animatedTransitioning addObserver:self forKeyPath:@"interactiveTransitionCanceled" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil];
|
||||
}
|
||||
return animatedTransitioning;
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (nullable id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id<UIViewControllerAnimatedTransitioning>)animationController {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:interactionControllerForAnimationController:)]) {
|
||||
return [self.delegate navigationController:navigationController interactionControllerForAnimationController:animationController];
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)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:interactiveTransitionWasCanceled:)]) {
|
||||
[self.delegate navigationController:self.navigationObject.navigationController interactiveTransitionWasCanceled:true];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -19,11 +19,18 @@
|
||||
// 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 interactiveTransitionWasCanceled:(BOOL)canceled;
|
||||
|
||||
|
||||
- (nullable id <UIViewControllerAnimatedTransitioning>)navigationController:(nonnull UINavigationController *)navigationController
|
||||
animationControllerForOperation:(UINavigationControllerOperation)operation
|
||||
fromViewController:(nonnull UIViewController *)fromVC
|
||||
toViewController:(nonnull UIViewController *)toVC NS_AVAILABLE_IOS(7_0);
|
||||
|
||||
- (nullable id <UIViewControllerInteractiveTransitioning>)navigationController:(nonnull UINavigationController *)navigationController
|
||||
interactionControllerForAnimationController:(nonnull id <UIViewControllerAnimatedTransitioning>) 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;
|
||||
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
//
|
||||
// MVMCoreViewControllerAnimatedTransitioning.h
|
||||
// MVMCore
|
||||
//
|
||||
// Created by Chen, Mingyuan on 6/5/18.
|
||||
// Copyright © 2018 myverizon. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol MVMCoreViewControllerAnimatedTransitioning <UIViewControllerAnimatedTransitioning>
|
||||
|
||||
@required
|
||||
|
||||
@property (nonatomic) BOOL interactiveTransitionCanceled;
|
||||
|
||||
@end
|
||||
Loading…
Reference in New Issue
Block a user