From b6e1e84b52a99ad7261063001cd467b902944517 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 21 Jan 2021 10:49:43 -0500 Subject: [PATCH 1/9] CXTDT-149032 --- .../ActionHandling/MVMCoreActionHandler.m | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 9362dd6..5095fc8 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -128,7 +128,12 @@ NSString * const KeyActionTypeOpen = @"openPage"; }]; }; - [self setClientParameterWith:actionInformation completionHandler:performAction]; + // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map + if ([actionInformation dict:@"clientParameters"]) { + [self setClientParameterWith:actionInformation completionHandler:performAction]; + } else { + performAction(actionInformation); + } } - (void)shareAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject { @@ -293,7 +298,12 @@ NSString * const KeyActionTypeOpen = @"openPage"; [weakSelf prepareLinkAwayWithURL:otherURL appURL:appURL actionInformation:actionMap additionalData:additionalData delegateObject:delegateObject]; }; - [self setClientParameterWith:actionInformation completionHandler:performAction]; + // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map + if ([actionInformation dict:@"clientParameters"]) { + [self setClientParameterWith:actionInformation completionHandler:performAction]; + } else { + performAction(actionInformation); + } } - (void)prepareLinkAwayWithURL:(nullable NSURL *)url appURL:(nullable NSURL *)appURL actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject { @@ -443,7 +453,12 @@ NSString * const KeyActionTypeOpen = @"openPage"; }]; }; - [self setClientParameterWith:actionInformation completionHandler:performAction]; + // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map + if ([actionInformation dict:@"clientParameters"]) { + [self setClientParameterWith:actionInformation completionHandler:performAction]; + } else { + performAction(actionInformation); + } } - (void)restartAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate { @@ -562,7 +577,12 @@ NSString * const KeyActionTypeOpen = @"openPage"; [weakSelf prepareLinkAwayWithURL:otherURL appURL:appURL actionInformation:actionMap additionalData:additionalData delegate:delegate]; }; - [self setClientParameterWith:actionInformation completionHandler:performAction]; + // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map + if ([actionInformation dict:@"clientParameters"]) { + [self setClientParameterWith:actionInformation completionHandler:performAction]; + } else { + performAction(actionInformation); + } } - (void)prepareLinkAwayWithURL:(nullable NSURL *)url appURL:(nullable NSURL *)appURL actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate { From 93a590fedf059c1a256752ac014ca61b3a9960fb Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 21 Jan 2021 11:00:37 -0500 Subject: [PATCH 2/9] KeyClientParameters --- .../ActionHandling/ActionHandler+ClientParameters.swift | 2 +- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m | 8 ++++---- MVMCore/MVMCore/Constants/MVMCoreJSONConstants.h | 2 ++ MVMCore/MVMCore/Constants/MVMCoreJSONConstants.m | 2 ++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/ActionHandler+ClientParameters.swift b/MVMCore/MVMCore/ActionHandling/ActionHandler+ClientParameters.swift index a2c3841..abeec70 100644 --- a/MVMCore/MVMCore/ActionHandling/ActionHandler+ClientParameters.swift +++ b/MVMCore/MVMCore/ActionHandling/ActionHandler+ClientParameters.swift @@ -13,7 +13,7 @@ public extension MVMCoreActionHandler { /// Iterates through the clientParameters list. Gets values from the individual handlers and attaches the parameters to extraParameters. @objc func setClientParameter(with actionMap: [String: Any]?, completionHandler: @escaping ([String : Any]?) -> ()) { - guard let actionMapWithClientParameters = actionMap, let clientParameters = actionMapWithClientParameters.optionalDictionaryForKey("clientParameters") else { + guard let actionMapWithClientParameters = actionMap, let clientParameters = actionMapWithClientParameters.optionalDictionaryForKey(KeyClientParameters) else { completionHandler(actionMap) return } diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 5095fc8..125e1d5 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -129,7 +129,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; }; // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map - if ([actionInformation dict:@"clientParameters"]) { + if ([actionInformation dict:KeyClientParameters]) { [self setClientParameterWith:actionInformation completionHandler:performAction]; } else { performAction(actionInformation); @@ -299,7 +299,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; }; // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map - if ([actionInformation dict:@"clientParameters"]) { + if ([actionInformation dict:KeyClientParameters]) { [self setClientParameterWith:actionInformation completionHandler:performAction]; } else { performAction(actionInformation); @@ -454,7 +454,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; }; // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map - if ([actionInformation dict:@"clientParameters"]) { + if ([actionInformation dict:KeyClientParameters]) { [self setClientParameterWith:actionInformation completionHandler:performAction]; } else { performAction(actionInformation); @@ -578,7 +578,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; }; // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map - if ([actionInformation dict:@"clientParameters"]) { + if ([actionInformation dict:KeyClientParameters]) { [self setClientParameterWith:actionInformation completionHandler:performAction]; } else { performAction(actionInformation); diff --git a/MVMCore/MVMCore/Constants/MVMCoreJSONConstants.h b/MVMCore/MVMCore/Constants/MVMCoreJSONConstants.h index f3d84ac..220b180 100644 --- a/MVMCore/MVMCore/Constants/MVMCoreJSONConstants.h +++ b/MVMCore/MVMCore/Constants/MVMCoreJSONConstants.h @@ -51,6 +51,8 @@ extern NSString * const KeyContextRoot; extern NSString * const KeyType; extern NSString * const KeyMVMRC; +extern NSString * const KeyClientParameters; + #pragma mark - JSON Values // Server driven response type diff --git a/MVMCore/MVMCore/Constants/MVMCoreJSONConstants.m b/MVMCore/MVMCore/Constants/MVMCoreJSONConstants.m index 71cccac..2127e2e 100644 --- a/MVMCore/MVMCore/Constants/MVMCoreJSONConstants.m +++ b/MVMCore/MVMCore/Constants/MVMCoreJSONConstants.m @@ -51,6 +51,8 @@ NSString * const KeyContextRoot = @"appContext"; NSString * const KeyType = @"type"; NSString * const KeyMVMRC = @"LaunchMVMRC"; +NSString * const KeyClientParameters = @"clientParameters"; + #pragma mark - JSON Values // Server driven response type From 5d92df53472b5edddf73ea402d96e19340eefcaf Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 21 Jan 2021 11:13:17 -0500 Subject: [PATCH 3/9] typo --- .../ActionHandling/MVMCoreActionHandler.m | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 125e1d5..d069404 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -128,7 +128,11 @@ NSString * const KeyActionTypeOpen = @"openPage"; }]; }; - // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map + /* + BAU dictionary comparsion breaks if client parameters sets the dictionary. + For now we will set client parameters only when its sent in the action map. + We can move the code to Objective-C if required. + */ if ([actionInformation dict:KeyClientParameters]) { [self setClientParameterWith:actionInformation completionHandler:performAction]; } else { @@ -298,7 +302,11 @@ NSString * const KeyActionTypeOpen = @"openPage"; [weakSelf prepareLinkAwayWithURL:otherURL appURL:appURL actionInformation:actionMap additionalData:additionalData delegateObject:delegateObject]; }; - // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map + /* + BAU dictionary comparsion breaks if client parameters sets the dictionary. + For now we will set client parameters only when its sent in the action map. + We can move the code to Objective-C if required. + */ if ([actionInformation dict:KeyClientParameters]) { [self setClientParameterWith:actionInformation completionHandler:performAction]; } else { @@ -453,7 +461,11 @@ NSString * const KeyActionTypeOpen = @"openPage"; }]; }; - // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map + /* + BAU dictionary comparsion breaks if client parameters sets the dictionary. + For now we will set client parameters only when its sent in the action map. + We can move the code to Objective-C if required. + */ if ([actionInformation dict:KeyClientParameters]) { [self setClientParameterWith:actionInformation completionHandler:performAction]; } else { @@ -577,7 +589,11 @@ NSString * const KeyActionTypeOpen = @"openPage"; [weakSelf prepareLinkAwayWithURL:otherURL appURL:appURL actionInformation:actionMap additionalData:additionalData delegate:delegate]; }; - // BAU dictionary comparsion breaks if client paramters sets the dictionarr. For now we will set client paramters only when its sent in the action map + /* + BAU dictionary comparsion breaks if client parameters sets the dictionary. + For now we will set client parameters only when its sent in the action map. + We can move the code to Objective-C if required. + */ if ([actionInformation dict:KeyClientParameters]) { [self setClientParameterWith:actionInformation completionHandler:performAction]; } else { From 45b84ae2e09eb1e015d5745d0bdae8aca70045cb Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 21 Jan 2021 13:00:29 -0500 Subject: [PATCH 4/9] redone in objecitve c --- MVMCore/MVMCore.xcodeproj/project.pbxproj | 4 - .../ActionHandler+ClientParameters.swift | 56 ----------- .../ActionHandling/MVMCoreActionHandler.m | 93 +++++++++++-------- .../ClientParameterRegistry.swift | 2 +- .../MFHardCodedServerResponse.h | 2 +- 5 files changed, 56 insertions(+), 101 deletions(-) delete mode 100644 MVMCore/MVMCore/ActionHandling/ActionHandler+ClientParameters.swift diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index aa096b4..b06322b 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -25,7 +25,6 @@ 016FF6F2259A4FCC00F5E4AA /* ClientParameterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 016FF6F1259A4FCC00F5E4AA /* ClientParameterModel.swift */; }; 016FF6F6259B9AED00F5E4AA /* ClientParameterRegistry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 016FF6F5259B9AED00F5E4AA /* ClientParameterRegistry.swift */; }; 016FF6FC259BA27E00F5E4AA /* ClientParameterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 016FF6FB259BA27E00F5E4AA /* ClientParameterProtocol.swift */; }; - 016FF706259D180000F5E4AA /* ActionHandler+ClientParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 016FF705259D180000F5E4AA /* ActionHandler+ClientParameters.swift */; }; 01934FE725A4FFC2003DCD67 /* ClientParameterActionProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01934FE625A4FFC2003DCD67 /* ClientParameterActionProtocol.swift */; }; 01C851CF23CF7B260021F976 /* JSONMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01C851CE23CF7B260021F976 /* JSONMap.swift */; }; 01C851D123CF97FE0021F976 /* ActionBackModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01C851D023CF97FE0021F976 /* ActionBackModel.swift */; }; @@ -154,7 +153,6 @@ 016FF6F1259A4FCC00F5E4AA /* ClientParameterModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientParameterModel.swift; sourceTree = ""; }; 016FF6F5259B9AED00F5E4AA /* ClientParameterRegistry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientParameterRegistry.swift; sourceTree = ""; }; 016FF6FB259BA27E00F5E4AA /* ClientParameterProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientParameterProtocol.swift; sourceTree = ""; }; - 016FF705259D180000F5E4AA /* ActionHandler+ClientParameters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ActionHandler+ClientParameters.swift"; sourceTree = ""; }; 01934FE625A4FFC2003DCD67 /* ClientParameterActionProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientParameterActionProtocol.swift; sourceTree = ""; }; 01C851CE23CF7B260021F976 /* JSONMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONMap.swift; sourceTree = ""; }; 01C851D023CF97FE0021F976 /* ActionBackModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionBackModel.swift; sourceTree = ""; }; @@ -585,7 +583,6 @@ AFBB96B51FBA3CEC0008D868 /* MVMCoreActionDelegateProtocol.h */, AFBB96B61FBA3CEC0008D868 /* MVMCoreActionHandler.h */, AFBB96B71FBA3CEC0008D868 /* MVMCoreActionHandler.m */, - 016FF705259D180000F5E4AA /* ActionHandler+ClientParameters.swift */, ); path = ActionHandling; sourceTree = ""; @@ -810,7 +807,6 @@ buildActionMask = 2147483647; files = ( AFED77A71FCCA29400BAE689 /* MVMCoreViewControllerProgrammaticMappingObject.m in Sources */, - 016FF706259D180000F5E4AA /* ActionHandler+ClientParameters.swift in Sources */, 946EE1A7237B5B1C0036751F /* ModelRegistry.swift in Sources */, AFBB96641FBA3A570008D868 /* MVMCoreLoadHandler.m in Sources */, AFFCFA671FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.m in Sources */, diff --git a/MVMCore/MVMCore/ActionHandling/ActionHandler+ClientParameters.swift b/MVMCore/MVMCore/ActionHandling/ActionHandler+ClientParameters.swift deleted file mode 100644 index abeec70..0000000 --- a/MVMCore/MVMCore/ActionHandling/ActionHandler+ClientParameters.swift +++ /dev/null @@ -1,56 +0,0 @@ -// -// ActionHandler+ClientParameters.swift -// MVMCore -// -// Created by Suresh, Kamlesh on 12/30/20. -// Copyright © 2020 myverizon. All rights reserved. -// - -import Foundation - -public extension MVMCoreActionHandler { - - /// Iterates through the clientParameters list. Gets values from the individual handlers and attaches the parameters to extraParameters. - @objc func setClientParameter(with actionMap: [String: Any]?, completionHandler: @escaping ([String : Any]?) -> ()) { - - guard let actionMapWithClientParameters = actionMap, let clientParameters = actionMapWithClientParameters.optionalDictionaryForKey(KeyClientParameters) else { - completionHandler(actionMap) - return - } - - let isBackgroudRequest = actionMapWithClientParameters.boolForKey("background") - - if !isBackgroudRequest { - MVMCoreLoadingOverlayHandler.sharedLoadingOverlay()?.startLoading() - } - - let stopLoadingOverlay = {() in - if !isBackgroudRequest { - MVMCoreLoadingOverlayHandler.sharedLoadingOverlay()?.stopLoading(true) - } - } - - do { - try MVMCoreObject.sharedInstance()?.clientParameterRegistry?.getParameters(with: clientParameters) { (clientParams) in - guard let clientParams = clientParams else { - stopLoadingOverlay() - completionHandler(actionMapWithClientParameters) - return - } - - var extraParams: [String : Any] = actionMapWithClientParameters.dictionaryForKey(KeyExtraParameters) - extraParams.merge(clientParams) { (_, new) in new } - var actionMapM = actionMapWithClientParameters - actionMapM[KeyExtraParameters] = extraParams - - stopLoadingOverlay() - completionHandler(actionMapM) - } - } catch { - stopLoadingOverlay() - completionHandler(actionMapWithClientParameters) - MVMCoreLoggingHandler.logDebugMessage(withDelegate: "Error clientParamters: \(error)") - } - - } -} diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index d069404..3b2d704 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -26,6 +26,7 @@ #import "MVMCorePresentationDelegateProtocol.h" #import #import +#import "MVMCoreLoadingOverlayHandler.h" NSString * const KeyActionType = @"actionType"; NSString * const KeyActionTypeLinkAway = @"openURL"; @@ -128,16 +129,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; }]; }; - /* - BAU dictionary comparsion breaks if client parameters sets the dictionary. - For now we will set client parameters only when its sent in the action map. - We can move the code to Objective-C if required. - */ - if ([actionInformation dict:KeyClientParameters]) { - [self setClientParameterWith:actionInformation completionHandler:performAction]; - } else { - performAction(actionInformation); - } + [self setClientParameter:actionInformation completionHandler:performAction]; } - (void)shareAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject { @@ -302,16 +294,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; [weakSelf prepareLinkAwayWithURL:otherURL appURL:appURL actionInformation:actionMap additionalData:additionalData delegateObject:delegateObject]; }; - /* - BAU dictionary comparsion breaks if client parameters sets the dictionary. - For now we will set client parameters only when its sent in the action map. - We can move the code to Objective-C if required. - */ - if ([actionInformation dict:KeyClientParameters]) { - [self setClientParameterWith:actionInformation completionHandler:performAction]; - } else { - performAction(actionInformation); - } + [self setClientParameter:actionInformation completionHandler:performAction]; } - (void)prepareLinkAwayWithURL:(nullable NSURL *)url appURL:(nullable NSURL *)appURL actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject { @@ -461,16 +444,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; }]; }; - /* - BAU dictionary comparsion breaks if client parameters sets the dictionary. - For now we will set client parameters only when its sent in the action map. - We can move the code to Objective-C if required. - */ - if ([actionInformation dict:KeyClientParameters]) { - [self setClientParameterWith:actionInformation completionHandler:performAction]; - } else { - performAction(actionInformation); - } + [self setClientParameter:actionInformation completionHandler:performAction]; } - (void)restartAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate { @@ -589,15 +563,56 @@ NSString * const KeyActionTypeOpen = @"openPage"; [weakSelf prepareLinkAwayWithURL:otherURL appURL:appURL actionInformation:actionMap additionalData:additionalData delegate:delegate]; }; - /* - BAU dictionary comparsion breaks if client parameters sets the dictionary. - For now we will set client parameters only when its sent in the action map. - We can move the code to Objective-C if required. - */ - if ([actionInformation dict:KeyClientParameters]) { - [self setClientParameterWith:actionInformation completionHandler:performAction]; - } else { - performAction(actionInformation); + [self setClientParameter:actionInformation completionHandler:performAction]; +} + +/// Iterates through the clientParameters list. Gets values from the individual handlers and attaches the parameters to extraParameters. +- (void)setClientParameter:(nullable NSDictionary *)actionInformation completionHandler:(nonnull void (^)(NSDictionary * _Nullable jsonDictionary))completionHandler { + + NSDictionary *clientParametersMap = [actionInformation dict:KeyClientParameters]; + if (!clientParametersMap) { + completionHandler(actionInformation); + return; + } + + BOOL isBackgroudRequest = [actionInformation boolForKey:@"background"]; + + if (!isBackgroudRequest) { + [[MVMCoreLoadingOverlayHandler sharedLoadingOverlay] startLoading]; + } + + void (^stopLoadingOverlay)(void) = ^(void) { + if (!isBackgroudRequest) { + [[MVMCoreLoadingOverlayHandler sharedLoadingOverlay] stopLoading:true]; + } + }; + + NSError *error = nil; + [MVMCoreLoggingHandler logDebugMessageWithDelegate:@"Fetching client parameters"]; + [[[MVMCoreObject sharedInstance] clientParameterRegistry] getParametersWith:clientParametersMap + error:&error + completionHandler:^(NSDictionary * _Nullable clientParameters) { + [MVMCoreLoggingHandler logDebugMessageWithDelegate:@"Finshed fetching client parameters"]; + if (clientParameters) { + NSMutableDictionary *actionWithClientParameters = [actionInformation mutableCopy]; + NSMutableDictionary *extraParameters = [clientParameters mutableCopy]; + [extraParameters addEntriesFromDictionary:[actionWithClientParameters dictionaryForKey:KeyExtraParameters]]; + actionWithClientParameters[KeyExtraParameters] = extraParameters; + + stopLoadingOverlay(); + completionHandler(actionWithClientParameters); + } else { + [MVMCoreLoggingHandler logDebugMessageWithDelegate:@"No client paramnters"]; + stopLoadingOverlay(); + completionHandler(actionInformation); + } + }]; + + if (error) { + stopLoadingOverlay(); + completionHandler(actionInformation); + [MVMCoreLoggingHandler logDebugMessageWithDelegate:@"Error clientparameters"]; + [MVMCoreLoggingHandler logDebugMessageWithDelegate:error.debugDescription]; } } diff --git a/MVMCore/MVMCore/Models/ActionType/Client Parameters/ClientParameterRegistry.swift b/MVMCore/MVMCore/Models/ActionType/Client Parameters/ClientParameterRegistry.swift index ba698f4..1a4160d 100644 --- a/MVMCore/MVMCore/Models/ActionType/Client Parameters/ClientParameterRegistry.swift +++ b/MVMCore/MVMCore/Models/ActionType/Client Parameters/ClientParameterRegistry.swift @@ -47,7 +47,7 @@ import Foundation /// ] ///} /// completionHandler can return flat dictinary or a map. It depends on the paramters handler - func getParameters(with clientParameters: [String: Any], completionHandler:@escaping ([String: Any]?) -> ()) throws { + open func getParameters(with clientParameters: [String: Any], completionHandler:@escaping ([String: Any]?) -> ()) throws { guard let clientParameterModel = try ClientParameterRegistry.getClientParameterModel(clientParameters) else { completionHandler(nil) diff --git a/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h b/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h index eb9fba9..efa33b6 100644 --- a/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h +++ b/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h @@ -9,7 +9,7 @@ #import #import "MVMCoreRequestParameters.h" -#define ENABLE_HARD_CODED_RESPONSE 0 && DEBUG +#define ENABLE_HARD_CODED_RESPONSE 1 && DEBUG #if ENABLE_HARD_CODED_RESPONSE From 4e1e563284642f7345eadebe62bbbd5fe7a9fa16 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 21 Jan 2021 13:01:40 -0500 Subject: [PATCH 5/9] remove hardcode --- .../Utility/HardCodedServerResponse/MFHardCodedServerResponse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h b/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h index efa33b6..eb9fba9 100644 --- a/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h +++ b/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h @@ -9,7 +9,7 @@ #import #import "MVMCoreRequestParameters.h" -#define ENABLE_HARD_CODED_RESPONSE 1 && DEBUG +#define ENABLE_HARD_CODED_RESPONSE 0 && DEBUG #if ENABLE_HARD_CODED_RESPONSE From b00e9c48950ef48b816a5dc99e7d8ae27a5da8ee Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 21 Jan 2021 13:27:25 -0500 Subject: [PATCH 6/9] code review --- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h | 2 ++ MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h index c677e53..374b968 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.h @@ -158,4 +158,6 @@ extern NSString * _Nonnull const KeyActionTypeOpen; // By default, throws an error, calling defaultHandleActionError. + (void)defaultHandleUnknownActionType:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate __deprecated; +// Iterates through the clientParameters list. Gets values from the individual handlers and attaches the parameters to extraParameters. +- (void)setClientParameter:(nullable NSDictionary *)actionInformation completionHandler:(nonnull void (^)(NSDictionary * _Nullable jsonDictionary))completionHandler; @end diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 3b2d704..a717595 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -566,7 +566,6 @@ NSString * const KeyActionTypeOpen = @"openPage"; [self setClientParameter:actionInformation completionHandler:performAction]; } -/// Iterates through the clientParameters list. Gets values from the individual handlers and attaches the parameters to extraParameters. - (void)setClientParameter:(nullable NSDictionary *)actionInformation completionHandler:(nonnull void (^)(NSDictionary * _Nullable jsonDictionary))completionHandler { NSDictionary *clientParametersMap = [actionInformation dict:KeyClientParameters]; @@ -611,8 +610,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; if (error) { stopLoadingOverlay(); completionHandler(actionInformation); - [MVMCoreLoggingHandler logDebugMessageWithDelegate:@"Error clientparameters"]; - [MVMCoreLoggingHandler logDebugMessageWithDelegate:error.debugDescription]; + [MVMCoreLoggingHandler addErrorToLog:error]; } } From aa3390e501aa5074e98590037df34b865b27c8e3 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 21 Jan 2021 13:30:56 -0500 Subject: [PATCH 7/9] typo --- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index a717595..d955860 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -601,7 +601,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; stopLoadingOverlay(); completionHandler(actionWithClientParameters); } else { - [MVMCoreLoggingHandler logDebugMessageWithDelegate:@"No client paramnters"]; + [MVMCoreLoggingHandler logDebugMessageWithDelegate:@"No client parameters"]; stopLoadingOverlay(); completionHandler(actionInformation); } From c3fb8aee96023e72d2359f99666df60d2516e0de Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 21 Jan 2021 13:38:56 -0500 Subject: [PATCH 8/9] MVMCoreErrorObject --- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index d955860..20e0145 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -610,7 +610,8 @@ NSString * const KeyActionTypeOpen = @"openPage"; if (error) { stopLoadingOverlay(); completionHandler(actionInformation); - [MVMCoreLoggingHandler addErrorToLog:error]; + MVMCoreErrorObject* errorObject = [MVMCoreErrorObject createErrorObjectForNSError:error location:@"MVMCoreActionHandler"]; + [MVMCoreLoggingHandler addErrorToLog:errorObject]; } } From b9463930f8d8dec22dcb3825077799c7487318c0 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 21 Jan 2021 13:45:24 -0500 Subject: [PATCH 9/9] code review --- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 20e0145..fa98ee6 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -610,8 +610,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; if (error) { stopLoadingOverlay(); completionHandler(actionInformation); - MVMCoreErrorObject* errorObject = [MVMCoreErrorObject createErrorObjectForNSError:error location:@"MVMCoreActionHandler"]; - [MVMCoreLoggingHandler addErrorToLog:errorObject]; + [MVMCoreLoggingHandler addErrorToLog:[MVMCoreErrorObject createErrorObjectForNSError:error location:@"MVMCoreActionHandler->setClientParameter"]]; } }