From 87c037fb85988ce9997f155a80d068d91e942d09 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Tue, 26 Jun 2018 12:07:03 -0400 Subject: [PATCH 1/5] remove prefs --- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 86ea2d6..06f976b 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -232,12 +232,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; NSString *type = [actionInformation string:KeyPageType]; if ([@"location" isEqualToString:type] || [@"push" isEqualToString:type]) { [MVMCoreActionUtility linkAway:UIApplicationOpenSettingsURLString appURLString:nil]; - } else if ([@"airplaneMode" isEqualToString:type]) { - - // Stopped working in iOS 10. - [MVMCoreActionUtility linkAway:@"prefs:root=AIRPLANE_MODE" appURLString:nil]; - } else { - + } else { // No known settings type MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess] code:ErrorCodeInvalidSettingType domain:ErrorDomainNative location:[NSString stringWithFormat:@"%@_%@",NSStringFromClass([delegate class]),KeyActionTypeSettings]]; [self handleActionError:error actionInformation:actionInformation additionalData:additionalData delegate:delegate]; From d40f7fbb764394b8f1a7353c5ef9406b395cc072 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Fri, 6 Jul 2018 15:11:33 -0400 Subject: [PATCH 2/5] function to update request parameter before calling handle open page action --- .../ActionHandling/MVMCoreActionHandler.m | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 86ea2d6..982ea39 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -85,6 +85,11 @@ NSString * const KeyActionTypeOpen = @"openPage"; #pragma mark - Actions +- (void)updateRequestParametersBeforeHandleOpenPageAction:(MVMCoreRequestParameters *)requestParameters callBack:(void (^_Nonnull)(MVMCoreRequestParameters * _Nonnull requestParameters))callback { + //does not do anything by default, can be override + callback(requestParameters); +} + - (void)logAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate { if ([delegate respondsToSelector:@selector(logActionWithActionInformation:additionalData:)]) { [delegate logActionWithActionInformation:actionInformation additionalData:additionalData]; @@ -115,11 +120,14 @@ NSString * const KeyActionTypeOpen = @"openPage"; MVMCoreLog(@"Continuing operation after freebee request"); MVMCoreRequestParameters *requestParameters = [[MVMCoreRequestParameters alloc] initWithActionMap:actionInformation]; - if ([delegate respondsToSelector:@selector(handleOpenPageForRequestParameters:actionInformation:additionalData:)]) { - [delegate handleOpenPageForRequestParameters:requestParameters actionInformation:actionInformation additionalData:additionalData]; - } else { - [MVMCoreActionHandler defaultHandleOpenPageForRequestParameters:requestParameters additionalData:additionalData delegate:delegate]; - } + + [self updateRequestParametersBeforeHandleOpenPageAction:requestParameters callBack:^(MVMCoreRequestParameters * _Nonnull requestParameters) { + if ([delegate respondsToSelector:@selector(handleOpenPageForRequestParameters:actionInformation:additionalData:)]) { + [delegate handleOpenPageForRequestParameters:requestParameters actionInformation:actionInformation additionalData:additionalData]; + } else { + [MVMCoreActionHandler defaultHandleOpenPageForRequestParameters:requestParameters additionalData:additionalData delegate:delegate]; + } + }]; } else { // No page type to load, show error. @@ -168,15 +176,18 @@ NSString * const KeyActionTypeOpen = @"openPage"; - (void)previousSubmitAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate { // Perform the previous submission. + __weak typeof(self) weakSelf = self; if ([delegate respondsToSelector:@selector(prepareRequestForPreviousSubmission:additionalData:submit:)]) { [delegate prepareRequestForPreviousSubmission:actionInformation additionalData:additionalData submit:^(MVMCoreRequestParameters * _Nonnull requestParameters, NSDictionary * _Nullable dataForPage) { - // Give the delegate a chance to alter the request parameters - if ([delegate respondsToSelector:@selector(handleOpenPageForRequestParameters:actionInformation:additionalData:)]) { - [delegate handleOpenPageForRequestParameters:requestParameters actionInformation:actionInformation additionalData:dataForPage]; - } else { - [MVMCoreActionHandler defaultHandleOpenPageForRequestParameters:requestParameters additionalData:additionalData delegate:delegate]; - } + [weakSelf updateRequestParametersBeforeHandleOpenPageAction:requestParameters callBack:^(MVMCoreRequestParameters * _Nonnull requestParameters) { + // Give the delegate a chance to alter the request parameters + if ([delegate respondsToSelector:@selector(handleOpenPageForRequestParameters:actionInformation:additionalData:)]) { + [delegate handleOpenPageForRequestParameters:requestParameters actionInformation:actionInformation additionalData:dataForPage]; + } else { + [MVMCoreActionHandler defaultHandleOpenPageForRequestParameters:requestParameters additionalData:additionalData delegate:delegate]; + } + }]; }]; } } From 46261acb2369f3f5205cfd146726b303bff48d2b Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Fri, 6 Jul 2018 15:17:07 -0400 Subject: [PATCH 3/5] put method in h file --- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h | 1 + MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h index e3bfcbf..0396f16 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h @@ -29,6 +29,7 @@ extern NSString * _Nonnull const KeyActionTypeOpen; - (void)handleAction:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate; #pragma mark - Actions +- (void)updateRequestParametersBeforeHandleOpenPageAction:(nonnull MVMCoreRequestParameters *)requestParameters callBack:(void (^_Nonnull)(MVMCoreRequestParameters * _Nonnull requestParameters))callback; // Logs the action. Currently is not action information driven... depends on delegate. - (void)logAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate; diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 982ea39..c51718b 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -85,7 +85,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; #pragma mark - Actions -- (void)updateRequestParametersBeforeHandleOpenPageAction:(MVMCoreRequestParameters *)requestParameters callBack:(void (^_Nonnull)(MVMCoreRequestParameters * _Nonnull requestParameters))callback { +- (void)updateRequestParametersBeforeHandleOpenPageAction:(nonnull MVMCoreRequestParameters *)requestParameters callBack:(void (^_Nonnull)(MVMCoreRequestParameters * _Nonnull requestParameters))callback { //does not do anything by default, can be override callback(requestParameters); } From a8a1b483f38378bf1e6ed51eafe2c9a7d3970853 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Fri, 6 Jul 2018 15:30:18 -0400 Subject: [PATCH 4/5] comments --- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h index 0396f16..96c90da 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h @@ -29,6 +29,7 @@ extern NSString * _Nonnull const KeyActionTypeOpen; - (void)handleAction:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate; #pragma mark - Actions +// by defaul, returns the original RequestParameter that passed in. Can be overriden for some generic updates to the RequestParameter before handle open page action gets called. - (void)updateRequestParametersBeforeHandleOpenPageAction:(nonnull MVMCoreRequestParameters *)requestParameters callBack:(void (^_Nonnull)(MVMCoreRequestParameters * _Nonnull requestParameters))callback; // Logs the action. Currently is not action information driven... depends on delegate. From 4524dc15b1aa077c15ff220a7f2ae436fca81767 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 9 Jul 2018 10:43:27 -0400 Subject: [PATCH 5/5] typo --- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h index 96c90da..17f2327 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h @@ -29,7 +29,7 @@ extern NSString * _Nonnull const KeyActionTypeOpen; - (void)handleAction:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate; #pragma mark - Actions -// by defaul, returns the original RequestParameter that passed in. Can be overriden for some generic updates to the RequestParameter before handle open page action gets called. +// by default, returns the original RequestParameter that passed in. Can be overriden for some generic updates to the RequestParameter before handle open page action gets called. - (void)updateRequestParametersBeforeHandleOpenPageAction:(nonnull MVMCoreRequestParameters *)requestParameters callBack:(void (^_Nonnull)(MVMCoreRequestParameters * _Nonnull requestParameters))callback; // Logs the action. Currently is not action information driven... depends on delegate.