From 1eda14b2efb233ce2bdfa7a31c663d6d7be25c3e Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 13 Mar 2020 10:04:47 -0400 Subject: [PATCH 01/13] swift --- .../MainProtocols/MVMCoreViewManagerViewControllerProtocol.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerViewControllerProtocol.h b/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerViewControllerProtocol.h index 70b8c4b..ff48b90 100644 --- a/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerViewControllerProtocol.h +++ b/MVMCore/MVMCore/MainProtocols/MVMCoreViewManagerViewControllerProtocol.h @@ -17,10 +17,10 @@ @property (nullable, weak, nonatomic) UIViewController *manager; // Notifies the view controller that it can be ready (usually means that it's committed to the screen). -- (void)viewControllerReadyInManager:(nonnull NSObject *)manager; +- (void)viewControllerReadyInManager:(nonnull UIViewController *)manager; // Notifies the current showing view controller that the manager is disappearing. -- (void)managerWillDisappear:(nonnull NSObject *)manager; +- (void)managerWillDisappear:(nonnull UIViewController *)manager; // Manager can check if the view controller does not want to be cached. You should be following proper caching techniques (caching, updating when needed, deleting when needed), so this should be a last resort. - (BOOL)shouldCacheInManager; From 6f525537198607c6d002f98f471926a53529e958 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Tue, 17 Mar 2020 11:34:15 -0400 Subject: [PATCH 02/13] add new action models --- MVMCore/MVMCore.xcodeproj/project.pbxproj | 24 +++++++++++++ .../Models/ActionType/ActionCancelModel.swift | 21 +++++++++++ .../ActionCollapseNotificationModel.swift | 21 +++++++++++ .../ActionPreviousSubmitModel.swift | 21 +++++++++++ .../ActionType/ActionRedirectModel.swift | 35 +++++++++++++++++++ .../ActionType/ActionRestartModel.swift | 24 +++++++++++++ .../ActionType/ActionSettingModel.swift | 24 +++++++++++++ 7 files changed, 170 insertions(+) create mode 100644 MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift create mode 100644 MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift create mode 100644 MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift create mode 100644 MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift create mode 100644 MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift create mode 100644 MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index 5fe1c2a..faac7a3 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -57,6 +57,12 @@ 946EE1B2237B5F260036751F /* JSONValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 946EE1B1237B5F260036751F /* JSONValue.swift */; }; 946EE1B4237B619D0036751F /* Encoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 946EE1B3237B619D0036751F /* Encoder.swift */; }; 946EE1BC237B691A0036751F /* ActionOpenPageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 946EE1BB237B691A0036751F /* ActionOpenPageModel.swift */; }; + 94C014D124211869005811A9 /* ActionRestartModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D024211869005811A9 /* ActionRestartModel.swift */; }; + 94C014D3242119E6005811A9 /* ActionPreviousSubmitModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D2242119E6005811A9 /* ActionPreviousSubmitModel.swift */; }; + 94C014D524211AF0005811A9 /* ActionCancelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D424211AF0005811A9 /* ActionCancelModel.swift */; }; + 94C014D724211DB2005811A9 /* ActionRedirectModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D624211DB2005811A9 /* ActionRedirectModel.swift */; }; + 94C014D924212360005811A9 /* ActionSettingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D824212360005811A9 /* ActionSettingModel.swift */; }; + 94C014DB24212410005811A9 /* ActionCollapseNotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014DA24212410005811A9 /* ActionCollapseNotificationModel.swift */; }; A332F33F20C7231700DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h in Headers */ = {isa = PBXBuildFile; fileRef = A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF1201832108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF26DDAE1FCE6A37004E8F65 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF26DDB01FCE6A37004E8F65 /* Localizable.strings */; }; @@ -208,6 +214,12 @@ 946EE1B1237B5F260036751F /* JSONValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONValue.swift; sourceTree = ""; }; 946EE1B3237B619D0036751F /* Encoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Encoder.swift; sourceTree = ""; }; 946EE1BB237B691A0036751F /* ActionOpenPageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionOpenPageModel.swift; sourceTree = ""; }; + 94C014D024211869005811A9 /* ActionRestartModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionRestartModel.swift; sourceTree = ""; }; + 94C014D2242119E6005811A9 /* ActionPreviousSubmitModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionPreviousSubmitModel.swift; sourceTree = ""; }; + 94C014D424211AF0005811A9 /* ActionCancelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCancelModel.swift; sourceTree = ""; }; + 94C014D624211DB2005811A9 /* ActionRedirectModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionRedirectModel.swift; sourceTree = ""; }; + 94C014D824212360005811A9 /* ActionSettingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionSettingModel.swift; sourceTree = ""; }; + 94C014DA24212410005811A9 /* ActionCollapseNotificationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCollapseNotificationModel.swift; sourceTree = ""; }; A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewControllerAnimatedTransitioning.h; sourceTree = ""; }; AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewManagerViewControllerProtocol.h; sourceTree = ""; }; AF26DDAF1FCE6A37004E8F65 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; @@ -463,6 +475,12 @@ 01C851D023CF97FE0021F976 /* ActionBackModel.swift */, EAE09C5D23F4389600765089 /* ActionOpenPanelModel.swift */, 0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */, + 94C014D024211869005811A9 /* ActionRestartModel.swift */, + 94C014D2242119E6005811A9 /* ActionPreviousSubmitModel.swift */, + 94C014D424211AF0005811A9 /* ActionCancelModel.swift */, + 94C014D624211DB2005811A9 /* ActionRedirectModel.swift */, + 94C014D824212360005811A9 /* ActionSettingModel.swift */, + 94C014DA24212410005811A9 /* ActionCollapseNotificationModel.swift */, ); path = ActionType; sourceTree = ""; @@ -904,10 +922,13 @@ 946EE1BC237B691A0036751F /* ActionOpenPageModel.swift in Sources */, AFBB96A61FBA3A9A0008D868 /* MVMCoreTopAlertOperation.m in Sources */, 0A42538F23F3414800554656 /* Codable+Helpers.swift in Sources */, + 94C014DB24212410005811A9 /* ActionCollapseNotificationModel.swift in Sources */, 881D26931FCC9D180079C521 /* MVMCoreErrorObject.m in Sources */, + 94C014D124211869005811A9 /* ActionRestartModel.swift in Sources */, 946EE1B0237B5EF70036751F /* JSONHelper.swift in Sources */, 30349BF21FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m in Sources */, D2DEDCB923C6400600C44CC4 /* UnitInterval.swift in Sources */, + 94C014D3242119E6005811A9 /* ActionPreviousSubmitModel.swift in Sources */, 8876D5E91FB50AB000EB2E3D /* NSArray+MFConvenience.m in Sources */, 946EE1B2237B5F260036751F /* JSONValue.swift in Sources */, EAE09C5E23F4389600765089 /* ActionOpenPanelModel.swift in Sources */, @@ -928,11 +949,13 @@ AFBB965D1FBA3A570008D868 /* MFFreebeeHandler.m in Sources */, 0AFF597A23FC6E60005C24E8 /* ActionShareModel.swift in Sources */, AFEEE81F1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.m in Sources */, + 94C014D724211DB2005811A9 /* ActionRedirectModel.swift in Sources */, 01F2A05223A8325100D954D8 /* ModelMapping.swift in Sources */, AFBB969E1FBA3A9A0008D868 /* MVMCoreAlertObject.m in Sources */, 8876D5F51FB50AB000EB2E3D /* UILabel+MFCustom.m in Sources */, AFBB96B31FBA3B590008D868 /* MVMCoreGetterUtility.m in Sources */, AF43A7071FC4D7A2008E9347 /* MVMCoreObject.m in Sources */, + 94C014D924212360005811A9 /* ActionSettingModel.swift in Sources */, D2DEDCB723C63F3B00C44CC4 /* Clamping.swift in Sources */, 01DF561421F90ADC00CC099B /* Dictionary+MFConvenience.swift in Sources */, AFBB96B11FBA3B590008D868 /* MVMCoreDispatchUtility.m in Sources */, @@ -948,6 +971,7 @@ AFBB96611FBA3A570008D868 /* MVMCoreLoadObject.m in Sources */, 946EE1B4237B619D0036751F /* Encoder.swift in Sources */, AFBB96941FBA3A9A0008D868 /* MVMCorePresentAnimationOperation.m in Sources */, + 94C014D524211AF0005811A9 /* ActionCancelModel.swift in Sources */, AF43A5841FBB66DE008E9347 /* MVMCoreConstants.m in Sources */, D2DEDCBB23C65BC300C44CC4 /* Percent.swift in Sources */, AFBB966A1FBA3A570008D868 /* MVMCoreLoadRequestOperation.m in Sources */, diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift new file mode 100644 index 0000000..189dcb1 --- /dev/null +++ b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift @@ -0,0 +1,21 @@ +// +// ActionCancelModel.swift +// MVMCore +// +// Created by Ryan on 3/17/20. +// Copyright © 2020 myverizon. All rights reserved. +// + +import UIKit + +@objcMembers public class ActionCancelModel: ActionModelProtocol { + public static var identifier: String = "cancel" + + public var actionType: String? + + public var extraParameters: JSONValueDictionary? + + public var analyticsData: JSONValueDictionary? + + public var title: String? +} diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift new file mode 100644 index 0000000..17799ec --- /dev/null +++ b/MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift @@ -0,0 +1,21 @@ +// +// ActionCollapseNotificationModel.swift +// MVMCore +// +// Created by Ryan on 3/17/20. +// Copyright © 2020 myverizon. All rights reserved. +// + +import UIKit + +@objcMembers public class ActionCollapseNotificationModel: ActionModelProtocol { + public static var identifier: String = "collapseNotification" + + public var actionType: String? + + public var extraParameters: JSONValueDictionary? + + public var analyticsData: JSONValueDictionary? + + public var title: String? +} diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift new file mode 100644 index 0000000..54e423d --- /dev/null +++ b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift @@ -0,0 +1,21 @@ +// +// ActionPreviousSubmitModel.swift +// MVMCore +// +// Created by Ryan on 3/17/20. +// Copyright © 2020 myverizon. All rights reserved. +// + +import UIKit + +@objcMembers public class ActionPreviousSubmitModel: ActionModelProtocol { + public static var identifier: String = "previousSubmit" + + public var actionType: String? + + public var extraParameters: JSONValueDictionary? + + public var analyticsData: JSONValueDictionary? + + public var title: String? +} diff --git a/MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift new file mode 100644 index 0000000..3fe3d69 --- /dev/null +++ b/MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift @@ -0,0 +1,35 @@ +// +// ActionRedirectModel.swift +// MVMCore +// +// Created by Ryan on 3/17/20. +// Copyright © 2020 myverizon. All rights reserved. +// + +import UIKit + +@objcMembers public class ActionRedirectModel: ActionModelProtocol { + public static var identifier: String = "switchApp" + + public var actionType: String? + + public var extraParameters: JSONValueDictionary? + + public var analyticsData: JSONValueDictionary? + + public var title: String? + + ///appContext should be value of "mfrc", "mobileFirstSS", "mfPrepaySS", "mfCT" + public var appContext: MVMAppContext? = ActionRedirectModel.MVMAppContext.none + + ///Optional pageType, if pageType is nil, will direct to pageType launchApp + public var pageType: String? + + public enum MVMAppContext: String, Codable { + case mfrc + case mobileFirstSS + case mfPrepaySS + case mfCT + case none + } +} diff --git a/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift new file mode 100644 index 0000000..bba379f --- /dev/null +++ b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift @@ -0,0 +1,24 @@ +// +// ActionRestartModel.swift +// MVMCore +// +// Created by Ryan on 3/17/20. +// Copyright © 2020 myverizon. All rights reserved. +// + +import UIKit + +@objcMembers public class ActionRestartModel: ActionModelProtocol { + public static var identifier: String = "restart" + + 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 new file mode 100644 index 0000000..9adb382 --- /dev/null +++ b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift @@ -0,0 +1,24 @@ +// +// ActionSettingModel.swift +// MVMCore +// +// Created by Ryan on 3/17/20. +// Copyright © 2020 myverizon. All rights reserved. +// + +import UIKit + +@objcMembers public class ActionSettingModel: ActionModelProtocol { + public static var identifier: String = "openSettings" + + public var actionType: String? + + public var extraParameters: JSONValueDictionary? + + public var analyticsData: JSONValueDictionary? + + public var title: String? + + ///String type for pageType, currently only support "location" and "push" + public var pageType: String +} From 1bad7f56397bcbc23681366a716280160b8584ff Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Tue, 17 Mar 2020 12:40:03 -0400 Subject: [PATCH 03/13] add new actions --- MVMCore/MVMCore/Models/ModelMapping.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MVMCore/MVMCore/Models/ModelMapping.swift b/MVMCore/MVMCore/Models/ModelMapping.swift index 4209a3b..370be2a 100644 --- a/MVMCore/MVMCore/Models/ModelMapping.swift +++ b/MVMCore/MVMCore/Models/ModelMapping.swift @@ -20,5 +20,11 @@ import Foundation try? ModelRegistry.register(ActionBackModel.self) try? ModelRegistry.register(ActionOpenPanelModel.self) try? ModelRegistry.register(ActionShareModel.self) + try? ModelRegistry.register(ActionRestartModel.self) + try? ModelRegistry.register(ActionPreviousSubmitModel.self) + try? ModelRegistry.register(ActionCancelModel.self) + try? ModelRegistry.register(ActionRedirectModel.self) + try? ModelRegistry.register(ActionSettingModel.self) + try? ModelRegistry.register(ActionCollapseNotificationModel.self) } } From 68b805a4173a39bbc6dda7cb06b139d8665caea5 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Tue, 17 Mar 2020 15:06:34 -0400 Subject: [PATCH 04/13] move position of some action model --- MVMCore/MVMCore.xcodeproj/project.pbxproj | 12 ------- .../ActionCollapseNotificationModel.swift | 21 ----------- .../ActionType/ActionRedirectModel.swift | 35 ------------------- .../ActionType/ActionTopAlertModel.swift | 24 ------------- MVMCore/MVMCore/Models/ModelMapping.swift | 3 -- 5 files changed, 95 deletions(-) delete mode 100644 MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift delete mode 100644 MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift delete mode 100644 MVMCore/MVMCore/Models/ActionType/ActionTopAlertModel.swift diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index faac7a3..e74076e 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -29,7 +29,6 @@ 01F2A03B23A8159900D954D8 /* ActionOpenAppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A03A23A8159900D954D8 /* ActionOpenAppModel.swift */; }; 01F2A04C23A82B1B00D954D8 /* ActionCallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */; }; 01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */; }; - 01F2A05023A82D0800D954D8 /* ActionTopAlertModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04F23A82D0800D954D8 /* ActionTopAlertModel.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 */; }; 0AFF597A23FC6E60005C24E8 /* ActionShareModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */; }; @@ -60,9 +59,7 @@ 94C014D124211869005811A9 /* ActionRestartModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D024211869005811A9 /* ActionRestartModel.swift */; }; 94C014D3242119E6005811A9 /* ActionPreviousSubmitModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D2242119E6005811A9 /* ActionPreviousSubmitModel.swift */; }; 94C014D524211AF0005811A9 /* ActionCancelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D424211AF0005811A9 /* ActionCancelModel.swift */; }; - 94C014D724211DB2005811A9 /* ActionRedirectModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D624211DB2005811A9 /* ActionRedirectModel.swift */; }; 94C014D924212360005811A9 /* ActionSettingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D824212360005811A9 /* ActionSettingModel.swift */; }; - 94C014DB24212410005811A9 /* ActionCollapseNotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014DA24212410005811A9 /* ActionCollapseNotificationModel.swift */; }; A332F33F20C7231700DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h in Headers */ = {isa = PBXBuildFile; fileRef = A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF1201832108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF26DDAE1FCE6A37004E8F65 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF26DDB01FCE6A37004E8F65 /* Localizable.strings */; }; @@ -182,7 +179,6 @@ 01F2A03A23A8159900D954D8 /* ActionOpenAppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionOpenAppModel.swift; sourceTree = ""; }; 01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCallModel.swift; sourceTree = ""; }; 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionPopupModel.swift; sourceTree = ""; }; - 01F2A04F23A82D0800D954D8 /* ActionTopAlertModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionTopAlertModel.swift; sourceTree = ""; }; 01F2A05123A8325100D954D8 /* ModelMapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelMapping.swift; sourceTree = ""; }; 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 = ""; }; @@ -217,9 +213,7 @@ 94C014D024211869005811A9 /* ActionRestartModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionRestartModel.swift; sourceTree = ""; }; 94C014D2242119E6005811A9 /* ActionPreviousSubmitModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionPreviousSubmitModel.swift; sourceTree = ""; }; 94C014D424211AF0005811A9 /* ActionCancelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCancelModel.swift; sourceTree = ""; }; - 94C014D624211DB2005811A9 /* ActionRedirectModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionRedirectModel.swift; sourceTree = ""; }; 94C014D824212360005811A9 /* ActionSettingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionSettingModel.swift; sourceTree = ""; }; - 94C014DA24212410005811A9 /* ActionCollapseNotificationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCollapseNotificationModel.swift; sourceTree = ""; }; A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewControllerAnimatedTransitioning.h; sourceTree = ""; }; AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewManagerViewControllerProtocol.h; sourceTree = ""; }; AF26DDAF1FCE6A37004E8F65 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; @@ -471,16 +465,13 @@ 01F2A03A23A8159900D954D8 /* ActionOpenAppModel.swift */, 01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */, 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */, - 01F2A04F23A82D0800D954D8 /* ActionTopAlertModel.swift */, 01C851D023CF97FE0021F976 /* ActionBackModel.swift */, EAE09C5D23F4389600765089 /* ActionOpenPanelModel.swift */, 0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */, 94C014D024211869005811A9 /* ActionRestartModel.swift */, 94C014D2242119E6005811A9 /* ActionPreviousSubmitModel.swift */, 94C014D424211AF0005811A9 /* ActionCancelModel.swift */, - 94C014D624211DB2005811A9 /* ActionRedirectModel.swift */, 94C014D824212360005811A9 /* ActionSettingModel.swift */, - 94C014DA24212410005811A9 /* ActionCollapseNotificationModel.swift */, ); path = ActionType; sourceTree = ""; @@ -922,7 +913,6 @@ 946EE1BC237B691A0036751F /* ActionOpenPageModel.swift in Sources */, AFBB96A61FBA3A9A0008D868 /* MVMCoreTopAlertOperation.m in Sources */, 0A42538F23F3414800554656 /* Codable+Helpers.swift in Sources */, - 94C014DB24212410005811A9 /* ActionCollapseNotificationModel.swift in Sources */, 881D26931FCC9D180079C521 /* MVMCoreErrorObject.m in Sources */, 94C014D124211869005811A9 /* ActionRestartModel.swift in Sources */, 946EE1B0237B5EF70036751F /* JSONHelper.swift in Sources */, @@ -949,7 +939,6 @@ AFBB965D1FBA3A570008D868 /* MFFreebeeHandler.m in Sources */, 0AFF597A23FC6E60005C24E8 /* ActionShareModel.swift in Sources */, AFEEE81F1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.m in Sources */, - 94C014D724211DB2005811A9 /* ActionRedirectModel.swift in Sources */, 01F2A05223A8325100D954D8 /* ModelMapping.swift in Sources */, AFBB969E1FBA3A9A0008D868 /* MVMCoreAlertObject.m in Sources */, 8876D5F51FB50AB000EB2E3D /* UILabel+MFCustom.m in Sources */, @@ -960,7 +949,6 @@ 01DF561421F90ADC00CC099B /* Dictionary+MFConvenience.swift in Sources */, AFBB96B11FBA3B590008D868 /* MVMCoreDispatchUtility.m in Sources */, 946EE1A3237B59C30036751F /* ModelProtocol.swift in Sources */, - 01F2A05023A82D0800D954D8 /* ActionTopAlertModel.swift in Sources */, AFBB965B1FBA3A570008D868 /* FreeBeeUrlObject.m in Sources */, AFEA17A9209B6A1C00BC6740 /* MVMCoreBlockOperation.m in Sources */, AF43A70A1FC4F415008E9347 /* MVMCoreCache.m in Sources */, diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift deleted file mode 100644 index 17799ec..0000000 --- a/MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// ActionCollapseNotificationModel.swift -// MVMCore -// -// Created by Ryan on 3/17/20. -// Copyright © 2020 myverizon. All rights reserved. -// - -import UIKit - -@objcMembers public class ActionCollapseNotificationModel: ActionModelProtocol { - public static var identifier: String = "collapseNotification" - - public var actionType: String? - - public var extraParameters: JSONValueDictionary? - - public var analyticsData: JSONValueDictionary? - - public var title: String? -} diff --git a/MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift deleted file mode 100644 index 3fe3d69..0000000 --- a/MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// ActionRedirectModel.swift -// MVMCore -// -// Created by Ryan on 3/17/20. -// Copyright © 2020 myverizon. All rights reserved. -// - -import UIKit - -@objcMembers public class ActionRedirectModel: ActionModelProtocol { - public static var identifier: String = "switchApp" - - public var actionType: String? - - public var extraParameters: JSONValueDictionary? - - public var analyticsData: JSONValueDictionary? - - public var title: String? - - ///appContext should be value of "mfrc", "mobileFirstSS", "mfPrepaySS", "mfCT" - public var appContext: MVMAppContext? = ActionRedirectModel.MVMAppContext.none - - ///Optional pageType, if pageType is nil, will direct to pageType launchApp - public var pageType: String? - - public enum MVMAppContext: String, Codable { - case mfrc - case mobileFirstSS - case mfPrepaySS - case mfCT - case none - } -} diff --git a/MVMCore/MVMCore/Models/ActionType/ActionTopAlertModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionTopAlertModel.swift deleted file mode 100644 index 54746f3..0000000 --- a/MVMCore/MVMCore/Models/ActionType/ActionTopAlertModel.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// ActionTopAlertModel.swift -// MVMCore -// -// Created by Suresh, Kamlesh on 12/16/19. -// Copyright © 2019 myverizon. All rights reserved. -// - -import Foundation - -@objcMembers public class ActionTopAlertModel: ActionModelProtocol { - - public static var identifier: String = "topAlert" - public var actionType: String? = ActionTopAlertModel.identifier - public var pageType: String - public var extraParameters: JSONValueDictionary? - public var analyticsData: JSONValueDictionary? - // Temporary fix till server changes - public var title: String? - - public init(pageType: String) { - self.pageType = pageType - } -} diff --git a/MVMCore/MVMCore/Models/ModelMapping.swift b/MVMCore/MVMCore/Models/ModelMapping.swift index 370be2a..93b6da3 100644 --- a/MVMCore/MVMCore/Models/ModelMapping.swift +++ b/MVMCore/MVMCore/Models/ModelMapping.swift @@ -16,15 +16,12 @@ import Foundation try? ModelRegistry.register(ActionOpenAppModel.self) try? ModelRegistry.register(ActionCallModel.self) try? ModelRegistry.register(ActionPopupModel.self) - try? ModelRegistry.register(ActionTopAlertModel.self) try? ModelRegistry.register(ActionBackModel.self) try? ModelRegistry.register(ActionOpenPanelModel.self) try? ModelRegistry.register(ActionShareModel.self) try? ModelRegistry.register(ActionRestartModel.self) try? ModelRegistry.register(ActionPreviousSubmitModel.self) try? ModelRegistry.register(ActionCancelModel.self) - try? ModelRegistry.register(ActionRedirectModel.self) try? ModelRegistry.register(ActionSettingModel.self) - try? ModelRegistry.register(ActionCollapseNotificationModel.self) } } From 92584d935fe7df26ab736a7114e645b3a9fbfe0f Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Tue, 17 Mar 2020 16:17:58 -0400 Subject: [PATCH 05/13] add codable method to avoid set actionType value --- .../Models/ActionType/ActionBackModel.swift | 24 ++++++++- .../Models/ActionType/ActionCallModel.swift | 27 +++++++++- .../Models/ActionType/ActionCancelModel.swift | 22 ++++++++ .../ActionType/ActionOpenAppModel.swift | 27 +++++++++- .../ActionType/ActionOpenPageModel.swift | 30 ++++++++++- .../ActionType/ActionOpenPanelModel.swift | 27 +++++++++- .../ActionType/ActionOpenUrlModel.swift | 52 ++++++++++++++++++- .../Models/ActionType/ActionPopupModel.swift | 27 +++++++++- .../ActionPreviousSubmitModel.swift | 22 ++++++++ .../ActionType/ActionRestartModel.swift | 25 +++++++++ .../ActionType/ActionSettingModel.swift | 25 +++++++++ .../Models/ActionType/ActionShareModel.swift | 28 ++++++++++ 12 files changed, 329 insertions(+), 7 deletions(-) diff --git a/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift index 62f325a..a858f6c 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift @@ -10,9 +10,31 @@ import Foundation @objcMembers public class ActionBackModel: ActionModelProtocol { public static var identifier: String = "back" - public var actionType: String? = ActionBackModel.identifier + public var actionType: String? public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? // Temporary fix till server changes public var title: String? + + public enum CodingKeys: String, CodingKey { + case actionType + case title + case extraParameters + case analyticsData + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift index 92f2847..b00c486 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionCallModel: ActionModelProtocol { public static var identifier: String = "call" - public var actionType: String? = ActionCallModel.identifier + public var actionType: String? public var callNumber: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? @@ -20,4 +20,29 @@ import Foundation public init(callNumber: String) { self.callNumber = callNumber } + + public enum CodingKeys: String, CodingKey { + case actionType + case callNumber + case title + case extraParameters + case analyticsData + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + callNumber = try typeContainer.decode(String.self, forKey: .callNumber) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encode(callNumber, forKey: .callNumber) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift index 189dcb1..7d82385 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift @@ -18,4 +18,26 @@ import UIKit public var analyticsData: JSONValueDictionary? public var title: String? + + public enum CodingKeys: String, CodingKey { + case actionType + case title + case extraParameters + case analyticsData + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift index 04e1794..a6b9724 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionOpenAppModel: ActionModelProtocol { public static var identifier: String = "openApp" - public var actionType: String? = ActionOpenAppModel.identifier + public var actionType: String? public var appURL: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? @@ -20,4 +20,29 @@ import Foundation public init(appURL: String) { self.appURL = appURL } + + public enum CodingKeys: String, CodingKey { + case actionType + case appURL + case title + case extraParameters + case analyticsData + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + appURL = try typeContainer.decode(String.self, forKey: .appURL) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encode(appURL, forKey: .appURL) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift index 30ba794..862cc2c 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionOpenPageModel: ActionModelProtocol { public static var identifier: String = "openPage" - public var actionType: String? = ActionOpenPageModel.identifier + public var actionType: String? public var pageType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? @@ -22,4 +22,32 @@ import Foundation public init(pageType: String) { self.pageType = pageType } + + public enum CodingKeys: String, CodingKey { + case actionType + case pageType + case title + case extraParameters + case analyticsData + case presentationStyle + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + pageType = try typeContainer.decode(String.self, forKey: .pageType) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + presentationStyle = try typeContainer.decodeIfPresent(String.self, forKey: .presentationStyle) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encode(pageType, forKey: .pageType) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + try encoderContainer.encodeIfPresent(presentationStyle, forKey: .presentationStyle) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift index 02d31fc..765ddbe 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionOpenPanelModel: ActionModelProtocol { public static var identifier: String = "openPanel" - public var actionType: String? = ActionOpenPanelModel.identifier + public var actionType: String? public var panel: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? @@ -20,4 +20,29 @@ import Foundation public init(panel: String) { self.panel = panel } + + public enum CodingKeys: String, CodingKey { + case actionType + case panel + case title + case extraParameters + case analyticsData + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + panel = try typeContainer.decode(String.self, forKey: .panel) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encode(panel, forKey: .panel) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift index d0b4f30..20a2e73 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionOpenUrlModel: ActionModelProtocol { public static var identifier: String = "openURL" - public var actionType: String? = ActionOpenUrlModel.identifier + public var actionType: String? public var browserUrl: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? @@ -31,4 +31,54 @@ import Foundation public init(browserUrl: String) { self.browserUrl = browserUrl } + + public enum CodingKeys: String, CodingKey { + case actionType + case browserUrl + case title + case extraParameters + case analyticsData + + case openOauthWebView + case showNativeNavigation + case openInWebview + case customUserAgent + case postRequest + case dontShowProgress + case headerParameters + + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + browserUrl = try typeContainer.decode(String.self, forKey: .browserUrl) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + + openOauthWebView = try typeContainer.decodeIfPresent(Bool.self, forKey: .openOauthWebView) + showNativeNavigation = try typeContainer.decodeIfPresent(Bool.self, forKey: .showNativeNavigation) + openInWebview = try typeContainer.decodeIfPresent(Bool.self, forKey: .openInWebview) + customUserAgent = try typeContainer.decodeIfPresent(String.self, forKey: .customUserAgent) + postRequest = try typeContainer.decodeIfPresent(Bool.self, forKey: .postRequest) + dontShowProgress = try typeContainer.decodeIfPresent(Bool.self, forKey: .dontShowProgress) + headerParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .headerParameters) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encode(browserUrl, forKey: .browserUrl) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + + try encoderContainer.encodeIfPresent(openOauthWebView, forKey: .openOauthWebView) + try encoderContainer.encodeIfPresent(showNativeNavigation, forKey: .showNativeNavigation) + try encoderContainer.encodeIfPresent(openInWebview, forKey: .openInWebview) + try encoderContainer.encodeIfPresent(customUserAgent, forKey: .customUserAgent) + try encoderContainer.encodeIfPresent(postRequest, forKey: .postRequest) + try encoderContainer.encodeIfPresent(dontShowProgress, forKey: .dontShowProgress) + try encoderContainer.encodeIfPresent(headerParameters, forKey: .headerParameters) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift index 2aee75f..861dcde 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift @@ -11,7 +11,7 @@ import Foundation @objcMembers public class ActionPopupModel: ActionModelProtocol { public static var identifier: String = "popup" - public var actionType: String? = ActionPopupModel.identifier + public var actionType: String? public var title: String? public var pageType: String public var extraParameters: JSONValueDictionary? @@ -19,4 +19,29 @@ import Foundation public init(pageType: String) { self.pageType = pageType } + + public enum CodingKeys: String, CodingKey { + case actionType + case pageType + case title + case extraParameters + case analyticsData + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + pageType = try typeContainer.decode(String.self, forKey: .pageType) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encode(pageType, forKey: .pageType) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift index 54e423d..9f61beb 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift @@ -18,4 +18,26 @@ import UIKit public var analyticsData: JSONValueDictionary? public var title: String? + + public enum CodingKeys: String, CodingKey { + case actionType + case title + case extraParameters + case analyticsData + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift index bba379f..429e4af 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift @@ -21,4 +21,29 @@ import UIKit ///Optional pageType, if pageType is nil, will start with pageType launchApp public var pageType: String? + + public enum CodingKeys: String, CodingKey { + case actionType + case pageType + case title + case extraParameters + case analyticsData + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + pageType = try typeContainer.decodeIfPresent(String.self, forKey: .pageType) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encodeIfPresent(pageType, forKey: .pageType) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift index 9adb382..e5e8a43 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift @@ -21,4 +21,29 @@ import UIKit ///String type for pageType, currently only support "location" and "push" public var pageType: String + + public enum CodingKeys: String, CodingKey { + case actionType + case pageType + case title + case extraParameters + case analyticsData + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + pageType = try typeContainer.decode(String.self, forKey: .pageType) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encode(pageType, forKey: .pageType) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift index c40fbcd..c81b7e1 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift @@ -30,4 +30,32 @@ import UIKit self.sharedType = sharedType self.sharedText = sharedText } + + public enum CodingKeys: String, CodingKey { + case actionType + case sharedType + case sharedText + case title + case extraParameters + case analyticsData + } + + public required init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + sharedType = try typeContainer.decode(String.self, forKey: .sharedType) + sharedText = try typeContainer.decode(String.self, forKey: .sharedText) + title = try typeContainer.decodeIfPresent(String.self, forKey: .title) + extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) + } + + public func encode(to encoder: Encoder) throws { + var encoderContainer = encoder.container(keyedBy: CodingKeys.self) + try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) + try encoderContainer.encode(sharedType, forKey: .sharedType) + try encoderContainer.encode(sharedText, forKey: .sharedText) + try encoderContainer.encodeIfPresent(title, forKey: .title) + try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) + try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) + } } From d30b21bbd7e0391a0837a232f5e9ba5885467c3e Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Tue, 17 Mar 2020 16:59:30 -0400 Subject: [PATCH 06/13] remove encode, decode method since actionType already handled by default encode behavior --- .../Models/ActionType/ActionBackModel.swift | 22 -------- .../Models/ActionType/ActionCallModel.swift | 25 ---------- .../Models/ActionType/ActionCancelModel.swift | 22 -------- .../ActionType/ActionOpenAppModel.swift | 25 ---------- .../ActionType/ActionOpenPageModel.swift | 28 ----------- .../ActionType/ActionOpenPanelModel.swift | 29 ----------- .../ActionType/ActionOpenUrlModel.swift | 50 ------------------- .../Models/ActionType/ActionPopupModel.swift | 25 ---------- .../ActionPreviousSubmitModel.swift | 22 -------- .../ActionType/ActionRestartModel.swift | 25 ---------- .../ActionType/ActionSettingModel.swift | 25 ---------- .../Models/ActionType/ActionShareModel.swift | 28 ----------- 12 files changed, 326 deletions(-) diff --git a/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift index a858f6c..7c903ff 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift @@ -15,26 +15,4 @@ import Foundation public var analyticsData: JSONValueDictionary? // Temporary fix till server changes public var title: String? - - public enum CodingKeys: String, CodingKey { - case actionType - case title - case extraParameters - case analyticsData - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift index b00c486..a579e63 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift @@ -20,29 +20,4 @@ import Foundation public init(callNumber: String) { self.callNumber = callNumber } - - public enum CodingKeys: String, CodingKey { - case actionType - case callNumber - case title - case extraParameters - case analyticsData - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - callNumber = try typeContainer.decode(String.self, forKey: .callNumber) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encode(callNumber, forKey: .callNumber) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift index 7d82385..189dcb1 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift @@ -18,26 +18,4 @@ import UIKit public var analyticsData: JSONValueDictionary? public var title: String? - - public enum CodingKeys: String, CodingKey { - case actionType - case title - case extraParameters - case analyticsData - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift index a6b9724..cd774fa 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift @@ -20,29 +20,4 @@ import Foundation public init(appURL: String) { self.appURL = appURL } - - public enum CodingKeys: String, CodingKey { - case actionType - case appURL - case title - case extraParameters - case analyticsData - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - appURL = try typeContainer.decode(String.self, forKey: .appURL) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encode(appURL, forKey: .appURL) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift index 862cc2c..0675684 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift @@ -22,32 +22,4 @@ import Foundation public init(pageType: String) { self.pageType = pageType } - - public enum CodingKeys: String, CodingKey { - case actionType - case pageType - case title - case extraParameters - case analyticsData - case presentationStyle - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - pageType = try typeContainer.decode(String.self, forKey: .pageType) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - presentationStyle = try typeContainer.decodeIfPresent(String.self, forKey: .presentationStyle) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encode(pageType, forKey: .pageType) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - try encoderContainer.encodeIfPresent(presentationStyle, forKey: .presentationStyle) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift index 765ddbe..bd55540 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift @@ -16,33 +16,4 @@ import Foundation public var analyticsData: JSONValueDictionary? // Temporary fix till server changes public var title: String? - - public init(panel: String) { - self.panel = panel - } - - public enum CodingKeys: String, CodingKey { - case actionType - case panel - case title - case extraParameters - case analyticsData - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - panel = try typeContainer.decode(String.self, forKey: .panel) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encode(panel, forKey: .panel) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift index 20a2e73..bf4ca8f 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift @@ -31,54 +31,4 @@ import Foundation public init(browserUrl: String) { self.browserUrl = browserUrl } - - public enum CodingKeys: String, CodingKey { - case actionType - case browserUrl - case title - case extraParameters - case analyticsData - - case openOauthWebView - case showNativeNavigation - case openInWebview - case customUserAgent - case postRequest - case dontShowProgress - case headerParameters - - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - browserUrl = try typeContainer.decode(String.self, forKey: .browserUrl) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - - openOauthWebView = try typeContainer.decodeIfPresent(Bool.self, forKey: .openOauthWebView) - showNativeNavigation = try typeContainer.decodeIfPresent(Bool.self, forKey: .showNativeNavigation) - openInWebview = try typeContainer.decodeIfPresent(Bool.self, forKey: .openInWebview) - customUserAgent = try typeContainer.decodeIfPresent(String.self, forKey: .customUserAgent) - postRequest = try typeContainer.decodeIfPresent(Bool.self, forKey: .postRequest) - dontShowProgress = try typeContainer.decodeIfPresent(Bool.self, forKey: .dontShowProgress) - headerParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .headerParameters) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encode(browserUrl, forKey: .browserUrl) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - - try encoderContainer.encodeIfPresent(openOauthWebView, forKey: .openOauthWebView) - try encoderContainer.encodeIfPresent(showNativeNavigation, forKey: .showNativeNavigation) - try encoderContainer.encodeIfPresent(openInWebview, forKey: .openInWebview) - try encoderContainer.encodeIfPresent(customUserAgent, forKey: .customUserAgent) - try encoderContainer.encodeIfPresent(postRequest, forKey: .postRequest) - try encoderContainer.encodeIfPresent(dontShowProgress, forKey: .dontShowProgress) - try encoderContainer.encodeIfPresent(headerParameters, forKey: .headerParameters) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift index 861dcde..68366fe 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift @@ -19,29 +19,4 @@ import Foundation public init(pageType: String) { self.pageType = pageType } - - public enum CodingKeys: String, CodingKey { - case actionType - case pageType - case title - case extraParameters - case analyticsData - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - pageType = try typeContainer.decode(String.self, forKey: .pageType) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encode(pageType, forKey: .pageType) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift index 9f61beb..54e423d 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift @@ -18,26 +18,4 @@ import UIKit public var analyticsData: JSONValueDictionary? public var title: String? - - public enum CodingKeys: String, CodingKey { - case actionType - case title - case extraParameters - case analyticsData - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift index 429e4af..bba379f 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift @@ -21,29 +21,4 @@ import UIKit ///Optional pageType, if pageType is nil, will start with pageType launchApp public var pageType: String? - - public enum CodingKeys: String, CodingKey { - case actionType - case pageType - case title - case extraParameters - case analyticsData - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - pageType = try typeContainer.decodeIfPresent(String.self, forKey: .pageType) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encodeIfPresent(pageType, forKey: .pageType) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift index e5e8a43..9adb382 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift @@ -21,29 +21,4 @@ import UIKit ///String type for pageType, currently only support "location" and "push" public var pageType: String - - public enum CodingKeys: String, CodingKey { - case actionType - case pageType - case title - case extraParameters - case analyticsData - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - pageType = try typeContainer.decode(String.self, forKey: .pageType) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encode(pageType, forKey: .pageType) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift index c81b7e1..c40fbcd 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift @@ -30,32 +30,4 @@ import UIKit self.sharedType = sharedType self.sharedText = sharedText } - - public enum CodingKeys: String, CodingKey { - case actionType - case sharedType - case sharedText - case title - case extraParameters - case analyticsData - } - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - sharedType = try typeContainer.decode(String.self, forKey: .sharedType) - sharedText = try typeContainer.decode(String.self, forKey: .sharedText) - title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters) - analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) - } - - public func encode(to encoder: Encoder) throws { - var encoderContainer = encoder.container(keyedBy: CodingKeys.self) - try encoderContainer.encodeIfPresent(actionType, forKey: .actionType) - try encoderContainer.encode(sharedType, forKey: .sharedType) - try encoderContainer.encode(sharedText, forKey: .sharedText) - try encoderContainer.encodeIfPresent(title, forKey: .title) - try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters) - try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData) - } } From a7e3c8c1d1983de699cb4e4c9f4d5a4e51342eea Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 18 Mar 2020 13:25:44 -0400 Subject: [PATCH 07/13] cleanup --- MVMCore/MVMCore.xcodeproj/project.pbxproj | 16 --------- .../Models/ActionType/ActionBackModel.swift | 2 +- .../Models/ActionType/ActionCallModel.swift | 3 +- .../Models/ActionType/ActionCancelModel.swift | 4 --- .../ActionCollapseNotificationModel.swift | 21 ----------- .../ActionType/ActionModelProtocol.swift | 2 +- .../ActionType/ActionOpenAppModel.swift | 3 +- .../ActionType/ActionOpenPageModel.swift | 2 +- .../ActionType/ActionOpenPanelModel.swift | 23 ------------ .../ActionType/ActionOpenUrlModel.swift | 3 +- .../Models/ActionType/ActionPopupModel.swift | 3 +- .../ActionPreviousSubmitModel.swift | 4 --- .../ActionType/ActionRedirectModel.swift | 35 ------------------- .../ActionType/ActionRestartModel.swift | 4 --- .../ActionType/ActionSettingModel.swift | 7 ---- .../ActionType/ActionTopAlertModel.swift | 24 ------------- MVMCore/MVMCore/Models/ModelMapping.swift | 4 --- 17 files changed, 10 insertions(+), 150 deletions(-) delete mode 100644 MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift delete mode 100644 MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift delete mode 100644 MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift delete mode 100644 MVMCore/MVMCore/Models/ActionType/ActionTopAlertModel.swift diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index faac7a3..16cb154 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -29,7 +29,6 @@ 01F2A03B23A8159900D954D8 /* ActionOpenAppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A03A23A8159900D954D8 /* ActionOpenAppModel.swift */; }; 01F2A04C23A82B1B00D954D8 /* ActionCallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */; }; 01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */; }; - 01F2A05023A82D0800D954D8 /* ActionTopAlertModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04F23A82D0800D954D8 /* ActionTopAlertModel.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 */; }; 0AFF597A23FC6E60005C24E8 /* ActionShareModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */; }; @@ -60,9 +59,7 @@ 94C014D124211869005811A9 /* ActionRestartModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D024211869005811A9 /* ActionRestartModel.swift */; }; 94C014D3242119E6005811A9 /* ActionPreviousSubmitModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D2242119E6005811A9 /* ActionPreviousSubmitModel.swift */; }; 94C014D524211AF0005811A9 /* ActionCancelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D424211AF0005811A9 /* ActionCancelModel.swift */; }; - 94C014D724211DB2005811A9 /* ActionRedirectModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D624211DB2005811A9 /* ActionRedirectModel.swift */; }; 94C014D924212360005811A9 /* ActionSettingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014D824212360005811A9 /* ActionSettingModel.swift */; }; - 94C014DB24212410005811A9 /* ActionCollapseNotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C014DA24212410005811A9 /* ActionCollapseNotificationModel.swift */; }; A332F33F20C7231700DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h in Headers */ = {isa = PBXBuildFile; fileRef = A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF1201832108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF26DDAE1FCE6A37004E8F65 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF26DDB01FCE6A37004E8F65 /* Localizable.strings */; }; @@ -170,7 +167,6 @@ D2DEDCB923C6400600C44CC4 /* UnitInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCB823C6400600C44CC4 /* UnitInterval.swift */; }; D2DEDCBB23C65BC300C44CC4 /* Percent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCBA23C65BC300C44CC4 /* Percent.swift */; }; D2E1FAD92260C3E400AEFD8C /* DelegateObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FAD82260C3E400AEFD8C /* DelegateObject.swift */; }; - EAE09C5E23F4389600765089 /* ActionOpenPanelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAE09C5D23F4389600765089 /* ActionOpenPanelModel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -182,7 +178,6 @@ 01F2A03A23A8159900D954D8 /* ActionOpenAppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionOpenAppModel.swift; sourceTree = ""; }; 01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCallModel.swift; sourceTree = ""; }; 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionPopupModel.swift; sourceTree = ""; }; - 01F2A04F23A82D0800D954D8 /* ActionTopAlertModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionTopAlertModel.swift; sourceTree = ""; }; 01F2A05123A8325100D954D8 /* ModelMapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelMapping.swift; sourceTree = ""; }; 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 = ""; }; @@ -217,9 +212,7 @@ 94C014D024211869005811A9 /* ActionRestartModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionRestartModel.swift; sourceTree = ""; }; 94C014D2242119E6005811A9 /* ActionPreviousSubmitModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionPreviousSubmitModel.swift; sourceTree = ""; }; 94C014D424211AF0005811A9 /* ActionCancelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCancelModel.swift; sourceTree = ""; }; - 94C014D624211DB2005811A9 /* ActionRedirectModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionRedirectModel.swift; sourceTree = ""; }; 94C014D824212360005811A9 /* ActionSettingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionSettingModel.swift; sourceTree = ""; }; - 94C014DA24212410005811A9 /* ActionCollapseNotificationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCollapseNotificationModel.swift; sourceTree = ""; }; A332F33E20C7231600DCD9D9 /* MVMCoreViewControllerAnimatedTransitioning.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewControllerAnimatedTransitioning.h; sourceTree = ""; }; AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewManagerViewControllerProtocol.h; sourceTree = ""; }; AF26DDAF1FCE6A37004E8F65 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; @@ -331,7 +324,6 @@ D2DEDCB823C6400600C44CC4 /* UnitInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnitInterval.swift; sourceTree = ""; }; D2DEDCBA23C65BC300C44CC4 /* Percent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Percent.swift; sourceTree = ""; }; D2E1FAD82260C3E400AEFD8C /* DelegateObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DelegateObject.swift; sourceTree = ""; }; - EAE09C5D23F4389600765089 /* ActionOpenPanelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionOpenPanelModel.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -471,16 +463,12 @@ 01F2A03A23A8159900D954D8 /* ActionOpenAppModel.swift */, 01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */, 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */, - 01F2A04F23A82D0800D954D8 /* ActionTopAlertModel.swift */, 01C851D023CF97FE0021F976 /* ActionBackModel.swift */, - EAE09C5D23F4389600765089 /* ActionOpenPanelModel.swift */, 0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */, 94C014D024211869005811A9 /* ActionRestartModel.swift */, 94C014D2242119E6005811A9 /* ActionPreviousSubmitModel.swift */, 94C014D424211AF0005811A9 /* ActionCancelModel.swift */, - 94C014D624211DB2005811A9 /* ActionRedirectModel.swift */, 94C014D824212360005811A9 /* ActionSettingModel.swift */, - 94C014DA24212410005811A9 /* ActionCollapseNotificationModel.swift */, ); path = ActionType; sourceTree = ""; @@ -922,7 +910,6 @@ 946EE1BC237B691A0036751F /* ActionOpenPageModel.swift in Sources */, AFBB96A61FBA3A9A0008D868 /* MVMCoreTopAlertOperation.m in Sources */, 0A42538F23F3414800554656 /* Codable+Helpers.swift in Sources */, - 94C014DB24212410005811A9 /* ActionCollapseNotificationModel.swift in Sources */, 881D26931FCC9D180079C521 /* MVMCoreErrorObject.m in Sources */, 94C014D124211869005811A9 /* ActionRestartModel.swift in Sources */, 946EE1B0237B5EF70036751F /* JSONHelper.swift in Sources */, @@ -931,7 +918,6 @@ 94C014D3242119E6005811A9 /* ActionPreviousSubmitModel.swift in Sources */, 8876D5E91FB50AB000EB2E3D /* NSArray+MFConvenience.m in Sources */, 946EE1B2237B5F260036751F /* JSONValue.swift in Sources */, - EAE09C5E23F4389600765089 /* ActionOpenPanelModel.swift in Sources */, AFBB96971FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.m in Sources */, AFBB96581FBA3A570008D868 /* FreeBeeAuthObject.m in Sources */, 01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */, @@ -949,7 +935,6 @@ AFBB965D1FBA3A570008D868 /* MFFreebeeHandler.m in Sources */, 0AFF597A23FC6E60005C24E8 /* ActionShareModel.swift in Sources */, AFEEE81F1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.m in Sources */, - 94C014D724211DB2005811A9 /* ActionRedirectModel.swift in Sources */, 01F2A05223A8325100D954D8 /* ModelMapping.swift in Sources */, AFBB969E1FBA3A9A0008D868 /* MVMCoreAlertObject.m in Sources */, 8876D5F51FB50AB000EB2E3D /* UILabel+MFCustom.m in Sources */, @@ -960,7 +945,6 @@ 01DF561421F90ADC00CC099B /* Dictionary+MFConvenience.swift in Sources */, AFBB96B11FBA3B590008D868 /* MVMCoreDispatchUtility.m in Sources */, 946EE1A3237B59C30036751F /* ModelProtocol.swift in Sources */, - 01F2A05023A82D0800D954D8 /* ActionTopAlertModel.swift in Sources */, AFBB965B1FBA3A570008D868 /* FreeBeeUrlObject.m in Sources */, AFEA17A9209B6A1C00BC6740 /* MVMCoreBlockOperation.m in Sources */, AF43A70A1FC4F415008E9347 /* MVMCoreCache.m in Sources */, diff --git a/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift index 62f325a..7c903ff 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionBackModel: ActionModelProtocol { public static var identifier: String = "back" - public var actionType: String? = ActionBackModel.identifier + public var actionType: String? public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? // Temporary fix till server changes diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift index 92f2847..e0b431b 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift @@ -10,7 +10,8 @@ import Foundation @objcMembers public class ActionCallModel: ActionModelProtocol { public static var identifier: String = "call" - public var actionType: String? = ActionCallModel.identifier + public var actionType: String? + // TODO: decode into phone number once action handler is re-written public var callNumber: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift index 189dcb1..bf208f4 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift @@ -10,12 +10,8 @@ import UIKit @objcMembers public class ActionCancelModel: ActionModelProtocol { public static var identifier: String = "cancel" - public var actionType: String? - public var extraParameters: JSONValueDictionary? - public var analyticsData: JSONValueDictionary? - public var title: String? } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift deleted file mode 100644 index 17799ec..0000000 --- a/MVMCore/MVMCore/Models/ActionType/ActionCollapseNotificationModel.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// ActionCollapseNotificationModel.swift -// MVMCore -// -// Created by Ryan on 3/17/20. -// Copyright © 2020 myverizon. All rights reserved. -// - -import UIKit - -@objcMembers public class ActionCollapseNotificationModel: ActionModelProtocol { - public static var identifier: String = "collapseNotification" - - 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 66f8586..29120da 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionModelProtocol.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionModelProtocol.swift @@ -10,7 +10,7 @@ import Foundation public protocol ActionModelProtocol: ModelProtocol { - var actionType: String? { get set } + var actionType: String? { get } var extraParameters: JSONValueDictionary? { get set } var analyticsData: JSONValueDictionary? { get set } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift index 04e1794..674d313 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift @@ -10,7 +10,8 @@ import Foundation @objcMembers public class ActionOpenAppModel: ActionModelProtocol { public static var identifier: String = "openApp" - public var actionType: String? = ActionOpenAppModel.identifier + public var actionType: String? + // TODO: decode into url once action handler is re-written public var appURL: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift index 30ba794..0675684 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionOpenPageModel: ActionModelProtocol { public static var identifier: String = "openPage" - public var actionType: String? = ActionOpenPageModel.identifier + public var actionType: String? public var pageType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift deleted file mode 100644 index 02d31fc..0000000 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenPanelModel.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// ActionOpenPanelModel.swift -// MVMCore -// -// Created by Khan, Arshad on 12/02/20. -// Copyright © 2020 myverizon. All rights reserved. -// - -import Foundation - -@objcMembers public class ActionOpenPanelModel: ActionModelProtocol { - public static var identifier: String = "openPanel" - public var actionType: String? = ActionOpenPanelModel.identifier - public var panel: String - public var extraParameters: JSONValueDictionary? - public var analyticsData: JSONValueDictionary? - // Temporary fix till server changes - public var title: String? - - public init(panel: String) { - self.panel = panel - } -} diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift index d0b4f30..fb13643 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift @@ -10,7 +10,8 @@ import Foundation @objcMembers public class ActionOpenUrlModel: ActionModelProtocol { public static var identifier: String = "openURL" - public var actionType: String? = ActionOpenUrlModel.identifier + public var actionType: String? + // TODO: decode into url once action handler is re-written public var browserUrl: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift index 2aee75f..899f782 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift @@ -9,9 +9,8 @@ import Foundation @objcMembers public class ActionPopupModel: ActionModelProtocol { - public static var identifier: String = "popup" - public var actionType: String? = ActionPopupModel.identifier + public var actionType: String? public var title: String? public var pageType: String public var extraParameters: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift index 54e423d..151ee51 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift @@ -10,12 +10,8 @@ import UIKit @objcMembers public class ActionPreviousSubmitModel: ActionModelProtocol { public static var identifier: String = "previousSubmit" - public var actionType: String? - public var extraParameters: JSONValueDictionary? - public var analyticsData: JSONValueDictionary? - public var title: String? } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift deleted file mode 100644 index 3fe3d69..0000000 --- a/MVMCore/MVMCore/Models/ActionType/ActionRedirectModel.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// ActionRedirectModel.swift -// MVMCore -// -// Created by Ryan on 3/17/20. -// Copyright © 2020 myverizon. All rights reserved. -// - -import UIKit - -@objcMembers public class ActionRedirectModel: ActionModelProtocol { - public static var identifier: String = "switchApp" - - public var actionType: String? - - public var extraParameters: JSONValueDictionary? - - public var analyticsData: JSONValueDictionary? - - public var title: String? - - ///appContext should be value of "mfrc", "mobileFirstSS", "mfPrepaySS", "mfCT" - public var appContext: MVMAppContext? = ActionRedirectModel.MVMAppContext.none - - ///Optional pageType, if pageType is nil, will direct to pageType launchApp - public var pageType: String? - - public enum MVMAppContext: String, Codable { - case mfrc - case mobileFirstSS - case mfPrepaySS - case mfCT - case none - } -} diff --git a/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift index bba379f..e524c66 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift @@ -10,13 +10,9 @@ import UIKit @objcMembers public class ActionRestartModel: ActionModelProtocol { public static var identifier: String = "restart" - 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 diff --git a/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift index 9adb382..cfc2c36 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift @@ -10,15 +10,8 @@ import UIKit @objcMembers public class ActionSettingModel: ActionModelProtocol { public static var identifier: String = "openSettings" - public var actionType: String? - public var extraParameters: JSONValueDictionary? - public var analyticsData: JSONValueDictionary? - public var title: String? - - ///String type for pageType, currently only support "location" and "push" - public var pageType: String } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionTopAlertModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionTopAlertModel.swift deleted file mode 100644 index 54746f3..0000000 --- a/MVMCore/MVMCore/Models/ActionType/ActionTopAlertModel.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// ActionTopAlertModel.swift -// MVMCore -// -// Created by Suresh, Kamlesh on 12/16/19. -// Copyright © 2019 myverizon. All rights reserved. -// - -import Foundation - -@objcMembers public class ActionTopAlertModel: ActionModelProtocol { - - public static var identifier: String = "topAlert" - public var actionType: String? = ActionTopAlertModel.identifier - public var pageType: String - public var extraParameters: JSONValueDictionary? - public var analyticsData: JSONValueDictionary? - // Temporary fix till server changes - public var title: String? - - public init(pageType: String) { - self.pageType = pageType - } -} diff --git a/MVMCore/MVMCore/Models/ModelMapping.swift b/MVMCore/MVMCore/Models/ModelMapping.swift index 370be2a..b0e9bc4 100644 --- a/MVMCore/MVMCore/Models/ModelMapping.swift +++ b/MVMCore/MVMCore/Models/ModelMapping.swift @@ -16,15 +16,11 @@ import Foundation try? ModelRegistry.register(ActionOpenAppModel.self) try? ModelRegistry.register(ActionCallModel.self) try? ModelRegistry.register(ActionPopupModel.self) - try? ModelRegistry.register(ActionTopAlertModel.self) try? ModelRegistry.register(ActionBackModel.self) - try? ModelRegistry.register(ActionOpenPanelModel.self) try? ModelRegistry.register(ActionShareModel.self) try? ModelRegistry.register(ActionRestartModel.self) try? ModelRegistry.register(ActionPreviousSubmitModel.self) try? ModelRegistry.register(ActionCancelModel.self) - try? ModelRegistry.register(ActionRedirectModel.self) try? ModelRegistry.register(ActionSettingModel.self) - try? ModelRegistry.register(ActionCollapseNotificationModel.self) } } From 9b2812bc39343be9bb4efca35b2e7dd8203ff147 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 18 Mar 2020 13:28:51 -0400 Subject: [PATCH 08/13] remove unnecessary settings check --- .../ActionHandling/MVMCoreActionHandler.m | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 2b046df..8eff939 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -300,15 +300,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; } - (void)settingsAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject { - // Opens the settings. - NSString *type = [actionInformation string:KeyPageType]; - if ([@"location" isEqualToString:type] || [@"push" isEqualToString:type]) { - [MVMCoreActionUtility linkAway:UIApplicationOpenSettingsURLString appURLString:nil]; - } else { - // No known settings type - MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess] code:ErrorCodeInvalidSettingType domain:ErrorDomainNative location:[NSString stringWithFormat:@"%@_%@",NSStringFromClass([delegateObject.actionDelegate class]),KeyActionTypeSettings]]; - [self handleActionError:error actionInformation:actionInformation additionalData:additionalData delegateObject:delegateObject]; - } + [MVMCoreActionUtility linkAway:UIApplicationOpenSettingsURLString appURLString:nil]; } - (void)collapseNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject { @@ -640,14 +632,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; - (void)settingsAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate { // Opens the settings. - NSString *type = [actionInformation string:KeyPageType]; - if ([@"location" isEqualToString:type] || [@"push" isEqualToString:type]) { - [MVMCoreActionUtility linkAway:UIApplicationOpenSettingsURLString appURLString:nil]; - } else { - // No known settings type - MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess] code:ErrorCodeInvalidSettingType domain:ErrorDomainNative location:[NSString stringWithFormat:@"%@_%@",NSStringFromClass([delegate class]),KeyActionTypeSettings]]; - [self handleActionError:error actionInformation:actionInformation additionalData:additionalData delegate:delegate]; - } + [MVMCoreActionUtility linkAway:UIApplicationOpenSettingsURLString appURLString:nil]; } - (void)collapseNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate { From a4149911e505d9073b7aa9ef71363de1c5bcb993 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 18 Mar 2020 13:45:23 -0400 Subject: [PATCH 09/13] no more fake settings --- MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m index 2b046df..e01a34d 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.m @@ -640,14 +640,7 @@ NSString * const KeyActionTypeOpen = @"openPage"; - (void)settingsAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate { // Opens the settings. - NSString *type = [actionInformation string:KeyPageType]; - if ([@"location" isEqualToString:type] || [@"push" isEqualToString:type]) { - [MVMCoreActionUtility linkAway:UIApplicationOpenSettingsURLString appURLString:nil]; - } else { - // No known settings type - MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess] code:ErrorCodeInvalidSettingType domain:ErrorDomainNative location:[NSString stringWithFormat:@"%@_%@",NSStringFromClass([delegate class]),KeyActionTypeSettings]]; - [self handleActionError:error actionInformation:actionInformation additionalData:additionalData delegate:delegate]; - } + [MVMCoreActionUtility linkAway:UIApplicationOpenSettingsURLString appURLString:nil]; } - (void)collapseNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject *)delegate { From 8da16fe18bd3b8cb7a526db2081362df388d1c86 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 19 Mar 2020 16:28:35 -0400 Subject: [PATCH 10/13] required identifiers --- MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift | 2 +- MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift | 2 +- MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift | 2 +- MVMCore/MVMCore/Models/ActionType/ActionModelProtocol.swift | 4 ++-- MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift | 2 +- MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift | 2 +- MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift | 2 +- MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift | 2 +- .../MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift | 2 +- MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift | 2 +- MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift | 2 +- MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift index 7c903ff..72b84f7 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionBackModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionBackModel: ActionModelProtocol { public static var identifier: String = "back" - public var actionType: String? + public var actionType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? // Temporary fix till server changes diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift index e0b431b..3f13e6a 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionCallModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionCallModel: ActionModelProtocol { public static var identifier: String = "call" - public var actionType: String? + public var actionType: String = ActionCallModel.identifier // TODO: decode into phone number once action handler is re-written public var callNumber: String public var extraParameters: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift index bf208f4..08bf63c 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionCancelModel.swift @@ -10,7 +10,7 @@ import UIKit @objcMembers public class ActionCancelModel: ActionModelProtocol { public static var identifier: String = "cancel" - public var actionType: String? + 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 29120da..dc36409 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionModelProtocol.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionModelProtocol.swift @@ -10,7 +10,7 @@ import Foundation public protocol ActionModelProtocol: ModelProtocol { - var actionType: String? { get } + var actionType: String { get } var extraParameters: JSONValueDictionary? { get set } var analyticsData: JSONValueDictionary? { get set } @@ -20,7 +20,7 @@ public protocol ActionModelProtocol: ModelProtocol { public extension ActionModelProtocol { - var actionType: String? { + var actionType: String { get { return Self.identifier } } diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift index 674d313..9614bc8 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenAppModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionOpenAppModel: ActionModelProtocol { public static var identifier: String = "openApp" - public var actionType: String? + public var actionType: String = ActionOpenAppModel.identifier // TODO: decode into url once action handler is re-written public var appURL: String public var extraParameters: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift index 0675684..413adf8 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenPageModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionOpenPageModel: ActionModelProtocol { public static var identifier: String = "openPage" - public var actionType: String? + public var actionType: String = ActionOpenPageModel.identifier public var pageType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift index fb13643..fc8c11f 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionOpenUrlModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionOpenUrlModel: ActionModelProtocol { public static var identifier: String = "openURL" - public var actionType: String? + public var actionType: String = ActionOpenUrlModel.identifier // TODO: decode into url once action handler is re-written public var browserUrl: String public var extraParameters: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift index 899f782..eaff84c 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionPopupModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class ActionPopupModel: ActionModelProtocol { public static var identifier: String = "popup" - public var actionType: String? + public var actionType: String = ActionPopupModel.identifier public var title: String? public var pageType: String public var extraParameters: JSONValueDictionary? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift index 151ee51..f6d5ad7 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionPreviousSubmitModel.swift @@ -10,7 +10,7 @@ import UIKit @objcMembers public class ActionPreviousSubmitModel: ActionModelProtocol { public static var identifier: String = "previousSubmit" - public var actionType: String? + 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 e524c66..0cdbae3 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionRestartModel.swift @@ -10,7 +10,7 @@ import UIKit @objcMembers public class ActionRestartModel: ActionModelProtocol { public static var identifier: String = "restart" - public var actionType: String? + public var actionType: String public var extraParameters: JSONValueDictionary? public var analyticsData: JSONValueDictionary? public var title: String? diff --git a/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift index cfc2c36..212b526 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionSettingModel.swift @@ -10,7 +10,7 @@ import UIKit @objcMembers public class ActionSettingModel: ActionModelProtocol { public static var identifier: String = "openSettings" - public var actionType: String? + 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 c40fbcd..16da245 100644 --- a/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/ActionShareModel.swift @@ -15,7 +15,7 @@ import UIKit public static var identifier: String = "share" - public var actionType: String? + public var actionType: String = ActionShareModel.identifier public var title: String? public var sharedType: String public var sharedText: String From fa48923e1fd251a43267c47f77eacd547a8b9c33 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 20 Mar 2020 10:20:01 -0400 Subject: [PATCH 11/13] remove comment out --- MVMCore/MVMCore/Models/JSON/JSONValue.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MVMCore/MVMCore/Models/JSON/JSONValue.swift b/MVMCore/MVMCore/Models/JSON/JSONValue.swift index 4c44839..25474eb 100644 --- a/MVMCore/MVMCore/Models/JSON/JSONValue.swift +++ b/MVMCore/MVMCore/Models/JSON/JSONValue.swift @@ -70,11 +70,11 @@ public enum JSONValue: Codable, Equatable { } } -//public func ==(lhs: JSONValue, rhs: JSONValue) -> Bool { -// let ld = try! lhs.encode() -// let rd = try! lhs.encode() -// return ld == rd -//} +public func ==(lhs: JSONValue, rhs: JSONValue) -> Bool { + let ld = try! lhs.encode() + let rd = try! rhs.encode() + return ld == rd +} extension JSONValue: ExpressibleByStringLiteral { public init(stringLiteral value: String) { From bab662149201a83fa350622f5e08d9348b80e7a3 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 20 Mar 2020 10:21:06 -0400 Subject: [PATCH 12/13] remove change --- MVMCore/MVMCore/Models/JSON/JSONValue.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCore/MVMCore/Models/JSON/JSONValue.swift b/MVMCore/MVMCore/Models/JSON/JSONValue.swift index 25474eb..a603d23 100644 --- a/MVMCore/MVMCore/Models/JSON/JSONValue.swift +++ b/MVMCore/MVMCore/Models/JSON/JSONValue.swift @@ -71,8 +71,8 @@ public enum JSONValue: Codable, Equatable { } public func ==(lhs: JSONValue, rhs: JSONValue) -> Bool { - let ld = try! lhs.encode() - let rd = try! rhs.encode() + let ld = try? lhs.encode() + let rd = try? rhs.encode() return ld == rd } From df4ee3377ab1188bf8986aab835776f714d9f0cf Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 24 Mar 2020 09:54:18 -0400 Subject: [PATCH 13/13] Warning and analyze fixes --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertOperation.m | 2 +- MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertObject.m | 4 ++-- MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m | 2 +- MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m | 2 +- MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m | 2 +- MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m | 6 +++--- MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h | 2 +- MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m | 2 +- MVMCore/MVMCore/Utility/Helpers/MVMCoreDispatchUtility.h | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertOperation.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertOperation.m index 9e9d35f..5aa9058 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertOperation.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertOperation.m @@ -70,7 +70,7 @@ static void * XXContext = &XXContext; } - (nullable instancetype)initWithAlert:(nonnull UIAlertController *)alert isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { - if ([self initWithAlert:alert isGreedy:isGreedy]) { + if (self = [self initWithAlert:alert isGreedy:isGreedy]) { self.alertDelegate = alertDelegate; } return self; diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertObject.m b/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertObject.m index 6fe372d..45819d4 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertObject.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertObject.m @@ -41,7 +41,7 @@ NSUInteger const TopAlertDismissTime = 5; // The default is yes if not sent by server (for legacy to work as is) NSNumber *closeButton = [responseInfo optionalNumberForKey:KeyCloseButton]; - if (closeButton) { + if (closeButton != nil) { self.useCloseButton = [closeButton boolValue]; } else { self.useCloseButton = YES; @@ -52,7 +52,7 @@ NSUInteger const TopAlertDismissTime = 5; // Server driven dismiss time. if (self.useNewStyle) { NSNumber *topAlertTime = [responseInfo optionalNumberForKey:@"topAlertTime"]; - if (topAlertTime) { + if (topAlertTime != nil) { self.topAlertDismissTime = [topAlertTime integerValue]; } } diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m index 5bf2864..bc1056d 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m @@ -152,7 +152,7 @@ } NSTimeInterval timeOutInterval = 60; - if (requestParameters.customTimeoutTime) { + if (requestParameters.customTimeoutTime != nil) { timeOutInterval = requestParameters.customTimeoutTime.floatValue; } else if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(timeOutIntervalForRequest:)]) { timeOutInterval = [[MVMCoreObject sharedInstance].globalLoadDelegate timeOutIntervalForRequest:requestParameters]; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m index ee459f5..7a52182 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m @@ -62,7 +62,7 @@ - (BOOL)extendsAppSession { NSNumber *extendSessionFlag = [self.responseInfoMap optionalNumberForKey:@"appSessionExtended"]; - return !extendSessionFlag || [extendSessionFlag boolValue]; // Default to YES if the key does not exist. + return extendSessionFlag == nil || [extendSessionFlag boolValue]; // Default to YES if the key does not exist. } #pragma mark - Deprecated diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index c8cd23b..2f4019b 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -824,7 +824,7 @@ if (postCallsDict) { NSArray *actionList = [postCallsDict array:@"actionList"]; //TODO needs to create operation queue based on concurrent flag - BOOL isConcurrent = [postCallsDict boolForKey:@"concurrent"]; + //BOOL isConcurrent = [postCallsDict boolForKey:@"concurrent"]; //Needs further enhancements based on the flags. BOOL shouldTriggerFromCache = [postCallsDict boolForKey:@"shouldTriggerFromCache"]; //Check if page is not from cache diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m index 238b9d9..d7b79a8 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m @@ -220,7 +220,7 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt"; // Adds json to cache with page type key. NSNumber *shouldCache = [jsonDictionary optionalNumberForKey:@"cache"]; - if (!shouldCache || shouldCache.boolValue) { + if (shouldCache == nil || shouldCache.boolValue) { [weakSelf.pageTypeCache setObject:jsonDictionary forKey:pageType]; } } @@ -257,7 +257,7 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt"; // Adds json to cache with page type key. NSNumber *shouldCache = [jsonDictionary optionalNumberForKey:@"cache"]; - if (!shouldCache || shouldCache.boolValue) { + if (shouldCache == nil || shouldCache.boolValue) { [weakSelf.moduleCache setObject:obj forKey:key]; } } @@ -567,7 +567,7 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt"; if (isGif) { [self checkImage:nil imageData:data fallbackImage:fallbackImageName completionHandler:completionHandler]; } else { - UIImage *image = [UIImage imageWithData:data scale:[UIScreen mainScreen].scale]; + UIImage *image = data != nil ? [UIImage imageWithData:data scale:[UIScreen mainScreen].scale] : nil; [self checkImage:image imageData:nil fallbackImage:fallbackImageName completionHandler:completionHandler]; } }]; diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h index bdb0abd..b3abbd8 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h @@ -27,6 +27,6 @@ + (BOOL)classIsInstanceTypeOfClass:(nonnull Class)theClass otherClass:(nonnull Class)otherClass throwException:(BOOL)throwException; // Calls the above function with throw exception yes if the object is not nil. Returns the object. Convenience function for one liner in initializer. -+ (nonnull id)initializerClassCheck:(nullable NSObject *)object classToVerify:(nonnull Class)classToVerify; ++ (nullable id)initializerClassCheck:(nullable NSObject *)object classToVerify:(nonnull Class)classToVerify; @end diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m index 2c6c8f1..6702f00 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m @@ -53,7 +53,7 @@ NSInteger count = [dictionary count]; id __unsafe_unretained objects[count]; id __unsafe_unretained keys[count]; - [dictionary getObjects:objects andKeys:keys]; + [dictionary getObjects:objects andKeys:keys count:count]; for (NSUInteger i = 0; i < count; i++) { id object = objects[i]; NSString *key = keys[i]; diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreDispatchUtility.h b/MVMCore/MVMCore/Utility/Helpers/MVMCoreDispatchUtility.h index 9ee0da1..fd6876a 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreDispatchUtility.h +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreDispatchUtility.h @@ -19,7 +19,7 @@ + (void)performSyncBlockInBackground:(nonnull void (^)(void))block; /// Ensures the block is peformed on the same *labeled* dispatch queue. The queue *must* be previously initialized with a unique label. -+ (void)performBlock:(nonnull void (^)(void))block onQueue:(dispatch_queue_t)queue; ++ (void)performBlock:(nonnull void (^)(void))block onQueue:(nonnull dispatch_queue_t)queue; + (void)performSyncBlock:(nonnull void (^)(void))block onQueue:(nonnull dispatch_queue_t)queue; @end