From 68897db7646ee874847b2e608d3e25f5366c7862 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 2 Apr 2020 19:47:52 -0400 Subject: [PATCH 1/2] april jira tasks --- MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift | 2 -- MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift | 2 -- MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift | 1 - MVMCore/MVMCore/Models/ActionType/ActionModelProtocol.swift | 3 --- MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift | 2 -- MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift | 3 --- MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift | 3 --- MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift | 1 - .../MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift | 1 - MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift | 1 - MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift | 1 - MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift | 1 - 12 files changed, 21 deletions(-) diff --git a/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift index 72b84f7..0cbfd6b 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift @@ -13,6 +13,4 @@ import Foundation public var actionType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? - // Temporary fix till server changes - public var title: String? } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift index 3f13e6a..90e7799 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift @@ -15,8 +15,6 @@ import Foundation public var callNumber: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? - // Temporary fix till server changes - public var title: String? public init(callNumber: String) { self.callNumber = callNumber diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift index 08bf63c..9a9bcee 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift @@ -13,5 +13,4 @@ import UIKit public var actionType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? - public var title: String? } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionModelProtocol.swift b/MVMCore/MVMCore/Models/ActionType/ActionModelProtocol.swift index dc36409..70c3150 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionModelProtocol.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionModelProtocol.swift @@ -13,9 +13,6 @@ public protocol ActionModelProtocol: ModelProtocol { var actionType: String { get } var extraParameters: JSONValueDictionary? { get set } var analyticsData: JSONValueDictionary? { get set } - - // Temporary fix till server changes - var title: String? { get set } } public extension ActionModelProtocol { diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift index 9614bc8..79bdf15 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift @@ -15,8 +15,6 @@ import Foundation public var appURL: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? - // Temporary fix till server changes - public var title: String? public init(appURL: String) { self.appURL = appURL diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift index 413adf8..b51096b 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift @@ -16,9 +16,6 @@ import Foundation public var analyticsData: JSONValueDictionary? public var presentationStyle: String? - // Temporary fix till server changes - public var title: String? - public init(pageType: String) { self.pageType = pageType } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift index fc8c11f..527cc5a 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift @@ -15,9 +15,6 @@ import Foundation public var browserUrl: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? - // Temporary fix till server changes - public var title: String? - //TODO: Should be removed in future releases. This should be MF specific. //Missing params diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift index eaff84c..ad2537f 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift @@ -11,7 +11,6 @@ import Foundation @objcMembers public class ActionPopupModel: ActionModelProtocol { public static var identifier: String = "popup" public var actionType: String = ActionPopupModel.identifier - public var title: String? public var pageType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift index f6d5ad7..647b623 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift @@ -13,5 +13,4 @@ import UIKit public var actionType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? - public var title: String? } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift index 0cdbae3..6713933 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift @@ -13,7 +13,6 @@ import UIKit public var actionType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? - public var title: String? ///Optional pageType, if pageType is nil, will start with pageType launchApp public var pageType: String? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift index 212b526..f9c92e5 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift @@ -13,5 +13,4 @@ import UIKit public var actionType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? - public var title: String? } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift index 16da245..2fb5a3a 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift @@ -16,7 +16,6 @@ import UIKit public static var identifier: String = "share" public var actionType: String = ActionShareModel.identifier - public var title: String? public var sharedType: String public var sharedText: String public var extraParameters: JSONValueDictionary? From cd374bfacc41730cfcef15e3fa419abfbbdd948d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 13 Apr 2020 17:19:50 -0400 Subject: [PATCH 2/2] Fix to models check --- .../MVMCore/Models/Model/ModelRegistry.swift | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/MVMCore/MVMCore/Models/Model/ModelRegistry.swift b/MVMCore/MVMCore/Models/Model/ModelRegistry.swift index b002175..f9ec58b 100644 --- a/MVMCore/MVMCore/Models/Model/ModelRegistry.swift +++ b/MVMCore/MVMCore/Models/Model/ModelRegistry.swift @@ -205,19 +205,18 @@ public extension UnkeyedDecodingContainer { // Iterate and decode each. while !containerCopy.isAtEnd { let nestedContainer = try containerCopy.nestedContainer(keyedBy: AnyCodingKey.self) - if let identifier = try nestedContainer.decodeIfPresent(String.self, forKey: typeCodingKey) { - guard let type = ModelRegistry.getType(for: identifier, with: T.self) else { - MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorModelNotMapped: \(identifier)") - throw ModelRegistry.Error.decoderErrorModelNotMapped - } - // Now get the decoder to use for the type - let decoder = try self.superDecoder() - if let model = try type.init(from: decoder) as? T { - models.append(model) - } else { - MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderError: \(typeCodingKey)") - throw ModelRegistry.Error.decoderError - } + let identifier = try nestedContainer.decode(String.self, forKey: typeCodingKey) + guard let type = ModelRegistry.getType(for: identifier, with: T.self) else { + MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorModelNotMapped: \(identifier)") + throw ModelRegistry.Error.decoderErrorModelNotMapped + } + // Now get the decoder to use for the type + let decoder = try self.superDecoder() + if let model = try type.init(from: decoder) as? T { + models.append(model) + } else { + MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderError: \(typeCodingKey)") + throw ModelRegistry.Error.decoderError } } return models