Swift code for webPunchOut UAD pages
This commit is contained in:
parent
884e0988df
commit
06dbe2c1a0
@ -135,3 +135,30 @@ public extension NavigationHandler {
|
|||||||
try await NavigationHandler.shared().navigate(with: getOperationPopToViewController(with: pageType, navigationController: navigationController, delegateObject: delegateObject, animated: animated))
|
try await NavigationHandler.shared().navigate(with: getOperationPopToViewController(with: pageType, navigationController: navigationController, delegateObject: delegateObject, animated: animated))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc
|
||||||
|
public extension MVMCoreLoadRequestOperation {
|
||||||
|
@objc static func fetchJsonForPageType(requestParameter: MVMCoreRequestParameters, completion: @escaping (([AnyHashable: Any]?, [AnyHashable: Any]?) -> Void)) {
|
||||||
|
MVMCoreCache.shared()?.fetchJSON(forPageType: requestParameter.pageType, completionHandler: { jsonDictionary in
|
||||||
|
if requestParameter.pageType == "webPunchOut_UAD" {
|
||||||
|
guard var jsonDictionary = jsonDictionary,
|
||||||
|
let actionMap = requestParameter.actionMap,
|
||||||
|
let extraParameters = actionMap["extraParameters"] as? [String: String],
|
||||||
|
let flowName = extraParameters["flowName"] else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
MVMCoreCache.shared()?.fetchJSON(forModule: flowName, completionHandler: { moduleDictionary in
|
||||||
|
guard let moduleDictionary = moduleDictionary,
|
||||||
|
let punchOut = moduleDictionary[flowName] as? [String: String],
|
||||||
|
let browserUrl = punchOut["browserUrl"] else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
jsonDictionary["browserUrl"] = browserUrl
|
||||||
|
completion(jsonDictionary, nil)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
completion(jsonDictionary, nil)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -237,23 +237,7 @@
|
|||||||
}];
|
}];
|
||||||
} else if (requestParameters.pageType.length != 0) {
|
} else if (requestParameters.pageType.length != 0) {
|
||||||
|
|
||||||
// Check cache function if page json is already in the cache.
|
[self fetchJsonForPageTypeWithRequestParameter: requestParameters completion: completionHandler];
|
||||||
[[MVMCoreCache sharedCache] fetchJSONForPageType:requestParameters.pageType completionHandler:^(NSDictionary * _Nullable jsonDictionary) {
|
|
||||||
if ([requestParameters.pageType isEqualToString:@"webPunchOut_UAD"]) {
|
|
||||||
NSMutableDictionary *newJsonDictionary = [jsonDictionary mutableCopy];
|
|
||||||
NSString *flowName = requestParameters.actionMap[@"extraParameters"][@"flowName"];
|
|
||||||
[[MVMCoreCache sharedCache] fetchJSONForModule: flowName completionHandler:^(NSDictionary * _Nullable moduleJsonDictionary) {
|
|
||||||
if (moduleJsonDictionary[flowName] != NULL && moduleJsonDictionary[flowName][@"browserUrl"] != NULL) {
|
|
||||||
[newJsonDictionary setObject: moduleJsonDictionary[flowName][@"browserUrl"] forKey:@"browserUrl"];
|
|
||||||
completionHandler(newJsonDictionary, nil);
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
//jsonDictionary[@"browserUrl"] =
|
|
||||||
} else {
|
|
||||||
completionHandler(jsonDictionary,nil);
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
|
|
||||||
|
|
||||||
} else if (modules > 0) {
|
} else if (modules > 0) {
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user