diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index 5a64495..a524c2a 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -946,11 +946,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/MVMCore/EmbeddedLibaries/AdobeMobileLibrary", - "$(PROJECT_DIR)/MVMCore/EmbeddedLibraries/VZAnalytics", - ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCore; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -975,11 +971,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/MVMCore/EmbeddedLibaries/AdobeMobileLibrary", - "$(PROJECT_DIR)/MVMCore/EmbeddedLibraries/VZAnalytics", - ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCore; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index bcce52f..4e95c40 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -36,7 +36,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; @implementation MVMCoreActionHandler + (nullable instancetype)sharedActionHandler { - [MVMCoreActionUtility verifyClassIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].actionHandler.class otherClass:self]; + [MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].actionHandler.class otherClass:self throwException:YES]; return [MVMCoreObject sharedInstance].actionHandler; } diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m index bb97de5..116c352 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m @@ -42,7 +42,7 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt"; + (nullable instancetype)sharedCache { - [MVMCoreActionUtility verifyClassIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].cache.class otherClass:self]; + [MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].cache.class otherClass:self throwException:YES]; return [MVMCoreObject sharedInstance].cache; } diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m index 98fa3ac..82ad77a 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m @@ -13,8 +13,11 @@ @implementation MVMCoreLoggingHandler + (nullable instancetype)sharedLoggingHandler { - [MVMCoreActionUtility verifyClassIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].loggingDelegate.class otherClass:self]; - return [MVMCoreObject sharedInstance].loggingDelegate; + if ([MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].loggingDelegate.class otherClass:self throwException:NO]) { + return (MVMCoreLoggingHandler *)[MVMCoreObject sharedInstance].loggingDelegate; + } else { + return nil; + } } + (void)addErrorToLog:(nonnull MVMCoreErrorObject *)errorObject { diff --git a/MVMCore/MVMCore/Session/MVMCoreSessionObject.m b/MVMCore/MVMCore/Session/MVMCoreSessionObject.m index 4855ef1..5deb1e4 100644 --- a/MVMCore/MVMCore/Session/MVMCoreSessionObject.m +++ b/MVMCore/MVMCore/Session/MVMCoreSessionObject.m @@ -13,7 +13,7 @@ @implementation MVMCoreSessionObject + (nullable instancetype)sharedGlobal { - [MVMCoreActionUtility verifyClassIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].session.class otherClass:self]; + [MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].session.class otherClass:self throwException:YES]; return [MVMCoreObject sharedInstance].session; } diff --git a/MVMCore/MVMCore/Session/MVMCoreSessionTimeHandler.m b/MVMCore/MVMCore/Session/MVMCoreSessionTimeHandler.m index b5ab3ea..a18113f 100644 --- a/MVMCore/MVMCore/Session/MVMCoreSessionTimeHandler.m +++ b/MVMCore/MVMCore/Session/MVMCoreSessionTimeHandler.m @@ -47,7 +47,7 @@ @implementation MVMCoreSessionTimeHandler + (nullable instancetype)sharedSessionHandler { - [MVMCoreActionUtility verifyClassIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].sessionHandler.class otherClass:self]; + [MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].sessionHandler.class otherClass:self throwException:YES]; return [MVMCoreObject sharedInstance].sessionHandler; } diff --git a/MVMCore/MVMCore/Singletons/MVMCoreObject.h b/MVMCore/MVMCore/Singletons/MVMCoreObject.h index ac5d1f8..ebdf435 100644 --- a/MVMCore/MVMCore/Singletons/MVMCoreObject.h +++ b/MVMCore/MVMCore/Singletons/MVMCoreObject.h @@ -29,7 +29,7 @@ // The delegates @property (nullable, weak, nonatomic) id globalLoadDelegate; @property (nullable, weak, nonatomic) id loadingProtocol; -@property (nullable, weak, nonatomic) MVMCoreLoggingHandler *loggingDelegate; +@property (nullable, weak, nonatomic) NSObject *loggingDelegate; @property (nullable, weak, nonatomic) id 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. diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h index b66375f..76f1d8e 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h @@ -23,7 +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. + (void)displayViewController:(nonnull UIViewController *)viewController forLoadObject:(nullable MVMCoreLoadObject *)loadObject presentationDelegate:(nullable NSObject*)delegate completionHandler:(nullable void (^)(void))completionBlock; -// Throws an error if the class is not the same or a subclass of the other class. -+ (void)verifyClassIsInstanceTypeOfClass:(Class)theClass otherClass:(Class)otherClass; +// 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 diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m index a05717c..f350b6c 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m @@ -137,10 +137,14 @@ [[MVMCoreNavigationHandler sharedNavigationHandler] navigateWithLoadObject:loadObject viewController:(viewControllerToLoad ?: viewController) delegate:delegate completionHandler:completionBlock]; } -+ (void)verifyClassIsInstanceTypeOfClass:(Class)theClass otherClass:(Class)otherClass { ++ (BOOL)classIsInstanceTypeOfClass:(Class)theClass otherClass:(Class)otherClass throwException:(BOOL)throwException { if (theClass != otherClass && ![theClass isSubclassOfClass:otherClass]) { - @throw([NSException exceptionWithName:@"NotInstanceType" reason:[NSString stringWithFormat:@"%@ is not an instance of %@",theClass,otherClass] userInfo:nil]); + if (throwException) { + @throw([NSException exceptionWithName:@"NotInstanceType" reason:[NSString stringWithFormat:@"%@ is not an instance of %@",theClass,otherClass] userInfo:nil]); + } + return NO; } + return YES; } @end diff --git a/MVMCore/MVMCore/ViewControllerMapping/MVMCoreViewControllerMappingObject.m b/MVMCore/MVMCore/ViewControllerMapping/MVMCoreViewControllerMappingObject.m index bc839fc..d39193e 100644 --- a/MVMCore/MVMCore/ViewControllerMapping/MVMCoreViewControllerMappingObject.m +++ b/MVMCore/MVMCore/ViewControllerMapping/MVMCoreViewControllerMappingObject.m @@ -27,7 +27,7 @@ @implementation MVMCoreViewControllerMappingObject + (nullable instancetype)sharedViewControllerMappingObject { - [MVMCoreActionUtility verifyClassIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].viewControllerMapping.class otherClass:self]; + [MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].viewControllerMapping.class otherClass:self throwException:YES]; return [MVMCoreObject sharedInstance].viewControllerMapping; }