diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index 53d2a96..0795ad2 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -21,9 +21,6 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ - 0184D3DB24B7D5A600A05369 /* ActionAlertModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0184D3DA24B7D5A600A05369 /* ActionAlertModel.swift */; }; - 0184D3FD24BE54A300A05369 /* UIAlertActionStyle+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0184D3FC24BE54A300A05369 /* UIAlertActionStyle+Codable.swift */; }; - 0184D3FF24BE554A00A05369 /* AlertModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0184D3FE24BE554A00A05369 /* AlertModel.swift */; }; 01C851CF23CF7B260021F976 /* JSONMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01C851CE23CF7B260021F976 /* JSONMap.swift */; }; 01C851D123CF97FE0021F976 /* ActionBackModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01C851D023CF97FE0021F976 /* ActionBackModel.swift */; }; 01DF561421F90ADC00CC099B /* Dictionary+MFConvenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF561321F90ADC00CC099B /* Dictionary+MFConvenience.swift */; }; @@ -33,7 +30,6 @@ 01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */; }; 01F2A05223A8325100D954D8 /* ModelMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A05123A8325100D954D8 /* ModelMapping.swift */; }; 0A42538F23F3414800554656 /* Codable+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A42538E23F3414800554656 /* Codable+Helpers.swift */; }; - 0A62624824C1DFDC00C316B9 /* UIAlertControllerStyle+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A62624724C1DFDC00C316B9 /* UIAlertControllerStyle+Extension.swift */; }; 0AFF597A23FC6E60005C24E8 /* ActionShareModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */; }; 30349BF11FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 30349BEF1FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h */; settings = {ATTRIBUTES = (Public, ); }; }; 30349BF21FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 30349BF01FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m */; }; @@ -149,9 +145,6 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 0184D3DA24B7D5A600A05369 /* ActionAlertModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionAlertModel.swift; sourceTree = ""; }; - 0184D3FC24BE54A300A05369 /* UIAlertActionStyle+Codable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIAlertActionStyle+Codable.swift"; sourceTree = ""; }; - 0184D3FE24BE554A00A05369 /* AlertModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertModel.swift; sourceTree = ""; }; 01C851CE23CF7B260021F976 /* JSONMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONMap.swift; sourceTree = ""; }; 01C851D023CF97FE0021F976 /* ActionBackModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionBackModel.swift; sourceTree = ""; }; 01DF561321F90ADC00CC099B /* Dictionary+MFConvenience.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Dictionary+MFConvenience.swift"; sourceTree = ""; }; @@ -163,7 +156,6 @@ 0A11030B20864F94008ADD90 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; 0A11030C20864F9A008ADD90 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/Localizable.strings"; sourceTree = ""; }; 0A42538E23F3414800554656 /* Codable+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Codable+Helpers.swift"; sourceTree = ""; }; - 0A62624724C1DFDC00C316B9 /* UIAlertControllerStyle+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIAlertControllerStyle+Extension.swift"; sourceTree = ""; }; 0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionShareModel.swift; sourceTree = ""; }; 30349BEF1FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreSessionTimeHandler.h; sourceTree = ""; }; 30349BF01FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreSessionTimeHandler.m; sourceTree = ""; }; @@ -296,15 +288,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 0A62624624C1DFB700C316B9 /* Alert Extensions */ = { - isa = PBXGroup; - children = ( - 0184D3FC24BE54A300A05369 /* UIAlertActionStyle+Codable.swift */, - 0A62624724C1DFDC00C316B9 /* UIAlertControllerStyle+Extension.swift */, - ); - path = "Alert Extensions"; - sourceTree = ""; - }; 8876D5BF1FB50A9E00EB2E3D = { isa = PBXGroup; children = ( @@ -424,11 +407,9 @@ 946EE1B6237B66630036751F /* ActionType */ = { isa = PBXGroup; children = ( - 0A62624624C1DFB700C316B9 /* Alert Extensions */, 01F2A03523A80A7300D954D8 /* ActionModelProtocol.swift */, 946EE1BB237B691A0036751F /* ActionOpenPageModel.swift */, 01F2A03823A812DD00D954D8 /* ActionOpenUrlModel.swift */, - 0184D3DA24B7D5A600A05369 /* ActionAlertModel.swift */, 01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */, 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */, 01C851D023CF97FE0021F976 /* ActionBackModel.swift */, @@ -438,7 +419,6 @@ 94C014D424211AF0005811A9 /* ActionCancelModel.swift */, 94C014D824212360005811A9 /* ActionSettingModel.swift */, BB780ADE250F8C890030BD2F /* ActionNoopModel.swift */, - 0184D3FE24BE554A00A05369 /* AlertModel.swift */, ); path = ActionType; sourceTree = ""; @@ -816,7 +796,6 @@ 01F2A03623A80A7300D954D8 /* ActionModelProtocol.swift in Sources */, AFBB96991FBA3A9A0008D868 /* MVMCoreAlertController.m in Sources */, 881D26941FCC9D180079C521 /* MVMCoreOperation.m in Sources */, - 0184D3FD24BE54A300A05369 /* UIAlertActionStyle+Codable.swift in Sources */, AFED77A41FCCA29400BAE689 /* MVMCoreViewControllerMappingObject.m in Sources */, 01C851CF23CF7B260021F976 /* JSONMap.swift in Sources */, 01F2A04C23A82B1B00D954D8 /* ActionCallModel.swift in Sources */, @@ -836,17 +815,14 @@ 30349BF21FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m in Sources */, D2DEDCB923C6400600C44CC4 /* UnitInterval.swift in Sources */, 94C014D3242119E6005811A9 /* ActionPreviousSubmitModel.swift in Sources */, - 0184D3FF24BE554A00A05369 /* AlertModel.swift in Sources */, 8876D5E91FB50AB000EB2E3D /* NSArray+MFConvenience.m in Sources */, 946EE1B2237B5F260036751F /* JSONValue.swift in Sources */, AFBB96971FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.m in Sources */, 01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */, - 0A62624824C1DFDC00C316B9 /* UIAlertControllerStyle+Extension.swift in Sources */, AF43A5781FBA5B7C008E9347 /* MVMCoreJSONConstants.m in Sources */, AFBB96691FBA3A570008D868 /* MVMCoreRequestParameters.m in Sources */, AFED77A31FCCA29400BAE689 /* MVMCoreViewControllerNibMappingObject.m in Sources */, 8876D5EB1FB50AB000EB2E3D /* NSDecimalNumber+MFConvenience.m in Sources */, - 0184D3DB24B7D5A600A05369 /* ActionAlertModel.swift in Sources */, 01F2A03923A812DD00D954D8 /* ActionOpenUrlModel.swift in Sources */, AFBB96351FBA34310008D868 /* MVMCoreErrorConstants.m in Sources */, AF43A5881FBB67D6008E9347 /* MVMCoreActionUtility.m in Sources */, diff --git a/MVMCore/MVMCore/Models/ActionType/Alert Extensions/UIAlertActionStyle+Codable.swift b/MVMCore/MVMCore/Models/ActionType/Alert Extensions/UIAlertActionStyle+Codable.swift deleted file mode 100644 index 266a305..0000000 --- a/MVMCore/MVMCore/Models/ActionType/Alert Extensions/UIAlertActionStyle+Codable.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// UIAlertActionStyle+Codable.swift -// MVMCore -// -// Created by Suresh, Kamlesh on 7/14/20. -// Copyright © 2020 myverizon. All rights reserved. -// - - -extension UIAlertAction.Style: Codable { - - init(rawValue: String) { - switch rawValue { - case "default": - self = .default - - case "cancel": - self = .cancel - - case "destructive": - self = .destructive - - default: - self = .default - } - } - - var rawValueString: String { - switch self { - case .default: - return "default" - - case .cancel: - return "cancel" - - case .destructive: - return "destructive" - - @unknown default: - return "default" - } - } -} diff --git a/MVMCore/MVMCore/Models/ActionType/Alert Extensions/UIAlertControllerStyle+Extension.swift b/MVMCore/MVMCore/Models/ActionType/Alert Extensions/UIAlertControllerStyle+Extension.swift deleted file mode 100644 index 1de084a..0000000 --- a/MVMCore/MVMCore/Models/ActionType/Alert Extensions/UIAlertControllerStyle+Extension.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// UIAlertControllerStyle+Extension.swift -// MVMCore -// -// Created by Kevin Christiano on 7/17/20. -// Copyright © 2020 myverizon. All rights reserved. -// - - -extension UIAlertController.Style: Codable { - - init(rawValue: String) { - switch rawValue { - case "alert": - self = .alert - - case "actionSheet": - self = .actionSheet - - default: - self = .alert - } - } - - var rawValueString: String { - switch self { - case .alert: - return "alert" - - case .actionSheet: - return "actionSheet" - - @unknown default: - return "alert" - } - } -} diff --git a/MVMCore/MVMCore/Models/ActionType/AlertModel.swift b/MVMCore/MVMCore/Models/ActionType/AlertModel.swift deleted file mode 100644 index 866bfb3..0000000 --- a/MVMCore/MVMCore/Models/ActionType/AlertModel.swift +++ /dev/null @@ -1,116 +0,0 @@ -// -// AlertModel.swift -// MVMCore -// -// Created by Suresh, Kamlesh on 7/14/20. -// Copyright © 2020 myverizon. All rights reserved. -// - -import UIKit - - -public class AlertButtonModel: Codable { - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public var title: String - public var action: ActionModelProtocol - public var style: UIAlertAction.Style = .default - - //-------------------------------------------------- - // MARK: - Initializer - //-------------------------------------------------- - - public init(_ title: String,_ action: ActionModelProtocol,_ style: UIAlertAction.Style = .default) { - self.title = title - self.action = action - self.style = style - } - - //-------------------------------------------------- - // MARK: - Keys - //-------------------------------------------------- - - private enum CodingKeys: String, CodingKey { - case title - case action - case style - } - - //-------------------------------------------------- - // MARK: - Codec - //-------------------------------------------------- - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - title = try typeContainer.decode(String.self, forKey: .title) - - if let style = try typeContainer.decodeIfPresent(String.self, forKey: .style) { - self.style = UIAlertAction.Style(rawValue: style) - } - action = try typeContainer.decodeModel(codingKey: .action) - } - - open func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(title, forKey: .title) - try container.encode(style.rawValueString, forKey: .style) - try container.encodeModel(action, forKey: .action) - } -} - -public class AlertModel: Codable { - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public var title: String - public var message: String - public var style: UIAlertController.Style = .alert - public var alertActions: [AlertButtonModel] - - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public init(_ title: String,_ message: String,_ alertActions: [AlertButtonModel]) { - self.title = title - self.message = message - self.alertActions = alertActions - } - - //-------------------------------------------------- - // MARK: - Keys - //-------------------------------------------------- - - private enum CodingKeys: String, CodingKey { - case title - case message - case alertActions - case style - } - - //-------------------------------------------------- - // MARK: - Codec - //-------------------------------------------------- - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - title = try typeContainer.decode(String.self, forKey: .title) - message = try typeContainer.decode(String.self, forKey: .message) - alertActions = try typeContainer.decode([AlertButtonModel].self, forKey: .alertActions) - - if let style = try typeContainer.decodeIfPresent(String.self, forKey: .style) { - self.style = UIAlertController.Style(rawValue: style) - } - } - - open func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(title, forKey: .title) - try container.encode(message, forKey: .message) - try container.encode(alertActions, forKey: .alertActions) - try container.encode(style.rawValueString, forKey: .style) - } -} diff --git a/MVMCore/MVMCore/Models/ModelMapping.swift b/MVMCore/MVMCore/Models/ModelMapping.swift index 21ff0c1..74acf80 100644 --- a/MVMCore/MVMCore/Models/ModelMapping.swift +++ b/MVMCore/MVMCore/Models/ModelMapping.swift @@ -14,14 +14,12 @@ import Foundation try? ModelRegistry.register(ActionOpenPageModel.self) try? ModelRegistry.register(ActionOpenUrlModel.self) try? ModelRegistry.register(ActionCallModel.self) - try? ModelRegistry.register(ActionPopupModel.self) try? ModelRegistry.register(ActionBackModel.self) try? ModelRegistry.register(ActionShareModel.self) try? ModelRegistry.register(ActionRestartModel.self) try? ModelRegistry.register(ActionPreviousSubmitModel.self) try? ModelRegistry.register(ActionCancelModel.self) try? ModelRegistry.register(ActionSettingModel.self) - try? ModelRegistry.register(ActionAlertModel.self) try? ModelRegistry.register(ActionNoopModel.self) } }