Merge pull request #44 in BPHVB/mvm_core from feature/template to develop
* commit '1429fd1faeb3a94cb3c67834caec74a414b348d0': remove duplicate function Move back to delegate. Throw error when using exact class, don't throw error when using protocol. remove unused search path instance type checks moved some to ui framework Migration basic template base core ui framework with placeholder template
This commit is contained in:
commit
839eee33e8
@ -38,8 +38,6 @@
|
|||||||
8876D5F31FB50AB000EB2E3D /* UIFont+MFSpacing.m in Sources */ = {isa = PBXBuildFile; fileRef = 8876D5E51FB50AB000EB2E3D /* UIFont+MFSpacing.m */; };
|
8876D5F31FB50AB000EB2E3D /* UIFont+MFSpacing.m in Sources */ = {isa = PBXBuildFile; fileRef = 8876D5E51FB50AB000EB2E3D /* UIFont+MFSpacing.m */; };
|
||||||
8876D5F41FB50AB000EB2E3D /* UILabel+MFCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 8876D5E61FB50AB000EB2E3D /* UILabel+MFCustom.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
8876D5F41FB50AB000EB2E3D /* UILabel+MFCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 8876D5E61FB50AB000EB2E3D /* UILabel+MFCustom.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
8876D5F51FB50AB000EB2E3D /* UILabel+MFCustom.m in Sources */ = {isa = PBXBuildFile; fileRef = 8876D5E71FB50AB000EB2E3D /* UILabel+MFCustom.m */; };
|
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, ); }; };
|
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, ); }; };
|
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 */; };
|
AF26DDAE1FCE6A37004E8F65 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF26DDB01FCE6A37004E8F65 /* Localizable.strings */; };
|
||||||
@ -165,8 +163,6 @@
|
|||||||
8876D5E51FB50AB000EB2E3D /* UIFont+MFSpacing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIFont+MFSpacing.m"; sourceTree = "<group>"; };
|
8876D5E51FB50AB000EB2E3D /* UIFont+MFSpacing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIFont+MFSpacing.m"; sourceTree = "<group>"; };
|
||||||
8876D5E61FB50AB000EB2E3D /* UILabel+MFCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+MFCustom.h"; sourceTree = "<group>"; };
|
8876D5E61FB50AB000EB2E3D /* UILabel+MFCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+MFCustom.h"; sourceTree = "<group>"; };
|
||||||
8876D5E71FB50AB000EB2E3D /* UILabel+MFCustom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+MFCustom.m"; sourceTree = "<group>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
AF26DDAF1FCE6A37004E8F65 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
@ -318,7 +314,6 @@
|
|||||||
AFBB96DE1FBA48CE0008D868 /* Singletons */,
|
AFBB96DE1FBA48CE0008D868 /* Singletons */,
|
||||||
AF43A70C1FC4F42B008E9347 /* Session */,
|
AF43A70C1FC4F42B008E9347 /* Session */,
|
||||||
AFBB96D41FBA48240008D868 /* OtherHandlers */,
|
AFBB96D41FBA48240008D868 /* OtherHandlers */,
|
||||||
AF43A5941FBB700D008E9347 /* MainStructure */,
|
|
||||||
AF26DDAB1FCE5CF2004E8F65 /* Strings */,
|
AF26DDAB1FCE5CF2004E8F65 /* Strings */,
|
||||||
8876D5CC1FB50A9E00EB2E3D /* MVMCore.h */,
|
8876D5CC1FB50A9E00EB2E3D /* MVMCore.h */,
|
||||||
8876D5CD1FB50A9E00EB2E3D /* Info.plist */,
|
8876D5CD1FB50A9E00EB2E3D /* Info.plist */,
|
||||||
@ -366,15 +361,6 @@
|
|||||||
path = Strings;
|
path = Strings;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
AF43A5941FBB700D008E9347 /* MainStructure */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
88D1FBE01FCCCB2C00338A3A /* PanelProtocol.h */,
|
|
||||||
88D1FBDF1FCCCADC00338A3A /* MVMCoreMainSplitViewProtocol.h */,
|
|
||||||
);
|
|
||||||
path = MainStructure;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
AF43A6FC1FBE2F2A008E9347 /* Reachability */ = {
|
AF43A6FC1FBE2F2A008E9347 /* Reachability */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -622,7 +608,6 @@
|
|||||||
AF43A7201FC5D2BA008E9347 /* MVMCoreViewManagerProtocol.h in Headers */,
|
AF43A7201FC5D2BA008E9347 /* MVMCoreViewManagerProtocol.h in Headers */,
|
||||||
881D26951FCC9D180079C521 /* MVMCoreErrorObject.h in Headers */,
|
881D26951FCC9D180079C521 /* MVMCoreErrorObject.h in Headers */,
|
||||||
AFBB96341FBA34310008D868 /* MVMCoreErrorConstants.h in Headers */,
|
AFBB96341FBA34310008D868 /* MVMCoreErrorConstants.h in Headers */,
|
||||||
88D1FBE21FCCCBA500338A3A /* PanelProtocol.h in Headers */,
|
|
||||||
A332F33F20C7231700DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h in Headers */,
|
A332F33F20C7231700DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h in Headers */,
|
||||||
AFBB968D1FBA3A9A0008D868 /* MVMCoreNavigationHandler.h in Headers */,
|
AFBB968D1FBA3A9A0008D868 /* MVMCoreNavigationHandler.h in Headers */,
|
||||||
AFBB96A51FBA3A9A0008D868 /* MVMCoreTopAlertOperation.h in Headers */,
|
AFBB96A51FBA3A9A0008D868 /* MVMCoreTopAlertOperation.h in Headers */,
|
||||||
@ -647,7 +632,6 @@
|
|||||||
AFEEE81E1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.h in Headers */,
|
AFEEE81E1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.h in Headers */,
|
||||||
AF43A7011FC4B227008E9347 /* MVMCoreGlobalLoadProtocol.h in Headers */,
|
AF43A7011FC4B227008E9347 /* MVMCoreGlobalLoadProtocol.h in Headers */,
|
||||||
AF43A5771FBA5B7C008E9347 /* MVMCoreJSONConstants.h in Headers */,
|
AF43A5771FBA5B7C008E9347 /* MVMCoreJSONConstants.h in Headers */,
|
||||||
88D1FBE11FCCCBA100338A3A /* MVMCoreMainSplitViewProtocol.h in Headers */,
|
|
||||||
AFBB96631FBA3A570008D868 /* MVMCoreLoadRequestOperation.h in Headers */,
|
AFBB96631FBA3A570008D868 /* MVMCoreLoadRequestOperation.h in Headers */,
|
||||||
AFC5FA1D1FFC39C700C244CF /* MVMCoreTopAlertViewProtocol.h in Headers */,
|
AFC5FA1D1FFC39C700C244CF /* MVMCoreTopAlertViewProtocol.h in Headers */,
|
||||||
AFBB969D1FBA3A9A0008D868 /* MVMCoreAlertObject.h in Headers */,
|
AFBB969D1FBA3A9A0008D868 /* MVMCoreAlertObject.h in Headers */,
|
||||||
@ -962,11 +946,7 @@
|
|||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
"$(inherited)",
|
|
||||||
"$(PROJECT_DIR)/MVMCore/EmbeddedLibaries/AdobeMobileLibrary",
|
|
||||||
"$(PROJECT_DIR)/MVMCore/EmbeddedLibraries/VZAnalytics",
|
|
||||||
);
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCore;
|
PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCore;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
@ -991,11 +971,7 @@
|
|||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
"$(inherited)",
|
|
||||||
"$(PROJECT_DIR)/MVMCore/EmbeddedLibaries/AdobeMobileLibrary",
|
|
||||||
"$(PROJECT_DIR)/MVMCore/EmbeddedLibraries/VZAnalytics",
|
|
||||||
);
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCore;
|
PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCore;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
|
|||||||
@ -36,6 +36,7 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
|||||||
@implementation MVMCoreActionHandler
|
@implementation MVMCoreActionHandler
|
||||||
|
|
||||||
+ (nullable instancetype)sharedActionHandler {
|
+ (nullable instancetype)sharedActionHandler {
|
||||||
|
[MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].actionHandler.class otherClass:self throwException:YES];
|
||||||
return [MVMCoreObject sharedInstance].actionHandler;
|
return [MVMCoreObject sharedInstance].actionHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,4 +17,7 @@
|
|||||||
- (void)topAlertViewShown:(nonnull id)topAlert topAlertObject:(nonnull MVMCoreTopAlertObject *)topAlertObject;
|
- (void)topAlertViewShown:(nonnull id)topAlert topAlertObject:(nonnull MVMCoreTopAlertObject *)topAlertObject;
|
||||||
- (void)topAlertViewDismissed:(nonnull id)topAlert;
|
- (void)topAlertViewDismissed:(nonnull id)topAlert;
|
||||||
|
|
||||||
|
// Called when the top alert is pressed. Determines if we should load the option the default way or not.
|
||||||
|
- (BOOL)shouldLoadTopAlertAction:(nullable NSDictionary *)actionMap additionalData:(nullable NSDictionary *)additionalData;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -721,13 +721,13 @@
|
|||||||
completionHandler(viewController,loadObject);
|
completionHandler(viewController,loadObject);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Initialize the view controller using the pageType-ViewController mapping. (on the main thread)
|
// Initialize the view controller using the ViewController mapping. (on the main thread)
|
||||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||||
|
|
||||||
__block MVMCoreErrorObject *error = nil;
|
__block UIViewController <MVMCoreViewControllerProtocol> *viewController = [[MVMCoreViewControllerMappingObject sharedViewControllerMappingObject] createMFViewControllerOfTemplate:[loadObject.pageJSON string:@"template"] pageType:loadObject.pageType];
|
||||||
__block UIViewController <MVMCoreViewControllerProtocol> *viewController = [[MVMCoreViewControllerMappingObject sharedViewControllerMappingObject] createMFViewControllerOfPageType:loadObject.pageType error:&error];
|
|
||||||
[MVMCoreDispatchUtility performBlockInBackground:^{
|
[MVMCoreDispatchUtility performBlockInBackground:^{
|
||||||
|
|
||||||
|
MVMCoreErrorObject *error = nil;
|
||||||
BOOL shouldContinue = NO;
|
BOOL shouldContinue = NO;
|
||||||
if (viewController) {
|
if (viewController) {
|
||||||
|
|
||||||
@ -743,10 +743,6 @@
|
|||||||
viewController = nil;
|
viewController = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (error) {
|
|
||||||
|
|
||||||
// Sets the location for the error.
|
|
||||||
error.location = [[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject];
|
|
||||||
} else {
|
} else {
|
||||||
// Couldn't initialize view controller, serious error.
|
// Couldn't initialize view controller, serious error.
|
||||||
error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeInitViewController domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
|
error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeInitViewController domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
|
||||||
|
|||||||
@ -43,10 +43,6 @@ FOUNDATION_EXPORT const unsigned char MVMCoreVersionString[];
|
|||||||
#import <MVMCore/MVMCoreViewControllerProgrammaticMappingObject.h>
|
#import <MVMCore/MVMCoreViewControllerProgrammaticMappingObject.h>
|
||||||
#import <MVMCore/MVMCoreViewControllerStoryBoardMappingObject.h>
|
#import <MVMCore/MVMCoreViewControllerStoryBoardMappingObject.h>
|
||||||
|
|
||||||
// Main Structure
|
|
||||||
#import <MVMCore/MVMCoreMainSplitViewProtocol.h>
|
|
||||||
#import <MVMCore/PanelProtocol.h>
|
|
||||||
|
|
||||||
// Load Handling
|
// Load Handling
|
||||||
#import <MVMCore/MVMCoreLoadDelegateProtocol.h>
|
#import <MVMCore/MVMCoreLoadDelegateProtocol.h>
|
||||||
#import <MVMCore/MVMCoreRequestParameters.h>
|
#import <MVMCore/MVMCoreRequestParameters.h>
|
||||||
|
|||||||
@ -12,24 +12,10 @@
|
|||||||
|
|
||||||
@protocol MVMCoreViewControllerProtocol <NSObject>
|
@protocol MVMCoreViewControllerProtocol <NSObject>
|
||||||
|
|
||||||
// TODO: need to be moved out when core is completely finished
|
|
||||||
@property (nonatomic) BOOL masterShouldBeAccessible;
|
|
||||||
@property (nonatomic) BOOL supportShouldBeAccessible;
|
|
||||||
@property (nonatomic) BOOL cartShouldBeAccessible;
|
|
||||||
@property (nonatomic) BOOL communityShouldBeAccessible;
|
|
||||||
@property (nonatomic) BOOL closeButtonAccessible;
|
|
||||||
@property (nullable, nonatomic, readonly) NSDictionary *closeButtonActionMap;
|
|
||||||
|
|
||||||
|
|
||||||
@property (nullable, strong, nonatomic) NSString *pageType;
|
@property (nullable, strong, nonatomic) NSString *pageType;
|
||||||
|
|
||||||
// This view controller should subclass this function and check the load to make sure it has all the needed data. Fills the error object if there are any errors. Returns if we should finish the load or not. Ideally error should use code ErrorCodeViewControllerProcessingJSON.
|
// This view controller should subclass this function and check the load to make sure it has all the needed data. Fills the error object if there are any errors. Returns if we should finish the load or not. Ideally error should use code ErrorCodeViewControllerProcessingJSON.
|
||||||
- (BOOL)shouldFinishProcessingLoad:(nonnull MVMCoreLoadObject *)loadObject error:(MVMCoreErrorObject *_Nonnull *_Nonnull)error;
|
- (BOOL)shouldFinishProcessingLoad:(nonnull MVMCoreLoadObject *)loadObject error:(MVMCoreErrorObject *_Nonnull *_Nonnull)error;
|
||||||
|
|
||||||
@optional
|
|
||||||
|
|
||||||
// Called when the back button is pressed. Overwrite for special functionality. Default is to just popviewcontroller.
|
|
||||||
- (void)backButtonPressed;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
//
|
|
||||||
// MainSplitViewProtocol.h
|
|
||||||
// MVMCore
|
|
||||||
//
|
|
||||||
// Created by Pfeil, Scott Robert on 11/14/17.
|
|
||||||
// Copyright © 2017 myverizon. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <MVMCore/PanelProtocol.h>
|
|
||||||
#import <MVMCore/MVMCoreViewControllerProtocol.h>
|
|
||||||
|
|
||||||
@protocol MVMCoreMainSplitViewProtocol<NSObject>
|
|
||||||
|
|
||||||
// Provide the panels that you would like to use.
|
|
||||||
- (nullable UIViewController <MVMCoreViewControllerProtocol,PanelProtocol> *)getLeftPanel;
|
|
||||||
- (nullable UIViewController <MVMCoreViewControllerProtocol,PanelProtocol> *)getRightPanel;
|
|
||||||
|
|
||||||
@end
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
//
|
|
||||||
// PanelProtocol.h
|
|
||||||
// mobilefirst
|
|
||||||
//
|
|
||||||
// Created by Seshamani, Shreyas on 6/2/17.
|
|
||||||
// Copyright © 2017 Verizon Wireless. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <MVMCore/MVMCoreViewControllerProtocol.h>
|
|
||||||
@protocol PanelProtocol <NSObject>
|
|
||||||
|
|
||||||
#pragma mark - life cycle
|
|
||||||
|
|
||||||
@optional
|
|
||||||
|
|
||||||
// The panel can return if it should be available or not.
|
|
||||||
- (BOOL)panelAvailable;
|
|
||||||
|
|
||||||
- (void)panel:(UIViewController <MVMCoreViewControllerProtocol> *_Nullable)panel viewWillAppear:(BOOL)animated;
|
|
||||||
- (void)panel:(UIViewController <MVMCoreViewControllerProtocol> *_Nullable)panel viewDidAppear:(BOOL)animated;
|
|
||||||
- (void)panel:(UIViewController <MVMCoreViewControllerProtocol> *_Nullable)panel viewWillDisappear:(BOOL)animated;
|
|
||||||
- (void)panel:(UIViewController <MVMCoreViewControllerProtocol> *_Nullable)panel viewDidDisappear:(BOOL)animated;
|
|
||||||
|
|
||||||
- (void)showArrow;
|
|
||||||
- (void)hideArrow;
|
|
||||||
|
|
||||||
- (void)willOpenWithActionInformation:(nullable NSDictionary *)actionInformation;
|
|
||||||
|
|
||||||
- (void)clearData;
|
|
||||||
- (void)resetIconToDefault;
|
|
||||||
|
|
||||||
- (void)getCurrentDetailViewController:(nullable UIViewController *)currentViewController;//in menu
|
|
||||||
|
|
||||||
@end
|
|
||||||
@ -14,6 +14,7 @@
|
|||||||
#import "MVMCoreGetterUtility.h"
|
#import "MVMCoreGetterUtility.h"
|
||||||
#import "MVMCoreObject.h"
|
#import "MVMCoreObject.h"
|
||||||
#import "MVMCoreConstants.h"
|
#import "MVMCoreConstants.h"
|
||||||
|
#import "MVMCoreActionUtility.h"
|
||||||
|
|
||||||
@interface MVMCoreCache ()
|
@interface MVMCoreCache ()
|
||||||
|
|
||||||
@ -41,6 +42,7 @@
|
|||||||
static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
||||||
|
|
||||||
+ (nullable instancetype)sharedCache {
|
+ (nullable instancetype)sharedCache {
|
||||||
|
[MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].cache.class otherClass:self throwException:YES];
|
||||||
return [MVMCoreObject sharedInstance].cache;
|
return [MVMCoreObject sharedInstance].cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
@interface MVMCoreLoggingHandler : NSObject
|
@interface MVMCoreLoggingHandler : NSObject
|
||||||
|
|
||||||
|
+ (nullable instancetype)sharedLoggingHandler;
|
||||||
|
|
||||||
+ (void)addErrorToLog:(nonnull MVMCoreErrorObject *)errorObject;
|
+ (void)addErrorToLog:(nonnull MVMCoreErrorObject *)errorObject;
|
||||||
+ (void)logDebugMessageWithDelegate:(nullable NSString *)message;
|
+ (void)logDebugMessageWithDelegate:(nullable NSString *)message;
|
||||||
+ (void)logWithDelegateWithObject:(nullable id)object withName:(nullable NSString *)name withExtraInfo:(nullable NSDictionary *)extra;
|
+ (void)logWithDelegateWithObject:(nullable id)object withName:(nullable NSString *)name withExtraInfo:(nullable NSDictionary *)extra;
|
||||||
|
|||||||
@ -8,9 +8,18 @@
|
|||||||
|
|
||||||
#import "MVMCoreLoggingHandler.h"
|
#import "MVMCoreLoggingHandler.h"
|
||||||
#import "MVMCoreObject.h"
|
#import "MVMCoreObject.h"
|
||||||
|
#import "MVMCoreActionUtility.h"
|
||||||
|
|
||||||
@implementation MVMCoreLoggingHandler
|
@implementation MVMCoreLoggingHandler
|
||||||
|
|
||||||
|
+ (nullable instancetype)sharedLoggingHandler {
|
||||||
|
if ([MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].loggingDelegate.class otherClass:self throwException:NO]) {
|
||||||
|
return (MVMCoreLoggingHandler *)[MVMCoreObject sharedInstance].loggingDelegate;
|
||||||
|
} else {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+ (void)addErrorToLog:(nonnull MVMCoreErrorObject *)errorObject {
|
+ (void)addErrorToLog:(nonnull MVMCoreErrorObject *)errorObject {
|
||||||
if (errorObject && [[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(addErrorToLog:)]) {
|
if (errorObject && [[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(addErrorToLog:)]) {
|
||||||
[[MVMCoreObject sharedInstance].loggingDelegate addErrorToLog:errorObject];
|
[[MVMCoreObject sharedInstance].loggingDelegate addErrorToLog:errorObject];
|
||||||
|
|||||||
@ -8,10 +8,12 @@
|
|||||||
|
|
||||||
#import "MVMCoreSessionObject.h"
|
#import "MVMCoreSessionObject.h"
|
||||||
#import "MVMCoreObject.h"
|
#import "MVMCoreObject.h"
|
||||||
|
#import "MVMCoreActionUtility.h"
|
||||||
|
|
||||||
@implementation MVMCoreSessionObject
|
@implementation MVMCoreSessionObject
|
||||||
|
|
||||||
+ (nullable instancetype)sharedGlobal {
|
+ (nullable instancetype)sharedGlobal {
|
||||||
|
[MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].session.class otherClass:self throwException:YES];
|
||||||
return [MVMCoreObject sharedInstance].session;
|
return [MVMCoreObject sharedInstance].session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
#import "MVMCoreRequestParameters.h"
|
#import "MVMCoreRequestParameters.h"
|
||||||
#import "NSDictionary+MFConvenience.h"
|
#import "NSDictionary+MFConvenience.h"
|
||||||
#import "MVMCoreObject.h"
|
#import "MVMCoreObject.h"
|
||||||
|
#import "MVMCoreActionUtility.h"
|
||||||
|
|
||||||
@interface MVMCoreSessionTimeHandler ()
|
@interface MVMCoreSessionTimeHandler ()
|
||||||
|
|
||||||
@ -46,6 +47,7 @@
|
|||||||
@implementation MVMCoreSessionTimeHandler
|
@implementation MVMCoreSessionTimeHandler
|
||||||
|
|
||||||
+ (nullable instancetype)sharedSessionHandler {
|
+ (nullable instancetype)sharedSessionHandler {
|
||||||
|
[MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].sessionHandler.class otherClass:self throwException:YES];
|
||||||
return [MVMCoreObject sharedInstance].sessionHandler;
|
return [MVMCoreObject sharedInstance].sessionHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,9 +14,9 @@
|
|||||||
#import <MVMCore/MVMCoreSessionTimeHandler.h>
|
#import <MVMCore/MVMCoreSessionTimeHandler.h>
|
||||||
#import <MVMCore/MVMCoreGlobalLoadProtocol.h>
|
#import <MVMCore/MVMCoreGlobalLoadProtocol.h>
|
||||||
#import <MVMCore/MVMCoreLoadingOverlayDelegateProtocol.h>
|
#import <MVMCore/MVMCoreLoadingOverlayDelegateProtocol.h>
|
||||||
#import <MVMCore/MVMCoreMainSplitViewProtocol.h>
|
|
||||||
#import <MVMCore/MVMCoreLoggingDelegateProtocol.h>
|
#import <MVMCore/MVMCoreLoggingDelegateProtocol.h>
|
||||||
#import <MVMCore/MVMCoreGlobalTopAlertDelegateProtocol.h>
|
#import <MVMCore/MVMCoreGlobalTopAlertDelegateProtocol.h>
|
||||||
|
#import <MVMCore/MVMCoreLoggingHandler.h>
|
||||||
|
|
||||||
@interface MVMCoreObject : NSObject
|
@interface MVMCoreObject : NSObject
|
||||||
|
|
||||||
@ -27,10 +27,9 @@
|
|||||||
@property (nullable, strong, nonatomic) MVMCoreSessionTimeHandler *sessionHandler;
|
@property (nullable, strong, nonatomic) MVMCoreSessionTimeHandler *sessionHandler;
|
||||||
|
|
||||||
// The delegates
|
// The delegates
|
||||||
@property (nullable, weak, nonatomic) NSObject <MVMCoreMainSplitViewProtocol> *splitViewDelegate;
|
|
||||||
@property (nullable, weak, nonatomic) id <MVMCoreGlobalLoadProtocol> globalLoadDelegate;
|
@property (nullable, weak, nonatomic) id <MVMCoreGlobalLoadProtocol> globalLoadDelegate;
|
||||||
@property (nullable, weak, nonatomic) id <MVMCoreLoadingOverlayDelegateProtocol> loadingProtocol;
|
@property (nullable, weak, nonatomic) id <MVMCoreLoadingOverlayDelegateProtocol> loadingProtocol;
|
||||||
@property (nullable, weak, nonatomic) id <MVMCoreLoggingDelegateProtocol> loggingDelegate;
|
@property (nullable, weak, nonatomic) NSObject <MVMCoreLoggingDelegateProtocol> *loggingDelegate;
|
||||||
@property (nullable, weak, nonatomic) id <MVMCoreGlobalTopAlertDelegateProtocol> globalTopAlertDelegate;
|
@property (nullable, weak, nonatomic) id <MVMCoreGlobalTopAlertDelegateProtocol> globalTopAlertDelegate;
|
||||||
|
|
||||||
// A reference to the calling application delegate that should be set. For a normal app, could be the UIApplicationDelegate. For watch, could be WKExtensionDelegate. For iMessage, could be MSMessagesAppViewController. etc, etc. Useful for the framework to call delegate specific functions.
|
// A reference to the calling application delegate that should be set. For a normal app, could be the UIApplicationDelegate. For watch, could be WKExtensionDelegate. For iMessage, could be MSMessagesAppViewController. etc, etc. Useful for the framework to call delegate specific functions.
|
||||||
|
|||||||
@ -23,4 +23,7 @@
|
|||||||
// Can call to display a view controller based on the load object in the same way the architecture does it. Will check the presentation style of the page, action, and request. Will check if needs a view manager.
|
// Can call to display a view controller based on the load object in the same way the architecture does it. Will check the presentation style of the page, action, and request. Will check if needs a view manager.
|
||||||
+ (void)displayViewController:(nonnull UIViewController <MVMCoreViewControllerProtocol> *)viewController forLoadObject:(nullable MVMCoreLoadObject *)loadObject presentationDelegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock;
|
+ (void)displayViewController:(nonnull UIViewController <MVMCoreViewControllerProtocol> *)viewController forLoadObject:(nullable MVMCoreLoadObject *)loadObject presentationDelegate:(nullable NSObject<MVMCorePresentationDelegateProtocol>*)delegate completionHandler:(nullable void (^)(void))completionBlock;
|
||||||
|
|
||||||
|
// returns if the class is not the same or a subclass of the other class. Can pass throw an exception as well
|
||||||
|
+ (BOOL)classIsInstanceTypeOfClass:(Class)theClass otherClass:(Class)otherClass throwException:(BOOL)throwException;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -137,4 +137,14 @@
|
|||||||
[[MVMCoreNavigationHandler sharedNavigationHandler] navigateWithLoadObject:loadObject viewController:(viewControllerToLoad ?: viewController) delegate:delegate completionHandler:completionBlock];
|
[[MVMCoreNavigationHandler sharedNavigationHandler] navigateWithLoadObject:loadObject viewController:(viewControllerToLoad ?: viewController) delegate:delegate completionHandler:completionBlock];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (BOOL)classIsInstanceTypeOfClass:(Class)theClass otherClass:(Class)otherClass throwException:(BOOL)throwException {
|
||||||
|
if (theClass != otherClass && ![theClass isSubclassOfClass:otherClass]) {
|
||||||
|
if (throwException) {
|
||||||
|
@throw([NSException exceptionWithName:@"NotInstanceType" reason:[NSString stringWithFormat:@"%@ is not an instance of %@",theClass,otherClass] userInfo:nil]);
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -25,4 +25,7 @@
|
|||||||
// Returns a UIColor
|
// Returns a UIColor
|
||||||
+ (nonnull UIColor *)getColorForHexString:(nonnull NSString *)hexString;
|
+ (nonnull UIColor *)getColorForHexString:(nonnull NSString *)hexString;
|
||||||
|
|
||||||
|
// Returns if the device is an ipad
|
||||||
|
+ (BOOL)isOnIPad;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -50,4 +50,12 @@
|
|||||||
alpha:1];
|
alpha:1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (BOOL)isOnIPad {
|
||||||
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||||
|
return YES;
|
||||||
|
} else {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -5,31 +5,50 @@
|
|||||||
// Created by Scott Pfeil on 12/2/13.
|
// Created by Scott Pfeil on 12/2/13.
|
||||||
// Copyright (c) 2013 Verizon Wireless. All rights reserved.
|
// Copyright (c) 2013 Verizon Wireless. All rights reserved.
|
||||||
//
|
//
|
||||||
// Any given pageType will map to a view controller. This object tells if it is loaded from a story board with the id in viewControllerString. If wish to load from nib, leave storyBoard nil, and viewControllerString the nib name.
|
// Singleton for using template id string to create view controllers based on mapping objects. Any given templateID will map to a view controller.
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <MVMCore/MVMCoreViewControllerProtocol.h>
|
#import <MVMCore/MVMCoreViewControllerProtocol.h>
|
||||||
@class MVMCoreErrorObject;
|
@class MVMCoreErrorObject;
|
||||||
|
|
||||||
|
// Classes that use the protocol should be able to be added to the mapping and create a view controller when called upon.
|
||||||
|
@protocol MVMCoreViewControllerMappingProtocol <NSObject>
|
||||||
|
|
||||||
|
// Creates and returns an mvm view controller.
|
||||||
|
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createViewController;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface MVMCoreViewControllerMappingObject : NSObject
|
@interface MVMCoreViewControllerMappingObject : NSObject
|
||||||
|
|
||||||
@property (nullable, strong, nonatomic) NSMutableDictionary *viewControllerMapping;
|
// The template based mapping.
|
||||||
|
@property (nullable, strong, nonatomic) NSMutableDictionary <NSString *,NSObject <MVMCoreViewControllerMappingProtocol>*> *viewControllerMapping;
|
||||||
|
|
||||||
|
// The modules that the page can't survive without. Will throw an error if not all are found during loading.
|
||||||
@property (nullable, strong, nonatomic) NSMutableDictionary *requiredModuleMapping;
|
@property (nullable, strong, nonatomic) NSMutableDictionary *requiredModuleMapping;
|
||||||
|
|
||||||
|
// The modules that the page will ask for but may not get.
|
||||||
@property (nullable, strong, nonatomic) NSMutableDictionary *optionalModuleMapping;
|
@property (nullable, strong, nonatomic) NSMutableDictionary *optionalModuleMapping;
|
||||||
|
|
||||||
|
// Legacy: page type based mapping
|
||||||
|
@property (nullable, strong, nonatomic) NSMutableDictionary <NSString *,NSObject <MVMCoreViewControllerMappingProtocol>*> *pageTypeViewControllerMapping;
|
||||||
|
|
||||||
// Returns the shared instance
|
// Returns the shared instance
|
||||||
+ (nullable instancetype)sharedViewControllerMappingObject;
|
+ (nullable instancetype)sharedViewControllerMappingObject;
|
||||||
|
|
||||||
#pragma mark - View Controller Mapping
|
#pragma mark - View Controller Mapping
|
||||||
|
|
||||||
// Returns the mapping object which maps the given page type to how it's view controller is loaded.
|
// Returns the mapping object which maps the given template to how it's view controller is loaded.
|
||||||
- (nullable MVMCoreViewControllerMappingObject *)getViewControllerMappingForPageType:(nonnull NSString *)pageType;
|
- (nullable NSObject <MVMCoreViewControllerMappingProtocol>*)getViewControllerMappingForTemplate:(nonnull NSString *)templateID;
|
||||||
|
|
||||||
|
// Creates and returns an mvm view controller of the passed in template or page type using the mapping.
|
||||||
|
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createMFViewControllerOfTemplate:(nonnull NSString *)templateID;
|
||||||
|
|
||||||
// For pages external to the mobile first framework to be added to the view controller mapping.
|
// For pages external to the mobile first framework to be added to the view controller mapping.
|
||||||
- (void)addToViewControllerMapping:(nullable NSDictionary <NSString *,MVMCoreViewControllerMappingObject *>*)map;
|
- (void)addToTemplateViewControllerMapping:(nullable NSDictionary <NSString *,NSObject <MVMCoreViewControllerMappingProtocol>*>*)map;
|
||||||
|
|
||||||
// Creates and returns an mvm view controller of the passed in page type using the mapping.
|
// Transition function: A mix of new and legacy.
|
||||||
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createMFViewControllerOfPageType:(nonnull NSString *)pageType error:(MVMCoreErrorObject *_Nullable *_Nullable)error;
|
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createMFViewControllerOfTemplate:(nullable NSString *)templateID pageType:(nullable NSString *)pageType;
|
||||||
|
|
||||||
#pragma mark - Module PageType Mapping
|
#pragma mark - Module PageType Mapping
|
||||||
|
|
||||||
@ -51,4 +70,15 @@
|
|||||||
// Add optional modules for multiple pages. Used by external frameworks
|
// Add optional modules for multiple pages. Used by external frameworks
|
||||||
- (void)addOptionalModulesForPages:(nonnull NSDictionary<NSString*, NSArray<NSString*>*>*)optionalModulesForPages;
|
- (void)addOptionalModulesForPages:(nonnull NSDictionary<NSString*, NSArray<NSString*>*>*)optionalModulesForPages;
|
||||||
|
|
||||||
|
#pragma mark - Legacy PageType driven
|
||||||
|
|
||||||
|
// Returns the mapping object which maps the given page type to how it's view controller is loaded.
|
||||||
|
- (nullable NSObject <MVMCoreViewControllerMappingProtocol>*)getViewControllerMappingForPageType:(nonnull NSString *)pageType;
|
||||||
|
|
||||||
|
// For pages external to the mobile first framework to be added to the view controller mapping for pagetypes.
|
||||||
|
- (void)addToPageTypeViewControllerMapping:(nullable NSDictionary <NSString *,NSObject <MVMCoreViewControllerMappingProtocol>*>*)map;
|
||||||
|
|
||||||
|
// Creates and returns an mvm view controller of the passed in template or page type using the mapping.
|
||||||
|
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createMFViewControllerOfPageType:(nonnull NSString *)pageType;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
#import "MVMCoreErrorConstants.h"
|
#import "MVMCoreErrorConstants.h"
|
||||||
#import "MVMCoreHardcodedStringsConstants.h"
|
#import "MVMCoreHardcodedStringsConstants.h"
|
||||||
#import "MVMCoreObject.h"
|
#import "MVMCoreObject.h"
|
||||||
|
#import "MVMCoreActionUtility.h"
|
||||||
|
|
||||||
@interface MVMCoreViewControllerMappingObject ()
|
@interface MVMCoreViewControllerMappingObject ()
|
||||||
|
|
||||||
@ -26,62 +27,35 @@
|
|||||||
@implementation MVMCoreViewControllerMappingObject
|
@implementation MVMCoreViewControllerMappingObject
|
||||||
|
|
||||||
+ (nullable instancetype)sharedViewControllerMappingObject {
|
+ (nullable instancetype)sharedViewControllerMappingObject {
|
||||||
|
[MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].viewControllerMapping.class otherClass:self throwException:YES];
|
||||||
return [MVMCoreObject sharedInstance].viewControllerMapping;
|
return [MVMCoreObject sharedInstance].viewControllerMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - View Controller Mapping
|
#pragma mark - View Controller Mapping
|
||||||
|
|
||||||
- (nullable MVMCoreViewControllerMappingObject *)getViewControllerMappingForPageType:(nonnull NSString *)pageType {
|
- (nullable NSObject <MVMCoreViewControllerMappingProtocol>*)getViewControllerMappingForTemplate:(nonnull NSString *)templateID {
|
||||||
return [self.viewControllerMapping objectForKey:pageType];
|
return [self.viewControllerMapping objectForKey:templateID];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)addToViewControllerMapping:(nullable NSDictionary <NSString *,MVMCoreViewControllerMappingObject *>*)map {
|
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createMFViewControllerOfTemplate:(nonnull NSString *)templateID {
|
||||||
|
return [[self getViewControllerMappingForTemplate:templateID] createViewController];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)addToTemplateViewControllerMapping:(nullable NSDictionary <NSString *,NSObject <MVMCoreViewControllerMappingProtocol>*>*)map {
|
||||||
if (map) {
|
if (map) {
|
||||||
[self.viewControllerMapping addEntriesFromDictionary:map];
|
[self.viewControllerMapping addEntriesFromDictionary:map];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createMFViewControllerOfPageType:(nonnull NSString *)pageType error:(MVMCoreErrorObject *_Nullable *_Nullable)error {
|
// Transition function: A mix of new and legacy.
|
||||||
|
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createMFViewControllerOfTemplate:(nullable NSString *)templateID pageType:(nullable NSString *)pageType {
|
||||||
// Initialize the view controller using the pageType-ViewController mapping.
|
if (templateID) {
|
||||||
UIViewController <MVMCoreViewControllerProtocol> *viewController = nil;
|
return [self createMFViewControllerOfTemplate:templateID];
|
||||||
|
} else if (pageType) {
|
||||||
MVMCoreViewControllerMappingObject *mapping = [self getViewControllerMappingForPageType:pageType];
|
return [self createMFViewControllerOfPageType:pageType];
|
||||||
if ([mapping isKindOfClass:[MVMCoreViewControllerStoryBoardMappingObject class]]) {
|
|
||||||
|
|
||||||
// Initialize from story board.
|
|
||||||
NSString *storyboardName = ((MVMCoreViewControllerStoryBoardMappingObject *)mapping).storyBoard;
|
|
||||||
NSString *viewIdentifier = ((MVMCoreViewControllerStoryBoardMappingObject *)mapping).storyBoardIdentifier;
|
|
||||||
NSString *bundleName = ((MVMCoreViewControllerStoryBoardMappingObject *)mapping).bundleName;
|
|
||||||
if (storyboardName.length != 0 && viewIdentifier.length != 0 && bundleName) {
|
|
||||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle:[NSBundle bundleWithIdentifier:bundleName]];
|
|
||||||
viewController = (UIViewController <MVMCoreViewControllerProtocol> *)[storyboard instantiateViewControllerWithIdentifier:viewIdentifier];
|
|
||||||
} else if (error) {
|
|
||||||
|
|
||||||
NSInteger code = 0;
|
|
||||||
if (storyboardName.length == 0) {
|
|
||||||
code = ErrorCodeNoStoryboardName;
|
|
||||||
} else if (viewIdentifier.length == 0) {
|
|
||||||
code = ErrorCodeNoStoryBoardIdentifier;
|
|
||||||
}
|
|
||||||
*error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:code domain:ErrorDomainNative location:nil];
|
|
||||||
}
|
|
||||||
} else if ([mapping isKindOfClass:[MVMCoreViewControllerNibMappingObject class]]) {
|
|
||||||
|
|
||||||
// Initialize from nib
|
|
||||||
NSString *viewControllerNibName = ((MVMCoreViewControllerNibMappingObject *)mapping).nibName;
|
|
||||||
NSString *bundleName = ((MVMCoreViewControllerStoryBoardMappingObject *)mapping).bundleName;
|
|
||||||
if (viewControllerNibName.length != 0) {
|
|
||||||
viewController = [[((MVMCoreViewControllerNibMappingObject *)mapping).viewControllerClass alloc] initWithNibName:viewControllerNibName bundle:[NSBundle bundleWithIdentifier:bundleName]];
|
|
||||||
} else if (error) {
|
|
||||||
*error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeNoNibName domain:ErrorDomainNative location:nil];
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Initialize programmatically.
|
return nil;
|
||||||
viewController = [[((MVMCoreViewControllerProgrammaticMappingObject *)mapping).viewControllerClass alloc] init];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return viewController;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Module PageType Mapping
|
#pragma mark - Module PageType Mapping
|
||||||
@ -128,5 +102,21 @@
|
|||||||
[self.optionalModuleMapping addEntriesFromDictionary:optionalModulesForPages];
|
[self.optionalModuleMapping addEntriesFromDictionary:optionalModulesForPages];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Legacy PageType driven
|
||||||
|
|
||||||
|
- (nullable NSObject <MVMCoreViewControllerMappingProtocol>*)getViewControllerMappingForPageType:(nonnull NSString *)pageType {
|
||||||
|
return [self.pageTypeViewControllerMapping objectForKey:pageType];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)addToPageTypeViewControllerMapping:(nullable NSDictionary <NSString *,NSObject <MVMCoreViewControllerMappingProtocol>*>*)map {
|
||||||
|
if (map) {
|
||||||
|
[self.pageTypeViewControllerMapping addEntriesFromDictionary:map];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createMFViewControllerOfPageType:(nonnull NSString *)pageType {
|
||||||
|
return [[self getViewControllerMappingForPageType:pageType] createViewController];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#import <MVMCore/MVMCoreViewControllerMappingObject.h>
|
#import <MVMCore/MVMCoreViewControllerMappingObject.h>
|
||||||
|
|
||||||
@interface MVMCoreViewControllerNibMappingObject : MVMCoreViewControllerMappingObject
|
@interface MVMCoreViewControllerNibMappingObject : NSObject <MVMCoreViewControllerMappingProtocol>
|
||||||
|
|
||||||
// View Controller Class, for loading from a nib.
|
// View Controller Class, for loading from a nib.
|
||||||
@property (nonnull, strong, nonatomic) Class viewControllerClass;
|
@property (nonnull, strong, nonatomic) Class viewControllerClass;
|
||||||
|
|||||||
@ -21,4 +21,9 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createViewController {
|
||||||
|
// Initialize from nib
|
||||||
|
return [[self.viewControllerClass alloc] initWithNibName:self.nibName bundle:[NSBundle bundleWithIdentifier:self.bundleName]];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#import <MVMCore/MVMCoreViewControllerMappingObject.h>
|
#import <MVMCore/MVMCoreViewControllerMappingObject.h>
|
||||||
|
|
||||||
@interface MVMCoreViewControllerProgrammaticMappingObject : MVMCoreViewControllerMappingObject
|
@interface MVMCoreViewControllerProgrammaticMappingObject : NSObject <MVMCoreViewControllerMappingProtocol>
|
||||||
|
|
||||||
// View Controller Class, for loading by class.
|
// View Controller Class, for loading by class.
|
||||||
@property (nonnull, strong, nonatomic) Class viewControllerClass;
|
@property (nonnull, strong, nonatomic) Class viewControllerClass;
|
||||||
|
|||||||
@ -19,4 +19,8 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createViewController {
|
||||||
|
return [[self.viewControllerClass alloc] init];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#import <MVMCore/MVMCoreViewControllerMappingObject.h>
|
#import <MVMCore/MVMCoreViewControllerMappingObject.h>
|
||||||
|
|
||||||
@interface MVMCoreViewControllerStoryBoardMappingObject : MVMCoreViewControllerMappingObject
|
@interface MVMCoreViewControllerStoryBoardMappingObject : NSObject <MVMCoreViewControllerMappingProtocol>
|
||||||
|
|
||||||
// Initializes with a story board load.
|
// Initializes with a story board load.
|
||||||
- (nullable id)initWithStoryBoard:(nonnull NSString *)storyBoard storyBoardIdentifier:(nonnull NSString *)storyBoardIdentifier bundleName:(nonnull NSString *)bundleName;
|
- (nullable id)initWithStoryBoard:(nonnull NSString *)storyBoard storyBoardIdentifier:(nonnull NSString *)storyBoardIdentifier bundleName:(nonnull NSString *)bundleName;
|
||||||
|
|||||||
@ -21,4 +21,10 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (nullable UIViewController <MVMCoreViewControllerProtocol> *)createViewController {
|
||||||
|
// Initialize from story board.
|
||||||
|
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:self.storyBoard bundle:[NSBundle bundleWithIdentifier:self.bundleName]];
|
||||||
|
return [storyboard instantiateViewControllerWithIdentifier:self.storyBoardIdentifier];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user