fix openurl

This commit is contained in:
Suresh, Kamlesh 2021-03-02 15:28:10 -05:00
parent b6c48edffd
commit 08142cb945
2 changed files with 12 additions and 15 deletions

View File

@ -93,7 +93,7 @@ NSString * const KeyActionTypeOpen = @"openPage";
} }
} }
- (void)setClientParameter:(nullable NSDictionary *)clientParametersMap requestParameters:(nullable NSDictionary *)requestParameters isBackgroudRequest:(BOOL)isBackgroudRequest completionHandler:(nonnull void (^)(NSDictionary * _Nullable jsonDictionary))completionHandler { - (void)setClientParameter:(nullable NSDictionary *)clientParametersMap requestParameters:(nullable NSDictionary *)requestParameters isBackgroudRequest:(BOOL)isBackgroudRequest completionHandler:(nonnull void (^)(NSDictionary * _Nullable extraParameters))completionHandler {
//NSDictionary *clientParametersMap = [actionInformation dict:KeyClientParameters]; //NSDictionary *clientParametersMap = [actionInformation dict:KeyClientParameters];
if (!clientParametersMap) { if (!clientParametersMap) {
@ -121,11 +121,6 @@ NSString * const KeyActionTypeOpen = @"openPage";
completionHandler:^(NSDictionary<NSString *,id> * _Nullable clientParameters) { completionHandler:^(NSDictionary<NSString *,id> * _Nullable clientParameters) {
[MVMCoreLoggingHandler logDebugMessageWithDelegate:@"Finshed fetching client parameters"]; [MVMCoreLoggingHandler logDebugMessageWithDelegate:@"Finshed fetching client parameters"];
if (clientParameters) { if (clientParameters) {
// NSMutableDictionary *actionWithClientParameters = [actionInformation mutableCopy];
// NSMutableDictionary *extraParameters = [clientParameters mutableCopy];
// [extraParameters addEntriesFromDictionary:[actionWithClientParameters dictionaryForKey:KeyExtraParameters]];
// actionWithClientParameters[KeyExtraParameters] = extraParameters;
stopLoadingOverlay(); stopLoadingOverlay();
completionHandler(clientParameters); completionHandler(clientParameters);
} else { } else {
@ -184,9 +179,6 @@ NSString * const KeyActionTypeOpen = @"openPage";
}]; }];
}; };
//
//[self setClientParameter:actionInformation completionHandler:performAction];
performAction(actionInformation); performAction(actionInformation);
} }
@ -346,26 +338,31 @@ NSString * const KeyActionTypeOpen = @"openPage";
- (void)linkAwayAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject { - (void)linkAwayAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
void (^performAction)(NSDictionary*) = ^(NSDictionary* actionMap) { void (^performAction)(NSDictionary*) = ^(NSDictionary* extraParamters) {
NSMutableDictionary *actionWithClientParameters = [actionInformation mutableCopy];
NSMutableDictionary *extraParametersT = [extraParamters mutableCopy];
[extraParametersT addEntriesFromDictionary:[actionWithClientParameters dictionaryForKey:KeyExtraParameters]];
actionWithClientParameters[KeyExtraParameters] = extraParametersT;
// Gets the app url // Gets the app url
NSURL *appURL = nil; NSURL *appURL = nil;
NSString *appURLString = [actionMap string:KeyLinkAwayAppURL]; NSString *appURLString = [actionWithClientParameters string:KeyLinkAwayAppURL];
if (appURLString.length > 0) { if (appURLString.length > 0) {
appURL = [NSURL URLWithString:appURLString]; appURL = [NSURL URLWithString:appURLString];
} }
// Gets the browser url // Gets the browser url
NSURL *otherURL = nil; NSURL *otherURL = nil;
NSString *otherURLString = [actionMap string:KeyLinkAwayURL]; NSString *otherURLString = [actionWithClientParameters string:KeyLinkAwayURL];
if (otherURLString.length > 0) { if (otherURLString.length > 0) {
otherURL = [NSURL URLWithString:otherURLString]; otherURL = [NSURL URLWithString:otherURLString];
} }
// Provide the URL and App URL to be modified if needed by a subclass or delegate. // Provide the URL and App URL to be modified if needed by a subclass or delegate.
[weakSelf prepareLinkAwayWithURL:otherURL appURL:appURL actionInformation:actionMap additionalData:additionalData delegateObject:delegateObject]; [weakSelf prepareLinkAwayWithURL:otherURL appURL:appURL actionInformation:actionWithClientParameters additionalData:additionalData delegateObject:delegateObject];
}; };
// [self setClientParameter:actionInformation completionHandler:performAction];
[self setClientParameter:[actionInformation dict:KeyClientParameters] [self setClientParameter:[actionInformation dict:KeyClientParameters]
requestParameters:nil requestParameters:nil
isBackgroudRequest:false isBackgroudRequest:false

View File

@ -9,7 +9,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "MVMCoreRequestParameters.h" #import "MVMCoreRequestParameters.h"
#define ENABLE_HARD_CODED_RESPONSE 0 && DEBUG #define ENABLE_HARD_CODED_RESPONSE 1 && DEBUG
#if ENABLE_HARD_CODED_RESPONSE #if ENABLE_HARD_CODED_RESPONSE