fix for legacy
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
6c8bb9ce4b
commit
59ff7d2fad
@ -44,37 +44,32 @@ public extension MVMCoreActionHandler {
|
||||
|
||||
@objc func hasActionHandler(actionType: String?, actionInformation: [String: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) -> Bool {
|
||||
//ensure there is a Serialized version of the Action
|
||||
guard let actionType = actionType, let actionInformation = actionInformation else { return false }
|
||||
guard let actionType = actionType,
|
||||
let actionInformation = actionInformation,
|
||||
let actionModelType = ModelRegistry.getType(for: actionType, with: ActionModelProtocol.self)
|
||||
else { return false }
|
||||
|
||||
do {
|
||||
//get the actionModelType
|
||||
guard let actionModelType = ModelRegistry.getType(for: actionType, with: ActionModelProtocol.self) else {
|
||||
throw ModelRegistry.Error.decoderErrorModelNotMapped()
|
||||
}
|
||||
|
||||
//deserialize the actionModel for the actionType found
|
||||
guard let actionModel = try actionModelType.decode(jsonDict: actionInformation) as? ActionModelProtocol else {
|
||||
throw ModelRegistry.Error.decoderOther(message: "Could not decode to ActionModelProtocol")
|
||||
}
|
||||
|
||||
|
||||
//get the action Handler for the actionModel created
|
||||
let actionHandler = try ModelRegistry.getActionHandler(actionModel)
|
||||
|
||||
//call the handleAction of the handler
|
||||
actionHandler.handleAction(actionModel, additionalData: additionalData, delegateObject: delegateObject)
|
||||
|
||||
//complete
|
||||
return true
|
||||
|
||||
} catch {
|
||||
//log the error
|
||||
if let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: "") {
|
||||
MVMCoreActionHandler.shared()?.defaultHandleActionError(errorObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
//incomplete
|
||||
return false
|
||||
}
|
||||
|
||||
//complete
|
||||
return true
|
||||
}
|
||||
|
||||
/// Start action on current thread.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user