move protocol to core

This commit is contained in:
Michael Chen 2018-06-06 11:51:46 -04:00
parent 1ecf4efe42
commit dbedbfeac1
5 changed files with 28 additions and 4 deletions

View File

@ -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 = "<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>"; };
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>"; };
@ -488,6 +490,7 @@
AFBB96771FBA3A9A0008D868 /* MVMCorePresentationDelegateProtocol.h */,
AFBB96781FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.h */,
AFBB96791FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.m */,
A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */,
);
path = PresentationHandling;
sourceTree = "<group>";
@ -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 */,

View File

@ -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>

View File

@ -12,6 +12,7 @@
#import "MVMCoreViewControllerProtocol.h"
#import "MVMCoreLoggingHandler.h"
#import "MVMCoreLoadingOverlayHandler.h"
#import "MVMCoreViewControllerAnimatedTransitioning.h"
@interface MVMCoreNavigationOperation ()
@ -241,7 +242,9 @@
- (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:)]) {
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 {

View File

@ -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 <UIViewControllerAnimatedTransitioning>)navigationController:(nonnull UINavigationController *)navigationController

View File

@ -0,0 +1,16 @@
//
// MVMCoreViewControllerAnimatedTransitioning.h
// MVMCore
//
// Created by Chen, Mingyuan on 6/5/18.
// Copyright © 2018 myverizon. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol MVMCoreViewControllerAnimatedTransitioning <UIViewControllerAnimatedTransitioning>
@optional
@property (nonatomic) BOOL interactiveTransitionCanceled;
@end