Merge branch 'feature/molecule_replacement_behavior' into 'develop'
Fix module mapping ### Summary Fixes the optional and required module mapping for atomic when RequestParameters are pre-generated as part of the openPage model. Co-authored-by: Hedden, Kyle Matthew <kyle.hedden@verizonwireless.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core/-/merge_requests/287
This commit is contained in:
commit
c5dab7d70d
@ -11,9 +11,19 @@ import Foundation
|
||||
open class ActionOpenPageHandler: MVMCoreJSONActionHandlerProtocol {
|
||||
required public init() {}
|
||||
|
||||
func requestParamaters(for model: ActionOpenPageModel) -> MVMCoreRequestParameters {
|
||||
let requestParameters = model.requestParameters.copy() as! MVMCoreRequestParameters
|
||||
if let pageType = requestParameters.pageType {
|
||||
// Re-evaluate required & optional modules as action models might have been generated prior to recent additions to the mapping.
|
||||
requestParameters.modules = MVMCoreViewControllerMappingObject.shared()?.modulesRequired(forPageType: pageType) as? [String]
|
||||
requestParameters.optionalModules = MVMCoreViewControllerMappingObject.shared()?.modulesOptional(forPageType: pageType) as? [String]
|
||||
}
|
||||
return requestParameters
|
||||
}
|
||||
|
||||
open func performAction(with JSON: [AnyHashable : Any], model: ActionModelProtocol, delegateObject: DelegateObject?, additionalData: [AnyHashable : Any]?) async throws {
|
||||
guard let model = model as? ActionOpenPageModel else { return }
|
||||
let requestParameters: MVMCoreRequestParameters = model.requestParameters.copy() as! MVMCoreRequestParameters
|
||||
let requestParameters = requestParamaters(for: model)
|
||||
do {
|
||||
if let closure = delegateObject?.actionDelegate?.handleOpenPage {
|
||||
// Legacy code will use the old handler function and break the task chain here.
|
||||
|
||||
@ -299,6 +299,9 @@
|
||||
if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getJSONForRequestParameters:)]) {
|
||||
NSDictionary *json = [[MVMCoreObject sharedInstance].globalLoadDelegate getJSONForRequestParameters:requestParameters];
|
||||
if (json) {
|
||||
#if HARD_CODED_RESPONSE_DELAY > 0
|
||||
[NSThread sleepForTimeInterval:HARD_CODED_RESPONSE_DELAY];
|
||||
#endif
|
||||
completionHandler(json);
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user