diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index d394d55d..4e3105bf 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -130,7 +130,7 @@ 1D6D258826899B0C00DEBB08 /* ImageButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6D258626899B0B00DEBB08 /* ImageButtonModel.swift */; }; 1D6D258926899B0C00DEBB08 /* ImageButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6D258726899B0B00DEBB08 /* ImageButton.swift */; }; 22B678F929E7944E00CF4196 /* GetNotificationAuthStatusBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22B678F829E7944E00CF4196 /* GetNotificationAuthStatusBehavior.swift */; }; - 22B678FD29E82B0300CF4196 /* ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22B678FC29E82B0300CF4196 /* ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; + 22B678FD29E82B0300CF4196 /* ListNotificationAuthModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22B678FC29E82B0300CF4196 /* ListNotificationAuthModel.swift */; }; 27559EFC27D691D3000836C1 /* ViewMaskingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27559EFB27D691D3000836C1 /* ViewMaskingProtocol.swift */; }; 27577DCD286CA959001EC47E /* MoleculeMaskingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27577DCC286CA959001EC47E /* MoleculeMaskingProtocol.swift */; }; 279B1569242BBC2F00921D6C /* ActionModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */; }; @@ -742,7 +742,7 @@ 1D6D258626899B0B00DEBB08 /* ImageButtonModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ImageButtonModel.swift; path = MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift; sourceTree = SOURCE_ROOT; }; 1D6D258726899B0B00DEBB08 /* ImageButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ImageButton.swift; path = MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift; sourceTree = SOURCE_ROOT; }; 22B678F829E7944E00CF4196 /* GetNotificationAuthStatusBehavior.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetNotificationAuthStatusBehavior.swift; sourceTree = ""; }; - 22B678FC29E82B0300CF4196 /* ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; + 22B678FC29E82B0300CF4196 /* ListNotificationAuthModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListNotificationAuthModel.swift; sourceTree = ""; }; 27559EFB27D691D3000836C1 /* ViewMaskingProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewMaskingProtocol.swift; sourceTree = ""; }; 27577DCC286CA959001EC47E /* MoleculeMaskingProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeMaskingProtocol.swift; sourceTree = ""; }; 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionModelAdapter.swift; sourceTree = ""; }; @@ -1462,7 +1462,6 @@ 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */, 8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */, 8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */, - 22B678FC29E82B0300CF4196 /* ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel.swift */, ); path = OneColumn; sourceTree = ""; @@ -1601,6 +1600,7 @@ children = ( AAE96FA125341F6A0037A989 /* ListStoreLocatorModel.swift */, AAE96FA425341F7D0037A989 /* ListStoreLocator.swift */, + 22B678FC29E82B0300CF4196 /* ListNotificationAuthModel.swift */, AA7F47722541AD560015A2C1 /* ListStarRatingModel.swift */, AA7F47752541AD6A0015A2C1 /* ListStarRating.swift */, ); @@ -3047,7 +3047,7 @@ 324FB6AC24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift in Sources */, AAA74A172410C04600080241 /* HeadersH2NoButtonsBodyText.swift in Sources */, 522679C223FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift in Sources */, - 22B678FD29E82B0300CF4196 /* ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */, + 22B678FD29E82B0300CF4196 /* ListNotificationAuthModel.swift in Sources */, AA7F32AB246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift in Sources */, 8D084AD02410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift in Sources */, AF60A7F82892D34D00919EEB /* ActionDismissNotificationHandler.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListNotificationAuthModel.swift similarity index 72% rename from MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListNotificationAuthModel.swift index fe0eaf04..9d17b754 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListNotificationAuthModel.swift @@ -8,13 +8,13 @@ import Foundation -public class ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel: ListOneColumnFullWidthTextAllTextAndLinksModel { +public class ListNotificationAuthModel: ListOneColumnFullWidthTextAllTextAndLinksModel { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - public class override var identifier: String { "list1CTxtConsumeNotificationAuth" } - public var enableStatus: String? - public var disableStatus: String? + public class override var identifier: String { "listNotificationAuth" } + public var enableStatus: String + public var disableStatus: String public var enableAction: ActionModelProtocol? public var disableAction: ActionModelProtocol? @@ -32,12 +32,12 @@ public class ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksMod // MARK: - Codec //-------------------------------------------------- required public init(from decoder: Decoder) throws { - try super.init(from: decoder) let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - enableStatus = try typeContainer.decodeIfPresent(String.self, forKey: .enableStatus) - disableStatus = try typeContainer.decodeIfPresent(String.self, forKey: .disableStatus) + enableStatus = try typeContainer.decode(String.self, forKey: .enableStatus) + disableStatus = try typeContainer.decode(String.self, forKey: .disableStatus) enableAction = try typeContainer.decodeModelIfPresent(codingKey: .enableAction) disableAction = try typeContainer.decodeModelIfPresent(codingKey: .disableAction) + try super.init(from: decoder) } public override func encode(to encoder: Encoder) throws { @@ -50,19 +50,19 @@ public class ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksMod } } -extension ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel: PageBehaviorProtocolRequirer { +extension ListNotificationAuthModel: PageBehaviorProtocolRequirer { public func getRequiredBehaviors() -> [PageBehaviorModelProtocol] { [PageGetNotificationAuthStatusBehaviorModel()] } } -extension ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel: PageGetNotificationAuthStatusBehaviorConsumerProtocol { +extension ListNotificationAuthModel: PageGetNotificationAuthStatusBehaviorConsumerProtocol { public func consume(notificationStatus: UNAuthorizationStatus) { if(notificationStatus == .authorized){ - body?.text = enableStatus ?? "" + body?.text = enableStatus action = enableAction } else { - body?.text = disableStatus ?? "" + body?.text = disableStatus action = disableAction } } diff --git a/MVMCoreUI/Behaviors/GetNotificationAuthStatusBehavior.swift b/MVMCoreUI/Behaviors/GetNotificationAuthStatusBehavior.swift index fea35cf7..a3acffdf 100644 --- a/MVMCoreUI/Behaviors/GetNotificationAuthStatusBehavior.swift +++ b/MVMCoreUI/Behaviors/GetNotificationAuthStatusBehavior.swift @@ -26,14 +26,14 @@ public class PageGetNotificationAuthStatusBehavior: PageVisibilityBehavior { public func onPageShown(_ delegateObject: MVMCoreUIDelegateObject?) { // Get notification auth status - self.getNotificationStatus() + getNotificationStatus() NotificationCenter.default.addObserver(self, selector: #selector(onForeground), name: UIApplication.willEnterForegroundNotification, object: nil) } @objc public func onForeground() { // Get notification authorization status - self.getNotificationStatus() + getNotificationStatus() } public func getNotificationStatus() { diff --git a/MVMCoreUI/OtherHandlers/CoreUIModelMapping.swift b/MVMCoreUI/OtherHandlers/CoreUIModelMapping.swift index 5632c697..6ee54804 100644 --- a/MVMCoreUI/OtherHandlers/CoreUIModelMapping.swift +++ b/MVMCoreUI/OtherHandlers/CoreUIModelMapping.swift @@ -156,7 +156,7 @@ open class CoreUIModelMapping: ModelMapping { ModelRegistry.register(handler: ListRightVariableToggleAllTextAndLinks.self, for: ListRightVariableToggleAllTextAndLinksModel.self) ModelRegistry.register(handler: ListRightVariableRightCaretAllTextAndLinks.self, for: ListRightVariableRightCaretAllTextAndLinksModel.self) ModelRegistry.register(handler: ListOneColumnFullWidthTextAllTextAndLinks.self, for: ListOneColumnFullWidthTextAllTextAndLinksModel.self) - ModelRegistry.register(handler: ListOneColumnFullWidthTextAllTextAndLinks.self, for: ConsumeNotificationAuthListOneColumnFullWidthTextAllTextAndLinksModel.self) + ModelRegistry.register(handler: ListOneColumnFullWidthTextAllTextAndLinks.self, for: ListNotificationAuthModel.self) ModelRegistry.register(handler: ListOneColumnFullWidthTextBodyText.self, for: ListOneColumnFullWidthTextBodyTextModel.self) ModelRegistry.register(handler: ListTwoColumnCompareChanges.self, for: ListTwoColumnCompareChangesModel.self) ModelRegistry.register(handler: ListTwoColumnPriceDetails.self, for: ListTwoColumnPriceDetailsModel.self)