From 0423937e8c8fac7c86a09dae2d14cc1ea056088e Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Wed, 3 Oct 2018 15:25:25 -0400 Subject: [PATCH 01/26] customTimeoutTime --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m | 2 +- MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m index a3b244e..583fa2e 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m @@ -151,7 +151,7 @@ } NSTimeInterval timeOutInterval = 60; - if (requestParameters.customTimeoutTime) { + if (requestParameters.customTimeoutTime && requestParameters.customTimeoutTime.integerValue > TimeOutTimeProd) { timeOutInterval = requestParameters.customTimeoutTime.floatValue; } else if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(timeOutIntervalForRequest:)]) { timeOutInterval = [[MVMCoreObject sharedInstance].globalLoadDelegate timeOutIntervalForRequest:requestParameters]; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m b/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m index 8524bf3..e9a3ad3 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m @@ -67,6 +67,7 @@ if (self = [self initWithPageType:[actionMap stringForKey:KeyPageType] additionalModules:[actionMap array:KeyModuleList] extraParameters:[actionMap dict:KeyExtraParameters]]) { self.contextRoot = [actionMap string:KeyContextRoot]; self.actionMap = actionMap; + self.customTimeoutTime = @([actionMap integer:@"customTimeoutTime"]); self.openSupportPanel = [actionMap boolForKey:KeyOpenSupport]; // Right now server is sending default.... can't uncomment this until they remove default @@ -132,6 +133,7 @@ copyObject.alternateBaseURL = self.alternateBaseURL; copyObject.openSupportPanel = self.openSupportPanel; copyObject.imageData = self.imageData; + copyObject.customTimeoutTime = self.customTimeoutTime; return copyObject; } From b802ef630dd69c458f19f3929f6be9c45cc50bbe Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Wed, 3 Oct 2018 15:31:27 -0400 Subject: [PATCH 02/26] customTimeoutTime --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m index 583fa2e..d095485 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m @@ -151,7 +151,7 @@ } NSTimeInterval timeOutInterval = 60; - if (requestParameters.customTimeoutTime && requestParameters.customTimeoutTime.integerValue > TimeOutTimeProd) { + if (requestParameters.customTimeoutTime && requestParameters.customTimeoutTime.integerValue > 30.0) { timeOutInterval = requestParameters.customTimeoutTime.floatValue; } else if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(timeOutIntervalForRequest:)]) { timeOutInterval = [[MVMCoreObject sharedInstance].globalLoadDelegate timeOutIntervalForRequest:requestParameters]; From 4c506b5b593d0b6c4344ee9a791d82b07e90c87c Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Wed, 3 Oct 2018 17:47:42 -0400 Subject: [PATCH 03/26] buttonMap --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h | 3 +++ MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m | 2 ++ 2 files changed, 5 insertions(+) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h index 014e4ba..51848dd 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h @@ -23,6 +23,9 @@ // The data for hte page that was loaded @property (nullable, strong, nonatomic) NSDictionary *pageJSON; +// Contains the button map +@property (nullable, nonatomic, strong) NSDictionary *buttonMap; + // the modules that are needed @property (nullable, strong, nonatomic) NSDictionary *modulesJSON; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m index 388f911..e9127c2 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m @@ -18,6 +18,8 @@ if (self = [self initWithRequestParameters:requestParameters dataForPage:dataForPage delegate:delegate]) { self.pageJSON = pageJSON; self.modulesJSON = modulesJSON; + + self.buttonMap = [pageJSON dictionaryForKey:@"ButtonMap"]; } return self; } From 35da51bc7497172ebfd2560ca7008eabc96a2bf6 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Sat, 6 Oct 2018 15:05:37 -0400 Subject: [PATCH 04/26] button map --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m index e9127c2..6b98642 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m @@ -19,11 +19,15 @@ self.pageJSON = pageJSON; self.modulesJSON = modulesJSON; - self.buttonMap = [pageJSON dictionaryForKey:@"ButtonMap"]; + //self.buttonMap = [pageJSON dictionaryForKey:@"ButtonMap"]; } return self; } +- (NSDictionary *) buttonMap { + return [self.pageJSON dictionaryForKey:@"ButtonMap"]; +} + - (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject*)delegate { if (self = [self initWithDelegate:delegate]) { self.requestParameters = requestParameters; From 41a454440eaa45234e74aef3ee3edd7b1c82b58c Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 11 Oct 2018 16:23:16 -0400 Subject: [PATCH 05/26] changes to the custom time and button map removal --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m | 2 +- MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h | 3 --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m | 6 ------ MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m | 2 +- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m index d095485..a3b244e 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m @@ -151,7 +151,7 @@ } NSTimeInterval timeOutInterval = 60; - if (requestParameters.customTimeoutTime && requestParameters.customTimeoutTime.integerValue > 30.0) { + if (requestParameters.customTimeoutTime) { timeOutInterval = requestParameters.customTimeoutTime.floatValue; } else if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(timeOutIntervalForRequest:)]) { timeOutInterval = [[MVMCoreObject sharedInstance].globalLoadDelegate timeOutIntervalForRequest:requestParameters]; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h index 51848dd..014e4ba 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h @@ -23,9 +23,6 @@ // The data for hte page that was loaded @property (nullable, strong, nonatomic) NSDictionary *pageJSON; -// Contains the button map -@property (nullable, nonatomic, strong) NSDictionary *buttonMap; - // the modules that are needed @property (nullable, strong, nonatomic) NSDictionary *modulesJSON; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m index 6b98642..388f911 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m @@ -18,16 +18,10 @@ if (self = [self initWithRequestParameters:requestParameters dataForPage:dataForPage delegate:delegate]) { self.pageJSON = pageJSON; self.modulesJSON = modulesJSON; - - //self.buttonMap = [pageJSON dictionaryForKey:@"ButtonMap"]; } return self; } -- (NSDictionary *) buttonMap { - return [self.pageJSON dictionaryForKey:@"ButtonMap"]; -} - - (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject*)delegate { if (self = [self initWithDelegate:delegate]) { self.requestParameters = requestParameters; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m b/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m index e9a3ad3..b72132a 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m @@ -67,7 +67,7 @@ if (self = [self initWithPageType:[actionMap stringForKey:KeyPageType] additionalModules:[actionMap array:KeyModuleList] extraParameters:[actionMap dict:KeyExtraParameters]]) { self.contextRoot = [actionMap string:KeyContextRoot]; self.actionMap = actionMap; - self.customTimeoutTime = @([actionMap integer:@"customTimeoutTime"]); + self.customTimeoutTime = [actionMap objectForKey:@"customTimeoutTime" ofType:[NSNumber class]]; self.openSupportPanel = [actionMap boolForKey:KeyOpenSupport]; // Right now server is sending default.... can't uncomment this until they remove default From adda2f461b8577b701298fe2b4879554c8269989 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Sun, 14 Oct 2018 23:57:41 -0400 Subject: [PATCH 06/26] button map read only property --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h | 3 +++ MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h index 014e4ba..6699e27 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.h @@ -23,6 +23,9 @@ // The data for hte page that was loaded @property (nullable, strong, nonatomic) NSDictionary *pageJSON; +// Contains the button map +@property (nullable, nonatomic, strong, readonly) NSDictionary *buttonMap; + // the modules that are needed @property (nullable, strong, nonatomic) NSDictionary *modulesJSON; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m index 388f911..f48bdf5 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m @@ -22,6 +22,10 @@ return self; } +- (NSDictionary *) buttonMap { + return [self.pageJSON dictionaryForKey:@"ButtonMap"]; +} + - (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject*)delegate { if (self = [self initWithDelegate:delegate]) { self.requestParameters = requestParameters; From e0a704ec517fcbfabdc395077941030d780f1faa Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Thu, 25 Oct 2018 16:50:06 -0400 Subject: [PATCH 07/26] adobe track alert --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h | 2 ++ MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m | 2 ++ MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m | 6 ++++-- MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h | 1 + MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m | 3 ++- .../MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h | 2 ++ MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h | 1 + MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m | 6 ++++++ 8 files changed, 20 insertions(+), 3 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h index 977911f..7d7aa25 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h @@ -12,5 +12,7 @@ @interface MVMCoreAlertController : UIAlertController @property (nonatomic, readonly, getter=isVisible) BOOL visible; +@property (nullable, nonatomic, copy) NSString *alertPageType; +@property (nullable, nonatomic, weak) id delegate; @end diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m index 89352a4..3a67b54 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m @@ -7,6 +7,7 @@ // #import "MVMCoreAlertController.h" +#import "MVMCoreLoggingHandler.h" @interface MVMCoreAlertController () @@ -22,6 +23,7 @@ [self willChangeValueForKey:@"isVisible"]; self.visible = YES; [self didChangeValueForKey:@"isVisible"]; + [MVMCoreLoggingHandler logAlertForAlertPageType:self.alertPageType delegate:self.delegate]; } - (void)viewDidDisappear:(BOOL)animated { diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m index bbbda62..2be088e 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m @@ -80,7 +80,7 @@ return [self showAlertWithTitle:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate]; } -- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message pageType:(nullable NSString *)pageType actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { // It's a greedy alert! Clear all alerts that are queued up and the one that is showing if (isGreedy) { @@ -89,6 +89,8 @@ // Create the alert. Adds the actions one by one. MVMCoreAlertController *alertController = [MVMCoreAlertController alertControllerWithTitle:(title ?: @"") message:message preferredStyle:alertStyle]; + alertController.alertPageType = pageType; + alertController.delegate = alertDelegate; for (NSUInteger i = 0; i < [actions count]; i++) { UIAlertAction *action = [actions objectAtIndex:i ofType:[UIAlertAction class]]; if (action) { @@ -102,7 +104,7 @@ } - (nonnull UIAlertController *)showAlertWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject { - return [self showAlertWithTitle:alertObject.title message:alertObject.message actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; + return [self showAlertWithTitle:alertObject.title message:alertObject.message pageType:alertObject.pageType actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; } - (void)removeAllAlertViews { diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h index 4b9d12c..b730e60 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h @@ -29,6 +29,7 @@ typedef void (^TextFieldErrorHandler)(NSArray * _Nonnull fieldErrors); @property (nullable, strong, nonatomic) NSString *title; @property (nullable, strong, nonatomic) NSString *message; +@property (nullable, strong, nonatomic) NSString *pageType; @property (nonnull, strong, nonatomic) NSArray *actions; @property (nonatomic) BOOL isGreedy; @property (nonatomic) UIAlertControllerStyle alertStyle; diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m index 5599049..424616b 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m @@ -71,7 +71,6 @@ // Perform a popup. alert.type = MFAlertTypePopup; alert.alertStyle = UIAlertControllerStyleAlert; - // Check if we have a popup driven by page object (otherwise by default it will just use response info title message with an OK button). NSString *pageTypeForPopup = [responseInfo stringForKey:@"popupPageType"]; [[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForPopup queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) { @@ -88,6 +87,8 @@ alert = popupAlert; } }]; + alert.pageType = pageTypeForPopup; + alert.alertDelegate = actionDelegate; } else if (messageStyle.length == 0 && pageType) { // No message style! diff --git a/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h b/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h index fc0e353..476c497 100644 --- a/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h +++ b/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h @@ -24,4 +24,6 @@ // Log that the load has finished. - (void)logLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController *)loadedViewController error:(nullable MVMCoreErrorObject *)error; +// Log alert +- (void)logAlertForAlertPageType:(nullable NSString *)pageType delegate:(nullable id)delegate; @end diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h index 48700ec..e15d1f2 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h @@ -20,5 +20,6 @@ + (void)logDebugMessageWithDelegate:(nullable NSString *)message; + (void)logWithDelegateWithObject:(nullable id)object withName:(nullable NSString *)name withExtraInfo:(nullable NSDictionary *)extra; + (void)logWithDelegateLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController *)loadedViewController error:(nullable MVMCoreErrorObject *)error; ++ (void)logAlertForAlertPageType:(nullable NSString *)pageType delegate:(_Nullable id)delegate; @end diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m index 3c1daf8..b2026da 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m @@ -35,5 +35,11 @@ } } ++ (void)logAlertForAlertPageType:(nullable NSString *)pageType delegate:(_Nullable id)delegate { + if ([[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(logAlertForAlertPageType:delegate:)]) { + [[MVMCoreObject sharedInstance].loggingDelegate logAlertForAlertPageType:pageType delegate:delegate]; + } +} + @end From d12df0b7538042d1e6080b743f0aa74c9e8107fa Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Sat, 27 Oct 2018 17:29:05 -0400 Subject: [PATCH 08/26] fix warning --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h | 3 ++- MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h index 9e80bb0..4ed194f 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h @@ -40,13 +40,14 @@ /** Shows the alert. * @param title The title of the alert. * @param message The message of the alert. + * @param pageType The page type used for tracking. * @param actions An array of actions for the alert. * @param alertStyle Popup or action sheet * @param isGreedy Sets up a greedy alert. In other words, any alerts currently shown or queued are dismissed. * @param alertDelegate The delegate to be notified. * @return Returns the UIAlertController. */ -- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate; +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message pageType:(nullable NSString *)pageType actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate; /** Shows the popup with the passed in alert object. This is a convenience method that automatically handles using the proper alert type based on what's available. * @param alertObject The alert object to use for the alert. diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m index 2be088e..0fb3b64 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m @@ -77,7 +77,7 @@ } - (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { - return [self showAlertWithTitle:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate]; + return [self showAlertWithTitle:title message:message pageType:nil actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate]; } - (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message pageType:(nullable NSString *)pageType actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { From 636417b31753028d9b238b1c3f7228015dbb345f Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 30 Oct 2018 12:21:28 -0400 Subject: [PATCH 09/26] alert handler takes alert object --- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m | 2 +- .../MVMCore/AlertHandling/MVMCoreAlertController.h | 2 ++ .../MVMCore/AlertHandling/MVMCoreAlertController.m | 2 ++ MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h | 6 ++++-- MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m | 11 ++++++----- MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h | 1 + MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m | 1 + 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index e6932bf..94211c8 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -219,7 +219,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; NSDictionary *responseInfo = [jsonDictionary dict:KeyResponseInfo]; if (responseInfo) { MVMCoreAlertObject *alertObject = [MVMCoreAlertObject alertObjectForPageType:pageTypeForTopAlert responseInfo:responseInfo additionalData:additionalData actionDelegate:delegate]; - if ([delegate respondsToSelector:@selector(willShowPopupWithAlertObject:alertJson:)]) { + if ([delegate respondsToSelector:@selector(willShowTopAlertWithAlertObject:alertJson:)]) { alertObject = [delegate willShowTopAlertWithAlertObject:alertObject alertJson:jsonDictionary]; } [alertObject showAlert]; diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h index 7d7aa25..23ff9ac 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h @@ -8,11 +8,13 @@ // Used by our alert handler. Not for subclassing. Simply keeps track of if it's visible. Tries to parallel the UIAlertView to make it easier for the MVMCoreAlertHandler. #import +@class MVMCoreAlertObject; @interface MVMCoreAlertController : UIAlertController @property (nonatomic, readonly, getter=isVisible) BOOL visible; @property (nullable, nonatomic, copy) NSString *alertPageType; +@property (nullable, nonatomic, strong) MVMCoreAlertObject *alertObject; @property (nullable, nonatomic, weak) id delegate; @end diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m index 3a67b54..d2a4986 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m @@ -8,11 +8,13 @@ #import "MVMCoreAlertController.h" #import "MVMCoreLoggingHandler.h" +#import "MVMCoreAlertObject.h" @interface MVMCoreAlertController () @property (nonatomic, readwrite, getter=isVisible) BOOL visible; + @end @implementation MVMCoreAlertController diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h index 9e80bb0..7247245 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h @@ -29,15 +29,17 @@ - (BOOL)greedyAlertShowing; /** Shows the popup with the passed in parameter. + * @param alertObject The origonal alertObject * @param title The title of the alert. * @param message The message of the alert. * @param actions An array of actions for the alert. * @param isGreedy Sets up a greedy popup. In other words, any popups currently shown or queued are dismissed. * @return Returns the UIAlertController. */ -- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy; +- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy; /** Shows the alert. + * @param alertObject The origonal alertObject * @param title The title of the alert. * @param message The message of the alert. * @param actions An array of actions for the alert. @@ -46,7 +48,7 @@ * @param alertDelegate The delegate to be notified. * @return Returns the UIAlertController. */ -- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate; +- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate; /** Shows the popup with the passed in alert object. This is a convenience method that automatically handles using the proper alert type based on what's available. * @param alertObject The alert object to use for the alert. diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m index 2be088e..a4de58c 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m @@ -72,15 +72,15 @@ return NO; } -- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy { +- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy { return [self showAlertWithTitle:title message:message actions:actions isGreedy:isGreedy alertDelegate:nil]; } -- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { +- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { return [self showAlertWithTitle:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate]; } -- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message pageType:(nullable NSString *)pageType actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { +- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { // It's a greedy alert! Clear all alerts that are queued up and the one that is showing if (isGreedy) { @@ -89,7 +89,8 @@ // Create the alert. Adds the actions one by one. MVMCoreAlertController *alertController = [MVMCoreAlertController alertControllerWithTitle:(title ?: @"") message:message preferredStyle:alertStyle]; - alertController.alertPageType = pageType; + alertController.alertObject = alertObject; + alertController.alertPageType = alertObject.pageType; alertController.delegate = alertDelegate; for (NSUInteger i = 0; i < [actions count]; i++) { UIAlertAction *action = [actions objectAtIndex:i ofType:[UIAlertAction class]]; @@ -104,7 +105,7 @@ } - (nonnull UIAlertController *)showAlertWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject { - return [self showAlertWithTitle:alertObject.title message:alertObject.message pageType:alertObject.pageType actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; + return [self showAlertWithAlertObject:alertObject title:alertObject.title message:alertObject.message pageType:alertObject.pageType actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; } - (void)removeAllAlertViews { diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h index b730e60..8edc6a2 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h @@ -28,6 +28,7 @@ typedef void (^TextFieldErrorHandler)(NSArray * _Nonnull fieldErrors); @interface MVMCoreAlertObject : NSObject @property (nullable, strong, nonatomic) NSString *title; +@property (nullable, copy, nonatomic) NSDictionary *pageJson; @property (nullable, strong, nonatomic) NSString *message; @property (nullable, strong, nonatomic) NSString *pageType; @property (nonnull, strong, nonatomic) NSArray *actions; diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m index 424616b..aa82631 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m @@ -146,6 +146,7 @@ MVMCoreAlertObject *alert = [[MVMCoreAlertObject alloc] init]; alert.title = [page stringForKey:KeyTitle]; + alert.pageJson = page; alert.message = [page stringForKey:KeyMessage]; alert.isGreedy = isGreedy; alert.type = MFAlertTypePopup; From c7e3364399dcc5a7e256252bac7c526b1481f885 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 30 Oct 2018 13:59:30 -0400 Subject: [PATCH 10/26] fixes --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m | 2 +- MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m | 6 +++--- .../MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h | 2 +- MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h | 2 +- MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m index d2a4986..55d2efa 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m @@ -25,7 +25,7 @@ [self willChangeValueForKey:@"isVisible"]; self.visible = YES; [self didChangeValueForKey:@"isVisible"]; - [MVMCoreLoggingHandler logAlertForAlertPageType:self.alertPageType delegate:self.delegate]; + [MVMCoreLoggingHandler logAlertForAlertObject:self.alertObject delegate:self.delegate]; } - (void)viewDidDisappear:(BOOL)animated { diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m index a4de58c..ad2acfe 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m @@ -73,11 +73,11 @@ } - (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy { - return [self showAlertWithTitle:title message:message actions:actions isGreedy:isGreedy alertDelegate:nil]; + return [self showAlertWithAlertObject:alertObject title:title message:message actions:actions isGreedy:isGreedy alertDelegate:nil]; } - (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { - return [self showAlertWithTitle:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate]; + return [self showAlertWithAlertObject:alertObject title:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate]; } - (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { @@ -105,7 +105,7 @@ } - (nonnull UIAlertController *)showAlertWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject { - return [self showAlertWithAlertObject:alertObject title:alertObject.title message:alertObject.message pageType:alertObject.pageType actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; + return [self showAlertWithAlertObject:alertObject title:alertObject.title message:alertObject.message actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; } - (void)removeAllAlertViews { diff --git a/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h b/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h index 476c497..43c0e0a 100644 --- a/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h +++ b/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h @@ -25,5 +25,5 @@ - (void)logLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController *)loadedViewController error:(nullable MVMCoreErrorObject *)error; // Log alert -- (void)logAlertForAlertPageType:(nullable NSString *)pageType delegate:(nullable id)delegate; ++ (void)logAlertForAlertObject:(nullable MVMCoreAlertObject *)alertObject delegate:(_Nullable id)delegate; @end diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h index e15d1f2..b20ef75 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h @@ -20,6 +20,6 @@ + (void)logDebugMessageWithDelegate:(nullable NSString *)message; + (void)logWithDelegateWithObject:(nullable id)object withName:(nullable NSString *)name withExtraInfo:(nullable NSDictionary *)extra; + (void)logWithDelegateLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController *)loadedViewController error:(nullable MVMCoreErrorObject *)error; -+ (void)logAlertForAlertPageType:(nullable NSString *)pageType delegate:(_Nullable id)delegate; ++ (void)logAlertForAlertObject:(nullable MVMCoreAlertObject *)alertObject delegate:(_Nullable id)delegate; @end diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m index b2026da..5df86d2 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m @@ -35,9 +35,9 @@ } } -+ (void)logAlertForAlertPageType:(nullable NSString *)pageType delegate:(_Nullable id)delegate { - if ([[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(logAlertForAlertPageType:delegate:)]) { - [[MVMCoreObject sharedInstance].loggingDelegate logAlertForAlertPageType:pageType delegate:delegate]; ++ (void)logAlertForAlertObject:(nullable MVMCoreAlertObject *)alertObject delegate:(_Nullable id)delegate { + if ([[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(logAlertForAlertObject:delegate:)]) { + [[MVMCoreObject sharedInstance].loggingDelegate logAlertForAlertObject:alertObject delegate:delegate]; } } From 05561e9cbf89cc95d1c9d166706db3a5ad7f9786 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 30 Oct 2018 14:25:06 -0400 Subject: [PATCH 11/26] remove alertPageType property --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h | 1 - MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m | 1 - 2 files changed, 2 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h index 23ff9ac..c3763d8 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h @@ -13,7 +13,6 @@ @interface MVMCoreAlertController : UIAlertController @property (nonatomic, readonly, getter=isVisible) BOOL visible; -@property (nullable, nonatomic, copy) NSString *alertPageType; @property (nullable, nonatomic, strong) MVMCoreAlertObject *alertObject; @property (nullable, nonatomic, weak) id delegate; diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m index ad2acfe..eabd816 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m @@ -90,7 +90,6 @@ // Create the alert. Adds the actions one by one. MVMCoreAlertController *alertController = [MVMCoreAlertController alertControllerWithTitle:(title ?: @"") message:message preferredStyle:alertStyle]; alertController.alertObject = alertObject; - alertController.alertPageType = alertObject.pageType; alertController.delegate = alertDelegate; for (NSUInteger i = 0; i < [actions count]; i++) { UIAlertAction *action = [actions objectAtIndex:i ofType:[UIAlertAction class]]; From 0105a5d45000c167a9d8435fde7a8dc988048aab Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 30 Oct 2018 14:25:53 -0400 Subject: [PATCH 12/26] remove pageType in document --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h index b60cb42..7247245 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h @@ -42,7 +42,6 @@ * @param alertObject The origonal alertObject * @param title The title of the alert. * @param message The message of the alert. - * @param pageType The page type used for tracking. * @param actions An array of actions for the alert. * @param alertStyle Popup or action sheet * @param isGreedy Sets up a greedy alert. In other words, any alerts currently shown or queued are dismissed. From c860e20258bd8aec6dc92e8f8144d568006d3e88 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 30 Oct 2018 14:29:11 -0400 Subject: [PATCH 13/26] lenient bool.... web view clean up --- MVMCore/MVMCore/Categories/NSDictionary+MFConvenience.h | 3 +++ MVMCore/MVMCore/Categories/NSDictionary+MFConvenience.m | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/MVMCore/MVMCore/Categories/NSDictionary+MFConvenience.h b/MVMCore/MVMCore/Categories/NSDictionary+MFConvenience.h index ed5931f..6ae8fc6 100644 --- a/MVMCore/MVMCore/Categories/NSDictionary+MFConvenience.h +++ b/MVMCore/MVMCore/Categories/NSDictionary+MFConvenience.h @@ -24,6 +24,9 @@ - (CGFloat)floatForKey:(nonnull id)key; - (double)doubleForKey:(nonnull id)key; +// Not strict, can accept either string or boolean. +- (BOOL)lenientBoolForKey:(nonnull id)key; + // Gets an object that is nested using a series of keys or indexes to reach it. // All keys should be of type NSString and is used for nested dictionaries. // All indexes should be of type NSNumber and is used for nested arrays. diff --git a/MVMCore/MVMCore/Categories/NSDictionary+MFConvenience.m b/MVMCore/MVMCore/Categories/NSDictionary+MFConvenience.m index 8de5180..f4e087d 100644 --- a/MVMCore/MVMCore/Categories/NSDictionary+MFConvenience.m +++ b/MVMCore/MVMCore/Categories/NSDictionary+MFConvenience.m @@ -32,6 +32,15 @@ return [[self objectForKey:key ofType:[NSNumber class]] boolValue]; } +- (BOOL)lenientBoolForKey:(nonnull id)key { + NSObject *object = [self objectForKey:key]; + if ([object isKindOfClass:[NSString class]]) { + return [((NSString *)object) isEqualToString:@"true"]; + } else { + return [((NSNumber *)([object isKindOfClass:[NSNumber class]] ? object : nil)) boolValue]; + } +} + - (CGFloat)floatForKey:(nonnull id)key { return [[self objectForKey:key ofType:[NSNumber class]] floatValue]; } From ea08526ce7331b29be7c3b371c47d4fd72d540cb Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 30 Oct 2018 16:11:28 -0400 Subject: [PATCH 14/26] revert and change slightly --- .../MVMCore/AlertHandling/MVMCoreAlertHandler.h | 6 ++---- .../MVMCore/AlertHandling/MVMCoreAlertHandler.m | 17 +++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h index 7247245..9e80bb0 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h @@ -29,17 +29,15 @@ - (BOOL)greedyAlertShowing; /** Shows the popup with the passed in parameter. - * @param alertObject The origonal alertObject * @param title The title of the alert. * @param message The message of the alert. * @param actions An array of actions for the alert. * @param isGreedy Sets up a greedy popup. In other words, any popups currently shown or queued are dismissed. * @return Returns the UIAlertController. */ -- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy; +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy; /** Shows the alert. - * @param alertObject The origonal alertObject * @param title The title of the alert. * @param message The message of the alert. * @param actions An array of actions for the alert. @@ -48,7 +46,7 @@ * @param alertDelegate The delegate to be notified. * @return Returns the UIAlertController. */ -- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate; +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate; /** Shows the popup with the passed in alert object. This is a convenience method that automatically handles using the proper alert type based on what's available. * @param alertObject The alert object to use for the alert. diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m index eabd816..ccc30ae 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m @@ -72,16 +72,16 @@ return NO; } -- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy { - return [self showAlertWithAlertObject:alertObject title:title message:message actions:actions isGreedy:isGreedy alertDelegate:nil]; +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy { + return [self showAlertWithTitle:title message:message actions:actions isGreedy:isGreedy alertDelegate:nil]; } -- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { - return [self showAlertWithAlertObject:alertObject title:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate]; +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { + return [self showAlertWithTitle:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate]; } -- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { - +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { + // It's a greedy alert! Clear all alerts that are queued up and the one that is showing if (isGreedy) { [self removeAllAlertViews]; @@ -89,7 +89,6 @@ // Create the alert. Adds the actions one by one. MVMCoreAlertController *alertController = [MVMCoreAlertController alertControllerWithTitle:(title ?: @"") message:message preferredStyle:alertStyle]; - alertController.alertObject = alertObject; alertController.delegate = alertDelegate; for (NSUInteger i = 0; i < [actions count]; i++) { UIAlertAction *action = [actions objectAtIndex:i ofType:[UIAlertAction class]]; @@ -104,7 +103,9 @@ } - (nonnull UIAlertController *)showAlertWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject { - return [self showAlertWithAlertObject:alertObject title:alertObject.title message:alertObject.message actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; + MVMCoreAlertController *controller = [self showAlertWithAlertObject:alertObject title:alertObject.title message:alertObject.message actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; + controller.alertObject = alertObject; + return controller; } - (void)removeAllAlertViews { From a0e08ad7e0e87af79b3bf2d01fcb757f82295a81 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 30 Oct 2018 16:21:14 -0400 Subject: [PATCH 15/26] revert --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m index ccc30ae..642b073 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m @@ -103,7 +103,7 @@ } - (nonnull UIAlertController *)showAlertWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject { - MVMCoreAlertController *controller = [self showAlertWithAlertObject:alertObject title:alertObject.title message:alertObject.message actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; + MVMCoreAlertController *controller = (MVMCoreAlertController *)[self showAlertWithTitle:alertObject.title message:alertObject.message actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; controller.alertObject = alertObject; return controller; } From cbe2ad2f57c156804c0a2eb8c37f18beec4af8ca Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 30 Oct 2018 16:35:50 -0400 Subject: [PATCH 16/26] remove space --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m index 55d2efa..d9ab5f9 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m @@ -14,7 +14,6 @@ @property (nonatomic, readwrite, getter=isVisible) BOOL visible; - @end @implementation MVMCoreAlertController From 71523fe67670cd6309777f8e5f1fb19473e638bf Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 30 Oct 2018 16:48:05 -0400 Subject: [PATCH 17/26] pass controller instead --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m | 2 +- .../MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h | 4 +++- MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h | 3 ++- MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m index d9ab5f9..684a382 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m @@ -24,7 +24,7 @@ [self willChangeValueForKey:@"isVisible"]; self.visible = YES; [self didChangeValueForKey:@"isVisible"]; - [MVMCoreLoggingHandler logAlertForAlertObject:self.alertObject delegate:self.delegate]; + [MVMCoreLoggingHandler logAlertForAlertController:self]; } - (void)viewDidDisappear:(BOOL)animated { diff --git a/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h b/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h index 43c0e0a..647c154 100644 --- a/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h +++ b/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h @@ -7,6 +7,7 @@ // #import +@class MVMCoreAlertController; @protocol MVMCoreLoggingDelegateProtocol @@ -25,5 +26,6 @@ - (void)logLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController *)loadedViewController error:(nullable MVMCoreErrorObject *)error; // Log alert -+ (void)logAlertForAlertObject:(nullable MVMCoreAlertObject *)alertObject delegate:(_Nullable id)delegate; ++ (void)logAlertForAlertController:(nullable MVMCoreAlertController *)alertController; + @end diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h index b20ef75..12d0e2a 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h @@ -10,6 +10,7 @@ #import #import #import +@class MVMCoreAlertController; #define MVMCoreLog(fmt, ...) \ [MVMCoreLoggingHandler logDebugMessageWithDelegate:[NSString stringWithFormat:(@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__]]; @@ -20,6 +21,6 @@ + (void)logDebugMessageWithDelegate:(nullable NSString *)message; + (void)logWithDelegateWithObject:(nullable id)object withName:(nullable NSString *)name withExtraInfo:(nullable NSDictionary *)extra; + (void)logWithDelegateLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController *)loadedViewController error:(nullable MVMCoreErrorObject *)error; -+ (void)logAlertForAlertObject:(nullable MVMCoreAlertObject *)alertObject delegate:(_Nullable id)delegate; ++ (void)logAlertForAlertController:(nullable MVMCoreAlertController *)alertController; @end diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m index 5df86d2..65e2659 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m @@ -35,9 +35,9 @@ } } -+ (void)logAlertForAlertObject:(nullable MVMCoreAlertObject *)alertObject delegate:(_Nullable id)delegate { - if ([[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(logAlertForAlertObject:delegate:)]) { - [[MVMCoreObject sharedInstance].loggingDelegate logAlertForAlertObject:alertObject delegate:delegate]; ++ (void)logAlertForAlertController:(nullable MVMCoreAlertController *)alertController { + if ([[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(logAlertForAlertController:)]) { + [[MVMCoreObject sharedInstance].loggingDelegate logAlertForAlertController:alertController]; } } From 3504a12e6110ecf1ffa2613a88123e9d6a4b09f5 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 30 Oct 2018 17:02:35 -0400 Subject: [PATCH 18/26] add tracking to alert protocol --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertDelegateProtocol.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertDelegateProtocol.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertDelegateProtocol.h index 2bd6a6b..f4f05e5 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertDelegateProtocol.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertDelegateProtocol.h @@ -8,11 +8,15 @@ // Called for popup style alerts. #import +@class MVMCoreAlertObject; @protocol MVMCoreAlertDelegateProtocol @optional +// helps tracking alert state +- (nullable NSDictionary *)additionalAlertDataToTrackForAlertWithObject:(nullable MVMCoreAlertObject *)alertObject; + // All are performed on the main thread. - (void)alertShown:(nonnull UIAlertController *)alertController; - (void)alertCancelled:(nonnull UIAlertController *)alertController; From cbcab0ea1c9fe4e07a9cfc423291fe2c01e2694f Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 30 Oct 2018 17:21:24 -0400 Subject: [PATCH 19/26] proper marking of delegate --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h index c3763d8..21ea9e6 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h @@ -8,12 +8,13 @@ // Used by our alert handler. Not for subclassing. Simply keeps track of if it's visible. Tries to parallel the UIAlertView to make it easier for the MVMCoreAlertHandler. #import +#import @class MVMCoreAlertObject; @interface MVMCoreAlertController : UIAlertController @property (nonatomic, readonly, getter=isVisible) BOOL visible; @property (nullable, nonatomic, strong) MVMCoreAlertObject *alertObject; -@property (nullable, nonatomic, weak) id delegate; +@property (nullable, nonatomic, weak) NSObject *delegate; @end From bffb93660d295c6a843d7486bc7d7daaa8107151 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 30 Oct 2018 17:32:59 -0400 Subject: [PATCH 20/26] changes to the way popup delegacy works --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h | 2 -- MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m | 1 - MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m | 3 +-- MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m | 4 ++-- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h index 21ea9e6..e38bedf 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.h @@ -8,13 +8,11 @@ // Used by our alert handler. Not for subclassing. Simply keeps track of if it's visible. Tries to parallel the UIAlertView to make it easier for the MVMCoreAlertHandler. #import -#import @class MVMCoreAlertObject; @interface MVMCoreAlertController : UIAlertController @property (nonatomic, readonly, getter=isVisible) BOOL visible; @property (nullable, nonatomic, strong) MVMCoreAlertObject *alertObject; -@property (nullable, nonatomic, weak) NSObject *delegate; @end diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m index 684a382..673c591 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertController.m @@ -8,7 +8,6 @@ #import "MVMCoreAlertController.h" #import "MVMCoreLoggingHandler.h" -#import "MVMCoreAlertObject.h" @interface MVMCoreAlertController () diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m index 642b073..5d5f93b 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m @@ -81,7 +81,7 @@ } - (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { - + // It's a greedy alert! Clear all alerts that are queued up and the one that is showing if (isGreedy) { [self removeAllAlertViews]; @@ -89,7 +89,6 @@ // Create the alert. Adds the actions one by one. MVMCoreAlertController *alertController = [MVMCoreAlertController alertControllerWithTitle:(title ?: @"") message:message preferredStyle:alertStyle]; - alertController.delegate = alertDelegate; for (NSUInteger i = 0; i < [actions count]; i++) { UIAlertAction *action = [actions objectAtIndex:i ofType:[UIAlertAction class]]; if (action) { diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m index aa82631..06cec60 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m @@ -50,6 +50,7 @@ __block MVMCoreAlertObject *alert = [[MVMCoreAlertObject alloc] init]; alert.title = [responseInfo stringForKey:KeyErrorHeading]; alert.message = [responseInfo stringForKey:KeyUserMessage]; + alert.alertDelegate = actionDelegate; NSString *messageStyle = [responseInfo stringForKey:KeyMessageStyle]; if ([ValueTypeFieldErrors isEqualToString:[responseInfo string:KeyType]]) { @@ -71,6 +72,7 @@ // Perform a popup. alert.type = MFAlertTypePopup; alert.alertStyle = UIAlertControllerStyleAlert; + // Check if we have a popup driven by page object (otherwise by default it will just use response info title message with an OK button). NSString *pageTypeForPopup = [responseInfo stringForKey:@"popupPageType"]; [[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForPopup queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) { @@ -87,8 +89,6 @@ alert = popupAlert; } }]; - alert.pageType = pageTypeForPopup; - alert.alertDelegate = actionDelegate; } else if (messageStyle.length == 0 && pageType) { // No message style! From d825927486c922c413a607097c122d1558dcfc1f Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 30 Oct 2018 17:34:46 -0400 Subject: [PATCH 21/26] remove unused page type --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h index 8edc6a2..9735c7c 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.h @@ -30,7 +30,6 @@ typedef void (^TextFieldErrorHandler)(NSArray * _Nonnull fieldErrors); @property (nullable, strong, nonatomic) NSString *title; @property (nullable, copy, nonatomic) NSDictionary *pageJson; @property (nullable, strong, nonatomic) NSString *message; -@property (nullable, strong, nonatomic) NSString *pageType; @property (nonnull, strong, nonatomic) NSArray *actions; @property (nonatomic) BOOL isGreedy; @property (nonatomic) UIAlertControllerStyle alertStyle; From fa4e23f330a366deccfae3e35f701b4eaff73726 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 30 Oct 2018 17:44:56 -0400 Subject: [PATCH 22/26] instance method in core logging delegate protocol --- MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h b/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h index 647c154..b8ae254 100644 --- a/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h +++ b/MVMCore/MVMCore/MainProtocols/MVMCoreLoggingDelegateProtocol.h @@ -26,6 +26,6 @@ - (void)logLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController *)loadedViewController error:(nullable MVMCoreErrorObject *)error; // Log alert -+ (void)logAlertForAlertController:(nullable MVMCoreAlertController *)alertController; +- (void)logAlertForAlertController:(nullable MVMCoreAlertController *)alertController; @end From b8374bee5ff7dcde3f29a09f63bd6d156d4ffdf1 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 30 Oct 2018 18:26:25 -0400 Subject: [PATCH 23/26] fix delegate nil --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m index 06cec60..0a5d8ca 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject.m @@ -50,7 +50,6 @@ __block MVMCoreAlertObject *alert = [[MVMCoreAlertObject alloc] init]; alert.title = [responseInfo stringForKey:KeyErrorHeading]; alert.message = [responseInfo stringForKey:KeyUserMessage]; - alert.alertDelegate = actionDelegate; NSString *messageStyle = [responseInfo stringForKey:KeyMessageStyle]; if ([ValueTypeFieldErrors isEqualToString:[responseInfo string:KeyType]]) { @@ -100,6 +99,7 @@ alert.alertStyle = UIAlertControllerStyleAlert; } } + alert.alertDelegate = actionDelegate; return alert; } From 8ea5b126e7e1a26eea4c812733871b44b847518a Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 31 Oct 2018 15:29:18 -0400 Subject: [PATCH 24/26] panel protocol available --- MVMCore/MVMCore/MainStructure/PanelProtocol.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MVMCore/MVMCore/MainStructure/PanelProtocol.h b/MVMCore/MVMCore/MainStructure/PanelProtocol.h index 5ab0ae3..2db89c7 100644 --- a/MVMCore/MVMCore/MainStructure/PanelProtocol.h +++ b/MVMCore/MVMCore/MainStructure/PanelProtocol.h @@ -14,6 +14,9 @@ @optional +// The panel can return if it should be available or not. +- (BOOL)panelAvailable; + - (void)panel:(UIViewController *_Nullable)panel viewWillAppear:(BOOL)animated; - (void)panel:(UIViewController *_Nullable)panel viewDidAppear:(BOOL)animated; - (void)panel:(UIViewController *_Nullable)panel viewWillDisappear:(BOOL)animated; From 44d10688ce147cd9526ff8a17dcce50343d5dc13 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 31 Oct 2018 15:49:58 -0400 Subject: [PATCH 25/26] clean load object change --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m index f48bdf5..30a2b19 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m @@ -22,8 +22,8 @@ return self; } -- (NSDictionary *) buttonMap { - return [self.pageJSON dictionaryForKey:@"ButtonMap"]; +- (NSDictionary *)buttonMap { + return [self.pageJSON dict:@"ButtonMap"]; } - (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject*)delegate { From 6bad0e1b344e9868e42560976688a10163ede817 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 31 Oct 2018 15:51:20 -0400 Subject: [PATCH 26/26] fix to use key --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m index 30a2b19..5c56b3a 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m @@ -23,7 +23,7 @@ } - (NSDictionary *)buttonMap { - return [self.pageJSON dict:@"ButtonMap"]; + return [self.pageJSON dict:KeyButtonMap]; } - (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegate:(nullable NSObject*)delegate {