From 5a54eab41e5497612b0a9ebecde62c298b530f98 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 21 Oct 2022 08:18:24 -0500 Subject: [PATCH] update vds Signed-off-by: Matt Bruce --- .gitignore | 5 + .../contents.xcworkspacedata | 5 +- .../JSONCreator.xcodeproj/project.pbxproj | 24 -- .../xcschemes/JSONCreator.xcscheme | 78 +++++++ JSONCreator_iOS/JSONCreator/AppDelegate.swift | 14 -- .../JSONCreator/DecodableDefaults+VDS.swift | 117 ---------- JSONCreator_iOS/JSONCreator/TestToggle.swift | 101 --------- .../JSONCreator/TestToggleModel.swift | 202 ----------------- .../JSONCreator/WifiViewController.swift | 112 ---------- JSONCreator_iOS/JSONCreator/WifiWidget.swift | 207 ------------------ .../JSONCreator/WifiWidgetModel.swift | 115 ---------- 11 files changed, 84 insertions(+), 896 deletions(-) create mode 100644 JSONCreator_iOS/JSONCreator.xcodeproj/xcshareddata/xcschemes/JSONCreator.xcscheme delete mode 100644 JSONCreator_iOS/JSONCreator/DecodableDefaults+VDS.swift delete mode 100644 JSONCreator_iOS/JSONCreator/TestToggle.swift delete mode 100644 JSONCreator_iOS/JSONCreator/TestToggleModel.swift delete mode 100644 JSONCreator_iOS/JSONCreator/WifiViewController.swift delete mode 100644 JSONCreator_iOS/JSONCreator/WifiWidget.swift delete mode 100644 JSONCreator_iOS/JSONCreator/WifiWidgetModel.swift diff --git a/.gitignore b/.gitignore index ef6af7e..6cbbf79 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ mvm_core mfprepayshop_ios mvm_core_ui mvmreactnative +vds_ios # frameworks contentTransferFramework.framework @@ -24,6 +25,10 @@ VZWAuthentication.framework CardinalMobile.framework MVDRetailFramework.framework +VDSTypographyTokens.framework +VDSFormControlsTokens.framework +VDSColorTokens.framework + __MACOSX # Xcode diff --git a/JSONCreator.xcworkspace/contents.xcworkspacedata b/JSONCreator.xcworkspace/contents.xcworkspacedata index a714f9d..40a48cc 100644 --- a/JSONCreator.xcworkspace/contents.xcworkspacedata +++ b/JSONCreator.xcworkspace/contents.xcworkspacedata @@ -2,10 +2,7 @@ - - + location = "group:vds_ios/VDS.xcodeproj"> diff --git a/JSONCreator_iOS/JSONCreator.xcodeproj/project.pbxproj b/JSONCreator_iOS/JSONCreator.xcodeproj/project.pbxproj index 2f12d6d..88447c8 100644 --- a/JSONCreator_iOS/JSONCreator.xcodeproj/project.pbxproj +++ b/JSONCreator_iOS/JSONCreator.xcodeproj/project.pbxproj @@ -69,20 +69,14 @@ EA09CE01282C43E800A7835F /* KeyedDecodingContainer+Decode.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA09CE00282C43E800A7835F /* KeyedDecodingContainer+Decode.swift */; }; EA09CE03282C44A100A7835F /* MFFGHSUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA09CE02282C44A100A7835F /* MFFGHSUtility.swift */; }; EA09CE05282C45C200A7835F /* BluetoothPairBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA09CE04282C45C200A7835F /* BluetoothPairBehavior.swift */; }; - EA1B7BBD2893459E006AF0BC /* DecodableDefaults+VDS.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA1B7BBC2893459E006AF0BC /* DecodableDefaults+VDS.swift */; }; EA33618B288B1B630071C351 /* VDS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA33618A288B1B630071C351 /* VDS.framework */; }; EA33618C288B1B630071C351 /* VDS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EA33618A288B1B630071C351 /* VDS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - EA3361C1288B37FB0071C351 /* TestToggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C0288B37FB0071C351 /* TestToggle.swift */; }; EA3361FB2891D54A0071C351 /* VDSTypographyTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA3361FA2891D54A0071C351 /* VDSTypographyTokens.xcframework */; }; EA3361FC2891D54A0071C351 /* VDSTypographyTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EA3361FA2891D54A0071C351 /* VDSTypographyTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - EA3362342891F5AB0071C351 /* TestToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3362332891F5AB0071C351 /* TestToggleModel.swift */; }; - EA3E48A62860BB4D00B524AB /* WifiWidgetModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3E48A52860BB4D00B524AB /* WifiWidgetModel.swift */; }; - EA3E48A82860BB9800B524AB /* WifiWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3E48A72860BB9800B524AB /* WifiWidget.swift */; }; EA5B696E2866BC1000B17D2E /* MVMCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA5B696C2866BC1000B17D2E /* MVMCore.framework */; }; EA5B696F2866BC1000B17D2E /* MVMCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EA5B696C2866BC1000B17D2E /* MVMCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; EA5B69702866BC1000B17D2E /* MVMCoreUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA5B696D2866BC1000B17D2E /* MVMCoreUI.framework */; }; EA5B69712866BC1000B17D2E /* MVMCoreUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EA5B696D2866BC1000B17D2E /* MVMCoreUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - EAA54A92286A47ED00B9136B /* WifiViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA54A91286A47ED00B9136B /* WifiViewController.swift */; }; EAA658152875FA5E00484A7D /* VDSFormControlsTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAA658142875FA5E00484A7D /* VDSFormControlsTokens.xcframework */; }; EAA658162875FA5E00484A7D /* VDSFormControlsTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EAA658142875FA5E00484A7D /* VDSFormControlsTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; EACA5E5E2853DBC900CBA65B /* VDSColorTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EACA5E5D2853DBC900CBA65B /* VDSColorTokens.xcframework */; }; @@ -162,22 +156,16 @@ EA09CE00282C43E800A7835F /* KeyedDecodingContainer+Decode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "KeyedDecodingContainer+Decode.swift"; sourceTree = ""; }; EA09CE02282C44A100A7835F /* MFFGHSUtility.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MFFGHSUtility.swift; sourceTree = ""; }; EA09CE04282C45C200A7835F /* BluetoothPairBehavior.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BluetoothPairBehavior.swift; sourceTree = ""; }; - EA1B7BBC2893459E006AF0BC /* DecodableDefaults+VDS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DecodableDefaults+VDS.swift"; sourceTree = ""; }; EA2ED278285BB3F400781478 /* MVMCoreUI.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MVMCoreUI.xcframework; path = ../SharedFrameworks/MVMCoreUI.xcframework; sourceTree = ""; }; EA2ED279285BB3F400781478 /* MVMCore.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MVMCore.xcframework; path = ../SharedFrameworks/MVMCore.xcframework; sourceTree = ""; }; EA2ED27E285BD00D00781478 /* MVMCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MVMCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; EA2ED27F285BD00D00781478 /* MVMCoreUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MVMCoreUI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; EA33618A288B1B630071C351 /* VDS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = VDS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - EA3361C0288B37FB0071C351 /* TestToggle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestToggle.swift; sourceTree = ""; }; EA3361FA2891D54A0071C351 /* VDSTypographyTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSTypographyTokens.xcframework; path = ../SharedFrameworks/VDSTypographyTokens.xcframework; sourceTree = ""; }; - EA3362332891F5AB0071C351 /* TestToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestToggleModel.swift; sourceTree = ""; }; - EA3E48A52860BB4D00B524AB /* WifiWidgetModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiWidgetModel.swift; sourceTree = ""; }; - EA3E48A72860BB9800B524AB /* WifiWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiWidget.swift; sourceTree = ""; }; EA5B696C2866BC1000B17D2E /* MVMCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MVMCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; EA5B696D2866BC1000B17D2E /* MVMCoreUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MVMCoreUI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; EA7E676927582F2200ABF773 /* MVMCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MVMCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; EA7E676A27582F2200ABF773 /* MVMCoreUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MVMCoreUI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - EAA54A91286A47ED00B9136B /* WifiViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiViewController.swift; sourceTree = ""; }; EAA658142875FA5E00484A7D /* VDSFormControlsTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSFormControlsTokens.xcframework; path = ../SharedFrameworks/VDSFormControlsTokens.xcframework; sourceTree = ""; }; EACA5E5D2853DBC900CBA65B /* VDSColorTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSColorTokens.xcframework; path = ../SharedFrameworks/VDSColorTokens.xcframework; sourceTree = ""; }; /* End PBXFileReference section */ @@ -240,12 +228,6 @@ D2B1E3FB22F4A6930065F95C /* Assets.xcassets */, D2B1E3FD22F4A6930065F95C /* LaunchScreen.storyboard */, D2B1E40022F4A6930065F95C /* Info.plist */, - EA3E48A52860BB4D00B524AB /* WifiWidgetModel.swift */, - EA3E48A72860BB9800B524AB /* WifiWidget.swift */, - EAA54A91286A47ED00B9136B /* WifiViewController.swift */, - EA3362332891F5AB0071C351 /* TestToggleModel.swift */, - EA3361C0288B37FB0071C351 /* TestToggle.swift */, - EA1B7BBC2893459E006AF0BC /* DecodableDefaults+VDS.swift */, ); path = JSONCreator; sourceTree = ""; @@ -473,7 +455,6 @@ buildActionMask = 2147483647; files = ( EA09CDFC282C430400A7835F /* CharacteristicModel.swift in Sources */, - EA3E48A82860BB9800B524AB /* WifiWidget.swift in Sources */, D2B1E3F722F4A68F0065F95C /* DetailViewController.swift in Sources */, EA09CDDD282C40CC00A7835F /* GMFGSpeedTestHandler.swift in Sources */, EA09CDDF282C40CC00A7835F /* GMFGRouterWifiHandler.swift in Sources */, @@ -482,9 +463,7 @@ EA09CDDE282C40CC00A7835F /* GMFG5GSignalHandler.swift in Sources */, EA09CDD1282C40CC00A7835F /* MFFGHSBluetoothPair.swift in Sources */, EA09CDEB282C422900A7835F /* GMFGStorageManager.swift in Sources */, - EA1B7BBD2893459E006AF0BC /* DecodableDefaults+VDS.swift in Sources */, EA09CE05282C45C200A7835F /* BluetoothPairBehavior.swift in Sources */, - EAA54A92286A47ED00B9136B /* WifiViewController.swift in Sources */, EA09CDFA282C430400A7835F /* BluetoothConfigModel.swift in Sources */, D27564CA25939E91003CA713 /* LinksModel.swift in Sources */, D2B1E3F522F4A68F0065F95C /* MasterViewController.swift in Sources */, @@ -495,7 +474,6 @@ EA09CDF9282C430400A7835F /* BluetoothPairableProtocol.swift in Sources */, D27564B72590FADB003CA713 /* ListDeviceRightVariableCaret.swift in Sources */, D2431DEB25E93A4F001C7AAC /* buttimag.swift in Sources */, - EA3361C1288B37FB0071C351 /* TestToggle.swift in Sources */, D27564C825939E91003CA713 /* LinkCollectionViewCell.swift in Sources */, EA09CDFB282C430400A7835F /* PeripheralModel.swift in Sources */, D2FC4FB025897ACB00061EA4 /* OrderTracker.swift in Sources */, @@ -504,11 +482,9 @@ EA09CDD6282C40CC00A7835F /* GMFGConstant.swift in Sources */, D27564C925939E91003CA713 /* Links.swift in Sources */, EA09CDE6282C416C00A7835F /* BluetoothDebuggableProtocol.swift in Sources */, - EA3E48A62860BB4D00B524AB /* WifiWidgetModel.swift in Sources */, EA09CDD2282C40CC00A7835F /* GMFGBluetoothPair.swift in Sources */, EA09CDE9282C416C00A7835F /* BluetoothDebuggerView.swift in Sources */, D2FC4FAE25897ACB00061EA4 /* OrderTrackerModel.swift in Sources */, - EA3362342891F5AB0071C351 /* TestToggleModel.swift in Sources */, D21B3A27259B93ED001483DC /* SelfSizingCollectionView.swift in Sources */, EA09CDD9282C40CC00A7835F /* GMFG5GCBandSignalHandler.swift in Sources */, EA09CDF8282C430400A7835F /* BluetoothPairingProtocol.swift in Sources */, diff --git a/JSONCreator_iOS/JSONCreator.xcodeproj/xcshareddata/xcschemes/JSONCreator.xcscheme b/JSONCreator_iOS/JSONCreator.xcodeproj/xcshareddata/xcschemes/JSONCreator.xcscheme new file mode 100644 index 0000000..39d34d2 --- /dev/null +++ b/JSONCreator_iOS/JSONCreator.xcodeproj/xcshareddata/xcschemes/JSONCreator.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/JSONCreator_iOS/JSONCreator/AppDelegate.swift b/JSONCreator_iOS/JSONCreator/AppDelegate.swift index 042ac17..8becbf4 100644 --- a/JSONCreator_iOS/JSONCreator/AppDelegate.swift +++ b/JSONCreator_iOS/JSONCreator/AppDelegate.swift @@ -130,11 +130,8 @@ extension AppDelegate: MVMCoreGlobalTopAlertDelegateProtocol { extension AppDelegate { func register(){ - ModelRegistry.register(handler: TestLabelToggle.self, for: TestLabelToggleModel.self) - ModelRegistry.register(handler: TestToggle.self, for: TestToggleModel.self) ModelRegistry.register(handler: TextEntryField.self, for: TextEntryField64Model.self) ModelRegistry.register(handler: EmailVerifyField.self, for: EmailVerifyModel.self) - ModelRegistry.register(handler: WifiWidget.self, for: WifiWidgetModel.self) ModelRegistry.register(handler: ToggleWifiActionHandler.self, for: ToggleWifiActionModel.self) } } @@ -254,17 +251,6 @@ class ToggleWifiActionModel: ActionModelProtocol { } } -class ToggleWifiActionHandler: MVMCoreActionHandlerProtocol { - required public init() {} - - func handleAction(_ model: ActionModelProtocol, additionalData: [AnyHashable : Any]?, delegateObject: DelegateObject?) { - guard let action = model as? ToggleWifiActionModel else { return } - - print("Wi-Fi Id: \(action.wifiId)") - - } -} - class TextEntryField64Model: TextEntryFieldModel { open override class var identifier: String { "textFieldBase64" } diff --git a/JSONCreator_iOS/JSONCreator/DecodableDefaults+VDS.swift b/JSONCreator_iOS/JSONCreator/DecodableDefaults+VDS.swift deleted file mode 100644 index bb23af3..0000000 --- a/JSONCreator_iOS/JSONCreator/DecodableDefaults+VDS.swift +++ /dev/null @@ -1,117 +0,0 @@ -// -// DecodableDefaults+VDS.swift -// JSONCreator -// -// Created by Matt Bruce on 7/28/22. -// Copyright © 2022 Verizon Wireless. All rights reserved. -// - -import Foundation -import VDS -import MVMCore - -//MARK: - Decodable Defaults -extension VDSFontCategory { - public enum DefaultFeature: DecodableDefault.Source { - public static var defaultValue: VDSFontCategory { .feature } - } - public enum DefaultTitle: DecodableDefault.Source { - public static var defaultValue: VDSFontCategory { .title } - } - public enum DefaultBody: DecodableDefault.Source { - public static var defaultValue: VDSFontCategory { .body } - } - public enum DefaultMicro: DecodableDefault.Source { - public static var defaultValue: VDSFontCategory { .micro } - } -} - -extension VDSFontSize { - public enum Default2XLarge: DecodableDefault.Source { - public static var defaultValue: VDSFontSize { .xxlarge } - } - public enum DefaultXLarge: DecodableDefault.Source { - public static var defaultValue: VDSFontSize { .xlarge } - } - public enum DefaultLarge: DecodableDefault.Source { - public static var defaultValue: VDSFontSize { .large } - } - public enum DefaultMedium: DecodableDefault.Source { - public static var defaultValue: VDSFontSize { .medium } - } - public enum DefaultSmall: DecodableDefault.Source { - public static var defaultValue: VDSFontSize { .small } - } - public enum DefaultXSmall: DecodableDefault.Source { - public static var defaultValue: VDSFontSize { .xsmall } - } -} - -extension VDSTextPosition { - public enum DefaultLeft: DecodableDefault.Source { - public static var defaultValue: VDSTextPosition { .left } - } - public enum DefaultRight: DecodableDefault.Source { - public static var defaultValue: VDSTextPosition { .right } - } - public enum DefaultCenter: DecodableDefault.Source { - public static var defaultValue: VDSTextPosition { .center } - } -} - -extension VDSFontWeight { - public enum DefaultBold: DecodableDefault.Source { - public static var defaultValue: VDSFontWeight { .bold } - } - public enum DefaultRegular: DecodableDefault.Source { - public static var defaultValue: VDSFontWeight { .regular } - } -} - -extension VDSToggle { - public enum DefaultOffText: DecodableDefault.Source { - public static var defaultValue: String { "Off" } - } - public enum DefaultOnText: DecodableDefault.Source { - public static var defaultValue: String { "On" } - } -} - -extension Surface { - public enum DefaultLight: DecodableDefault.Source { - public static var defaultValue: Surface { .light } - } - public enum DefaultDark: DecodableDefault.Source { - public static var defaultValue: Surface { .dark } - } -} - -extension DecodableDefault { - - public struct Surface { - public typealias Light = DecodableDefault.Wrapper - public typealias Dark = DecodableDefault.Wrapper - } - - public struct VDSTypography { - public typealias FontCategoryFeature = DecodableDefault.Wrapper - public typealias FontCategoryTitle = DecodableDefault.Wrapper - public typealias FontCategoryBody = DecodableDefault.Wrapper - public typealias FontCategoryMicro = DecodableDefault.Wrapper - public typealias FontWeightBold = DecodableDefault.Wrapper - public typealias FontWeightRegular = DecodableDefault.Wrapper - public typealias FontSize2XLarge = DecodableDefault.Wrapper - public typealias FontSizeXLarge = DecodableDefault.Wrapper - public typealias FontSizeLarge = DecodableDefault.Wrapper - public typealias FontSizeMedium = DecodableDefault.Wrapper - public typealias FontSizeSmall = DecodableDefault.Wrapper - public typealias FontSizeXSmall = DecodableDefault.Wrapper - public typealias TextPositionLeft = DecodableDefault.Wrapper - public typealias TextPositionRight = DecodableDefault.Wrapper - public typealias TextPositionCenter = DecodableDefault.Wrapper - } -// public struct VDSToggle { -// public typealias OffText = DecodableDefault.Wrapper -// public typealias OnText = DecodableDefault.Wrapper -// } -} diff --git a/JSONCreator_iOS/JSONCreator/TestToggle.swift b/JSONCreator_iOS/JSONCreator/TestToggle.swift deleted file mode 100644 index c9055ca..0000000 --- a/JSONCreator_iOS/JSONCreator/TestToggle.swift +++ /dev/null @@ -1,101 +0,0 @@ -// -// Toggle.swift -// MVMCoreUI -// -// Created by Kevin Christiano on 12/4/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import MVMCore -import MVMCoreUI -import UIKit -import VDS - -extension MoleculeViewProtocol { - public func onModelChange(model: MoleculeModelProtocol) { - if let backgroundColor = model.backgroundColor { - self.backgroundColor = backgroundColor.uiColor - } - - if let accessibilityIdentifier = model.accessibilityIdentifier { - self.accessibilityIdentifier = accessibilityIdentifier - } - } -} - -extension Modelable where Self: MoleculeViewProtocol { - public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - self.init(with: model as! ModelType) - self.set(with: model, delegateObject, additionalData) - } -} - -open class TestToggle: VDSToggleBase, MoleculeViewProtocol, MVMCoreViewProtocol { - - /// The state on the toggle. Default value: false. - open override var isOn: Bool { - didSet { - _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) - } - } - - open override var isEnabled: Bool { - didSet { - model.enabled = isEnabled && !model.readOnly - } - } - - //-------------------------------------------------- - // MARK: - Delegate - //-------------------------------------------------- - - private var delegateObject: MVMCoreUIDelegateObject? - - //-------------------------------------------------- - // MARK: - Initializers - //-------------------------------------------------- - open override func onStateChange(viewModel: ModelType) { - super.onStateChange(viewModel: viewModel) - onModelChange(model: viewModel) - } - - // MARK:- MoleculeViewProtocol - public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - - guard let castedModel = model as? ModelType else { return } - set(with: castedModel) - - self.delegateObject = delegateObject - - guard let formFieldProtocol = model as? FormFieldProtocol else { return } - FormValidator.setupValidation(for: formFieldProtocol, delegate: delegateObject?.formHolderDelegate) - - let additionalDataWithSource = additionalData.dictionaryAdding(key: KeySourceModel, value: model) - if castedModel.action != nil || castedModel.alternateAction != nil { - onChange = { [weak self] in - guard let self = self else { return } - if self.isOn { - if let action = castedModel.action { - MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: additionalDataWithSource, delegateObject: delegateObject) - } - } else { - if let action = castedModel.alternateAction ?? castedModel.action { - MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: additionalDataWithSource, delegateObject: delegateObject) - } - } - } - } - } - - public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { - return 24 - } -} - -// MARK: - MVMCoreUIViewConstrainingProtocol -extension TestToggle: MVMCoreUIViewConstrainingProtocol { - - public func needsToBeConstrained() -> Bool { true } - - public func horizontalAlignment() -> UIStackView.Alignment { .trailing } -} diff --git a/JSONCreator_iOS/JSONCreator/TestToggleModel.swift b/JSONCreator_iOS/JSONCreator/TestToggleModel.swift deleted file mode 100644 index bf01592..0000000 --- a/JSONCreator_iOS/JSONCreator/TestToggleModel.swift +++ /dev/null @@ -1,202 +0,0 @@ -// -// TestToggleModel.swift -// JSONCreator -// -// Created by Matt Bruce on 7/27/22. -// Copyright © 2022 Verizon Wireless. All rights reserved. -// - -import Foundation -import MVMCore -import MVMCoreUI -import VDS - -//MARK: - Model -public class TestToggleModel: MoleculeModelProtocol, FormFieldProtocol, VDSToggleModel { - - - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public static var identifier: String = "testToggle" - public var moleculeName: String = TestToggleModel.identifier - - public var action: ActionModelProtocol? - public var alternateAction: ActionModelProtocol? - public var accessibilityIdentifier: String? - public var backgroundColor: MVMCoreUI.Color? - - //FormFieldProtocol - public var fieldKey: String? - public var groupName: String = FormValidator.defaultGroupName - public var baseValue: AnyHashable? - public var readOnly: Bool = false - public var enabled: Bool = true - - //ToggleModelProtocol - public var id: String? - public var showText: Bool = false - public var on: Bool = false - public var surface: Surface = .light - public var inputId: String? - public var value: AnyHashable? - public var dataAnalyticsTrack: String? - public var dataClickStream: String? - public var dataTrack: String? - public var disabled: Bool = false - public var accessibilityHintEnabled: String? - public var accessibilityHintDisabled: String? - public var accessibilityValueEnabled: String? - public var accessibilityValueDisabled: String? - public var accessibilityLabelEnabled: String? - public var accessibilityLabelDisabled: String? - public var fontSize: VDSFontSize = .small - public var textPosition: VDSTextPosition = .left - public var fontWeight: VDSFontWeight = .regular - public var offText: String = "Off" - public var onText: String = "On" - //-------------------------------------------------- - // MARK: - Keys - //-------------------------------------------------- - - private enum CodingKeys: String, CodingKey { - case moleculeName - case action - case alternateAction - case accessibilityIdentifier - case fieldKey - case groupName - case readOnly - case enabled //which to use - - case id - case showText - case on - case surface - case inputId - case value - case dataAnalyticsTrack - case dataClickStream - case dataTrack - case disabled //which to use - case fontSize - case textPosition - case fontWeight - case offText - case onText - } - - //-------------------------------------------------- - // MARK: - Form Valdiation - //-------------------------------------------------- - - public func formFieldValue() -> AnyHashable? { - guard enabled else { return nil } - if let value = value { - return value - } else { - return on - } - } - - //-------------------------------------------------- - // MARK: - Server Value - //-------------------------------------------------- - open func formFieldServerValue() -> AnyHashable? { - return formFieldValue() - } - - //-------------------------------------------------- - // MARK: - Initializer - //-------------------------------------------------- - required public convenience init(){ - self.init(false) - } - - public init(_ state: Bool) { - self.on = state - baseValue = state - } - - //-------------------------------------------------- - // MARK: - Codec - //-------------------------------------------------- - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - - //molecule - action = try typeContainer.decodeModelIfPresent(codingKey: .action) - alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction) - accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier) - - //formField - fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) - readOnly = try typeContainer.decodeIfPresent(Bool.self, forKey: .readOnly) ?? false - if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) { - self.groupName = groupName - } - - //vds toggle - id = try typeContainer.decodeIfPresent(String.self, forKey: .id) - showText = try typeContainer.decodeIfPresent(Bool.self, forKey: .showText) ?? false - on = try typeContainer.decodeIfPresent(Bool.self, forKey: .on) ?? false - - surface = try typeContainer.decodeIfPresent(Surface.self, forKey: .surface) ?? .light - dataAnalyticsTrack = try typeContainer.decodeIfPresent(String.self, forKey: .dataAnalyticsTrack) - dataClickStream = try typeContainer.decodeIfPresent(String.self, forKey: .dataClickStream) - dataTrack = try typeContainer.decodeIfPresent(String.self, forKey: .dataTrack) - fontSize = try typeContainer.decodeIfPresent(VDSFontSize.self, forKey: .fontSize) ?? .small - textPosition = try typeContainer.decodeIfPresent(VDSTextPosition.self, forKey: .textPosition) ?? .left - fontWeight = try typeContainer.decodeIfPresent(VDSFontWeight.self, forKey: .fontWeight) ?? .regular - offText = try typeContainer.decodeIfPresent(String.self, forKey: .offText) ?? "Off" - onText = try typeContainer.decodeIfPresent(String.self, forKey: .onText) ?? "On" - - accessibilityHintEnabled = MVMCoreUIUtility.hardcodedString(withKey: "AccToggleHint") - accessibilityHintDisabled = MVMCoreUIUtility.hardcodedString(withKey: "AccDisabled") - accessibilityValueEnabled = MVMCoreUIUtility.hardcodedString(withKey: "AccOn") - accessibilityValueDisabled = MVMCoreUIUtility.hardcodedString(withKey: "AccOff") - accessibilityLabelEnabled = MVMCoreUIUtility.hardcodedString(withKey: "Toggle_buttonlabel") - accessibilityLabelDisabled = accessibilityLabelEnabled - - if let _enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { - enabled = _enabled && !readOnly - disabled = !_enabled && readOnly - } else if let _disabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .disabled) { - enabled = !_disabled && !readOnly - disabled = _disabled && readOnly - } - - baseValue = on - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - //molecule - try container.encode(moleculeName, forKey: .moleculeName) - try container.encodeModelIfPresent(action, forKey: .action) - try container.encodeModelIfPresent(alternateAction, forKey: .alternateAction) - try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier) - //formField - try container.encodeIfPresent(fieldKey, forKey: .fieldKey) - try container.encodeIfPresent(groupName, forKey: .groupName) - try container.encode(readOnly, forKey: .readOnly) - try container.encode(enabled, forKey: .enabled) - //vds toggle - try container.encodeIfPresent(id, forKey: .id) - try container.encode(showText, forKey: .showText) - try container.encode(on, forKey: .on) - try container.encodeIfPresent(surface, forKey: .surface) - try container.encodeIfPresent(inputId, forKey: .inputId) - try container.encode(dataAnalyticsTrack, forKey: .dataAnalyticsTrack) - try container.encode(dataClickStream, forKey: .dataClickStream) - try container.encode(dataTrack, forKey: .dataTrack) - try container.encode(disabled, forKey: .disabled) - try container.encodeIfPresent(fontSize, forKey: .fontSize) - try container.encodeIfPresent(textPosition, forKey: .textPosition) - try container.encodeIfPresent(fontWeight, forKey: .fontWeight) - try container.encodeIfPresent(offText, forKey: .offText) - try container.encodeIfPresent(onText, forKey: .onText) - } -} diff --git a/JSONCreator_iOS/JSONCreator/WifiViewController.swift b/JSONCreator_iOS/JSONCreator/WifiViewController.swift deleted file mode 100644 index b617939..0000000 --- a/JSONCreator_iOS/JSONCreator/WifiViewController.swift +++ /dev/null @@ -1,112 +0,0 @@ -// -// WifiViewController.swift -// JSONCreator -// -// Created by Matt Bruce on 6/27/22. -// Copyright © 2022 Verizon Wireless. All rights reserved. -// - -import Foundation -import MVMCoreUI - -class WifiViewController: UIViewController { -// MFSTLandingViewController *vc=[MFSTLandingViewController new]; -// vc.isForFiveG = true; -// vc.ssIDs = ssIDs; -// MFSTHistoryViewController *vc2=[MFSTHistoryViewController new]; -// vc2.isForFiveG = true; -// NSArray *tabInfo = @[ -// @{ -// @"presentationStyle" : @"push", -// @"itemName" : kST_OVERVIEW, -// @"title" : @"kST_OVERVIEW", -// @"actionType" :@"openPage", -// @"appContext" : @"mobileFirstSS", -// @"pageType" : DHCRegistry.PageTypeDHCLanding -// }, -// @{ -// @"presentationStyle" : @"push", -// @"itemName" : kST_HISTORY, -// @"title" : kST_HISTORY, -// @"actionType" : @"openPage", -// @"appContext" : @"mobileFirstSS", -// @"pageType" : DHCRegistry.PageTypeDHCHistoryLanding -// } -// ]; -// NSError *error = nil; -// MFSubNavManagerController *viewControllerToLoad = [[MFSubNavManagerController alloc] initWithViewControllers:@[vc,vc2] loadObject:vc.loadObject tabsInfo:tabInfo selectedIndex: 0 shouldEnableSwipeGestures:YES error:&error]; -// [[MVMCoreNavigationHandler sharedNavigationHandler] pushViewController:viewControllerToLoad animated:YES]; - -} - -class PrimaryWifiViewController: UIViewController { - let inset = 16.0 - - private lazy var stackView: UIStackView = { - let stack = UIStackView(frame: .zero) - stack.translatesAutoresizingMaskIntoConstraints = false - stack.spacing = 16 - stack.axis = .vertical - stack.alignment = .leading - stack.distribution = .fillProportionally - return stack - }() - - override func viewDidLoad() { - super.viewDidLoad() - - view.addSubview(stackView) - NSLayoutConstraint.constraintPinSubview(stackView, - pinTop: true, topConstant: inset, - pinBottom: true, bottomConstant: inset, - pinLeft: true, leftConstant: inset, - pinRight: true, rightConstant: inset) - - let primary1 = wifiWidget(for: "Primary-1", title: "", description: "", password: "123456") - let primary2 = wifiWidget(for: "Primary-2", title: "", description: "", password: "123456") - let secondary1 = wifiWidget(for: "Secondary-1", title: "", description: "", password: "123456") - let secondary2 = wifiWidget(for: "Secondary-2", title: "", description: "", password: "123456") - - stackView.addArrangedSubview(primary1) - stackView.addArrangedSubview(primary2) - stackView.addArrangedSubview(secondary1) - stackView.addArrangedSubview(secondary2) - } - - private func wifiWidget(for wifiId: String, title: String, description: String, password: String, enabled: Bool = true) -> WifiWidget { - let extraParameters: JSONValueDictionary = ["wifiId": JSONValue.init(stringLiteral: wifiId)] - - let editAction = ActionOpenPageModel(pageType: "editWifi", - presentationStyle: "push", - extraParameters: extraParameters) - - let enabledAction = ActionOpenPageModel(pageType: "enabledWifi", - presentationStyle: "push", - extraParameters: extraParameters) - - let shareAction = ActionShareModel(sharedText: "ssid: \(wifiId) password: \(password)", - sharedType: "Text") - - let wifiWidgetModel = WifiWidgetModel(wifiId: wifiId, - title: title, - description: description, - password: password, - enabled: enabled, - editTitle: "Edit Wi-Fi details", - shareTitle: "Share Wi-Fi", - enabledAction: enabledAction, - editAction: editAction, - shareAction: shareAction, - useHorizontalMargins: true, leftPadding: inset, rightPadding: inset, - useVerticalMargins: true, topPadding: inset, bottomPadding: inset) - - let wifiWidget = WifiWidget(frame: .zero) - wifiWidget.translatesAutoresizingMaskIntoConstraints = false - wifiWidget.set(with: wifiWidgetModel, nil, nil) - - return wifiWidget - } - -} - - diff --git a/JSONCreator_iOS/JSONCreator/WifiWidget.swift b/JSONCreator_iOS/JSONCreator/WifiWidget.swift deleted file mode 100644 index 02a889e..0000000 --- a/JSONCreator_iOS/JSONCreator/WifiWidget.swift +++ /dev/null @@ -1,207 +0,0 @@ -// -// WifiWidgetMolecule.swift -// MVMFrameworksSample -// -// Created by Matt Bruce on 6/17/22. -// - -import Foundation -import UIKit -import MVMCore -import MVMCoreUI - -@objcMembers open class TestLabelToggle: View { - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public let label = Label(fontStyle: .BoldBodySmall) - public let toggle = TestToggle() - - //-------------------------------------------------- - // MARK: - MVMCoreViewProtocol - //-------------------------------------------------- - - open override func updateView(_ size: CGFloat) { - super.updateView(size) - label.updateView(size) - toggle.updateView(size) - } - - open override func setupView() { - super.setupView() - - addSubview(label) - addSubview(toggle) - label.setContentHuggingPriority(.required, for: .vertical) - NSLayoutConstraint.pinViews(leftView: label, rightView: toggle, alignTop: false) - } - - open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { - guard let model = model as? TestLabelToggleModel, - let toggleHeight = Toggle.estimatedHeight(with: model.toggle, delegateObject), - let labelHeight = Label.estimatedHeight(with: model.label, delegateObject) - else { return nil } - - return max(toggleHeight, labelHeight) - } - - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - - guard let labelToggleModel = model as? TestLabelToggleModel else { return } - - label.set(with: labelToggleModel.label, delegateObject, additionalData) - toggle.set(with: labelToggleModel.toggle, delegateObject, additionalData) - } - - // MARK: - MoleculeViewProtocol - open override func reset() { - super.reset() - label.reset() - toggle.reset() - label.setFontStyle(.BoldBodySmall) - } -} - -public class TestLabelToggleModel: MoleculeModelProtocol { - public static var identifier: String = "testLabelToggle" - public var moleculeName: String = TestLabelToggleModel.identifier - public var backgroundColor: Color? - public var label: LabelModel - public var toggle: TestToggleModel - - public init(_ label: LabelModel, _ toggle: TestToggleModel) { - self.label = label - self.toggle = toggle - } - - private enum CodingKeys: String, CodingKey { - case moleculeName - case backgroundColor - case label - case toggle - } - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey:.backgroundColor) - label = try typeContainer.decode(LabelModel.self, forKey:.label) - toggle = try typeContainer.decode(TestToggleModel.self, forKey:.toggle) - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(moleculeName, forKey: .moleculeName) - try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) - try container.encode(label, forKey: .label) - try container.encode(toggle, forKey: .toggle) - } -} - - -public class WifiWidget: View { - //-------------------------------------------------- - // MARK: - Outlets - //-------------------------------------------------- - public private(set) var titleLabelToggle: TestLabelToggle = { - let tlt = TestLabelToggle() - tlt.label.setFontStyle(.BoldBodyLarge) - return tlt - }() - public let descriptionLabel = Label(fontStyle: .RegularMicro) - public let passwordTextField = TextEntryField() - public let editTitleLink = Link() - public let shareTitleLink = Link() - - private lazy var stack1: Stack = { - return Stack.createStack(with: [titleLabelToggle, descriptionLabel], - axis: .vertical, spacing: Padding.Two) - }() - - private lazy var stack2: Stack = { - return Stack.createStack(with: [ - (view: editTitleLink, model: StackItemModel()), - (view: shareTitleLink, model: StackItemModel(horizontalAlignment: .trailing)) - ], - axis: .horizontal, - spacing: Padding.Two) - }() - - private var row2 = StackItemModel() - private var row3 = StackItemModel() - - private lazy var stack: Stack = { - let model = StackModel(molecules: [StackItemModel(), row2, row3], - axis: .vertical, - spacing: Padding.Four) - let stackItems = [StackItem(andContain:stack1), StackItem(andContain: passwordTextField), StackItem(andContain:stack2)] - return Stack(with: model, stackItems: stackItems) - }() - - //-------------------------------------------------- - // MARK: - Lifecycle - //-------------------------------------------------- - - /// Initial configuration of class and view. - @objc final public override func setupView() { - super.setupView() - - isAccessibilityElement = false - setContentCompressionResistancePriority(.required, for: .vertical) - accessibilityElements = [titleLabelToggle.label, descriptionLabel, editTitleLink, shareTitleLink] - - stack1.restack() - stack2.restack() - stack.restack() - - stack.backgroundColor = .clear - addSubview(stack) - - NSLayoutConstraint.constraintPinSubview(stack, - pinTop: true, topConstant: 16, - pinBottom: true, bottomConstant: 16, - pinLeft: true, leftConstant: 16, - pinRight: true, rightConstant: 16) - } - - open override func reset() { - super.reset() - stack.reset() - } - - open func restack(){ - stack1.restack() - stack2.restack() - stack.restack() - } - - open override func updateView(_ size: CGFloat) { - super.updateView(size) - stack.updateView(size) - } - - //------------------------------------------------------ - // MARK: - Atomization - //------------------------------------------------------ - - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - super.set(with: model, delegateObject, additionalData) - - guard let model = model as? WifiWidgetModel else { return } - backgroundColor = model.backgroundColor?.uiColor ?? .mvmCoolGray1 - - //Password Text Field Model - passwordTextField.set(with: model.passwordModel, delegateObject, additionalData) - - //Update the Stacks with the models - stack1.updateContainedMolecules(with: [model.titleModel, model.descriptionModel], delegateObject, additionalData) - stack2.updateContainedMolecules(with: [model.editModel, model.shareModel], delegateObject, additionalData) - - //show/hide 2 and 3 rows - row2.gone = !model.enabled - row3.gone = !model.enabled - stack.restack() - } -} - - diff --git a/JSONCreator_iOS/JSONCreator/WifiWidgetModel.swift b/JSONCreator_iOS/JSONCreator/WifiWidgetModel.swift deleted file mode 100644 index fe739d0..0000000 --- a/JSONCreator_iOS/JSONCreator/WifiWidgetModel.swift +++ /dev/null @@ -1,115 +0,0 @@ -// -// WifiWidgetModel.swift -// MVMFrameworksSample -// -// Created by Matt Bruce on 6/17/22. -// - -import Foundation -import MVMCore -import MVMCoreUI - -public class WifiWidgetModel: ContainerModel, MoleculeModelProtocol { - //MoleculeModelProtocol - public var backgroundColor: Color? - public static var identifier: String { "wifiWidget" } - public var moleculeName: String = WifiWidgetModel.identifier - - //UI Bound Properties - public var wifiId: String - public var title: String - public var description: String - public var password: String - public var enabled: Bool = false - public var editTitle: String - public var shareTitle: String - - //Click Actions - public var enabledAction: ActionModelProtocol - public var editAction: ActionModelProtocol - public var shareAction: ActionModelProtocol - - public init(wifiId: String, title: String, description: String, password: String, enabled: Bool, editTitle: String, shareTitle: String, enabledAction: ActionModelProtocol, editAction: ActionModelProtocol, shareAction: ActionModelProtocol, - horizontalAlignment: UIStackView.Alignment? = nil, verticalAlignment: UIStackView.Alignment? = nil, useHorizontalMargins: Bool? = nil, leftPadding: CGFloat? = nil, rightPadding: CGFloat? = nil, useVerticalMargins: Bool? = nil, topPadding: CGFloat? = nil, bottomPadding: CGFloat? = nil) { - - self.wifiId = wifiId - self.title = title - self.description = description - self.password = password - self.enabled = enabled - self.editTitle = editTitle - self.shareTitle = shareTitle - self.enabledAction = enabledAction - self.editAction = editAction - self.shareAction = shareAction - super.init(horizontalAlignment: horizontalAlignment, verticalAlignment: verticalAlignment, useHorizontalMargins: useHorizontalMargins, leftPadding: leftPadding, rightPadding: rightPadding, useVerticalMargins: useVerticalMargins, topPadding: topPadding, bottomPadding: bottomPadding) - } - - private enum CodingKeys: String, CodingKey { - case moleculeName - case backgroundColor - case wifiId, title, description, password, enabled, editTitle, shareTitle - case enabledAction, editAction, shareAction - } - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - wifiId = try typeContainer.decode(String.self, forKey: .wifiId) - title = try typeContainer.decode(String.self, forKey: .title) - description = try typeContainer.decode(String.self, forKey: .description) - password = try typeContainer.decode(String.self, forKey: .password) - enabled = try typeContainer.decode(Bool.self, forKey: .enabled) - editTitle = try typeContainer.decode(String.self, forKey: .editTitle) - shareTitle = try typeContainer.decode(String.self, forKey: .shareTitle) - enabledAction = try typeContainer.decodeModel(codingKey: .enabledAction) - editAction = try typeContainer.decodeModel(codingKey: .editAction) - shareAction = try typeContainer.decodeModel(codingKey: .shareAction) - try super.init(from: decoder) - } - - public override func encode(to encoder: Encoder) throws { - try super.encode(to: encoder) - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) - try container.encode(moleculeName, forKey: .moleculeName) - try container.encode(wifiId, forKey: .wifiId) - try container.encode(title, forKey: .title) - try container.encode(description, forKey: .description) - try container.encode(password, forKey: .password) - try container.encode(enabled, forKey: .enabled) - try container.encode(editTitle, forKey: .editTitle) - try container.encode(shareTitle, forKey: .shareTitle) - try container.encodeModel(enabledAction, forKey: .enabledAction) - try container.encodeModel(editAction, forKey: .editAction) - try container.encodeModel(shareAction, forKey: .shareAction) - } - -} - -extension WifiWidgetModel { - - public var titleModel: TestLabelToggleModel { - let labelModel = LabelModel(text: title) - let toggleModel = TestToggleModel(enabled) - toggleModel.action = enabledAction - toggleModel.showText = true - return TestLabelToggleModel(labelModel, toggleModel) - } - - public var passwordModel: TextEntryFieldModel { - let model = TextEntryFieldModel(with: password) - model.fieldKey = "preferredLastName" - model.type = .password - model.readOnly = true - return model - } - - public var descriptionModel: LabelModel { LabelModel(text: description) } - public var editModel: LinkModel { LinkModel(title: editTitle, action: editAction) } - public var shareModel: LinkModel { LinkModel(title: shareTitle, action: shareAction) } - -} - - -