cleanup
This commit is contained in:
parent
5c53466dac
commit
17b2a4368f
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
open class ActionActionsModel: ActionModelProtocol {
|
public struct ActionActionsModel: ActionModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -46,7 +46,7 @@ open class ActionActionsModel: ActionModelProtocol {
|
|||||||
// MARK: - Codec
|
// MARK: - Codec
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
actions = try typeContainer.decodeModels(codingKey: .actions)
|
actions = try typeContainer.decodeModels(codingKey: .actions)
|
||||||
if let concurrent = try typeContainer.decodeIfPresent(Bool.self, forKey: .concurrent) {
|
if let concurrent = try typeContainer.decodeIfPresent(Bool.self, forKey: .concurrent) {
|
||||||
|
|||||||
@ -8,27 +8,27 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
open class ActionOpenPageModel: ActionModelProtocol, ActionOpenPageProtocol, ClientParameterActionProtocol {
|
public struct ActionOpenPageModel: ActionModelProtocol, ActionOpenPageProtocol, ClientParameterActionProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open class var identifier: String { "openPage" }
|
public static var identifier: String = "openPage"
|
||||||
open var actionType: String = identifier
|
public var actionType: String = identifier
|
||||||
open var pageType: String
|
public var pageType: String
|
||||||
open var modules: [String]?
|
public var modules: [String]?
|
||||||
open var baseURL: URL?
|
public var baseURL: URL?
|
||||||
open var appContext: String?
|
public var appContext: String?
|
||||||
open var requestURL: URL?
|
public var requestURL: URL?
|
||||||
open var extraParameters: JSONValueDictionary?
|
public var extraParameters: JSONValueDictionary?
|
||||||
open var analyticsData: JSONValueDictionary?
|
public var analyticsData: JSONValueDictionary?
|
||||||
open var presentationStyle: String?
|
public var presentationStyle: String?
|
||||||
open var tabBarIndex: Int?
|
public var tabBarIndex: Int?
|
||||||
open var background: Bool?
|
public var background: Bool?
|
||||||
open var clientParameters: ClientParameterModel?
|
public var clientParameters: ClientParameterModel?
|
||||||
open var customTimeoutTime: TimeInterval?
|
public var customTimeoutTime: TimeInterval?
|
||||||
|
|
||||||
open var requestParameters: MVMCoreRequestParameters
|
public var requestParameters: MVMCoreRequestParameters
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initialzier
|
// MARK: - Initialzier
|
||||||
@ -95,7 +95,7 @@ open class ActionOpenPageModel: ActionModelProtocol, ActionOpenPageProtocol, Cli
|
|||||||
requestParameters.actionMap = toJSON()
|
requestParameters.actionMap = toJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(pageType, forKey: .pageType)
|
try container.encode(pageType, forKey: .pageType)
|
||||||
try container.encodeIfPresent(baseURL, forKey: .baseURL)
|
try container.encodeIfPresent(baseURL, forKey: .baseURL)
|
||||||
|
|||||||
@ -148,7 +148,7 @@ public protocol MVMCoreJSONActionHandlerProtocol: MVMCoreActionHandlerProtocol {
|
|||||||
/// Legacy handle action with json.
|
/// Legacy handle action with json.
|
||||||
@objc(handleActionWithDictionary:additionalData:delegateObject:)
|
@objc(handleActionWithDictionary:additionalData:delegateObject:)
|
||||||
open func handleAction(with json: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
|
open func handleAction(with json: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
|
||||||
let task = Task(priority: .userInitiated) {
|
_ = Task(priority: .userInitiated) {
|
||||||
try Task.checkCancellation()
|
try Task.checkCancellation()
|
||||||
do {
|
do {
|
||||||
guard let json = json else {
|
guard let json = json else {
|
||||||
@ -172,15 +172,6 @@ public protocol MVMCoreJSONActionHandlerProtocol: MVMCoreActionHandlerProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Task {
|
|
||||||
let result = await task.result
|
|
||||||
do {
|
|
||||||
try result.get()
|
|
||||||
print("ActionHandler: task done")
|
|
||||||
} catch {
|
|
||||||
print("ActionHandler: \(error)")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Bridges the legacy json using functions and the new model using functions.
|
/// Bridges the legacy json using functions and the new model using functions.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user