Reset optional and required module mapping at the time of request.
This commit is contained in:
parent
f2df0f52e6
commit
3dc05bea61
@ -11,9 +11,19 @@ import Foundation
|
|||||||
open class ActionOpenPageHandler: MVMCoreJSONActionHandlerProtocol {
|
open class ActionOpenPageHandler: MVMCoreJSONActionHandlerProtocol {
|
||||||
required public init() {}
|
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 {
|
open func performAction(with JSON: [AnyHashable : Any], model: ActionModelProtocol, delegateObject: DelegateObject?, additionalData: [AnyHashable : Any]?) async throws {
|
||||||
guard let model = model as? ActionOpenPageModel else { return }
|
guard let model = model as? ActionOpenPageModel else { return }
|
||||||
let requestParameters: MVMCoreRequestParameters = model.requestParameters.copy() as! MVMCoreRequestParameters
|
let requestParameters = requestParamaters(for: model)
|
||||||
do {
|
do {
|
||||||
if let closure = delegateObject?.actionDelegate?.handleOpenPage {
|
if let closure = delegateObject?.actionDelegate?.handleOpenPage {
|
||||||
// Legacy code will use the old handler function and break the task chain here.
|
// Legacy code will use the old handler function and break the task chain here.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user