diff --git a/JSONCreator_iOS/JSONCreator.xcodeproj/project.pbxproj b/JSONCreator_iOS/JSONCreator.xcodeproj/project.pbxproj index b704ce5..84e404d 100644 --- a/JSONCreator_iOS/JSONCreator.xcodeproj/project.pbxproj +++ b/JSONCreator_iOS/JSONCreator.xcodeproj/project.pbxproj @@ -74,8 +74,6 @@ 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 */; }; 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 */; }; @@ -96,7 +94,7 @@ EA84F75E28BD558F00D67ABC /* EmptyDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA84F74E28BD558F00D67ABC /* EmptyDefaults.swift */; }; EA84F75F28BD558F00D67ABC /* CustomWrappers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA84F74F28BD558F00D67ABC /* CustomWrappers.swift */; }; EA84F76028BD558F00D67ABC /* ConveienceAdherence.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA84F75028BD558F00D67ABC /* ConveienceAdherence.swift */; }; - EAA54A92286A47ED00B9136B /* WifiViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA54A91286A47ED00B9136B /* WifiViewController.swift */; }; + EAA5EEFE28F602FD003B3210 /* GenericMolecule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEFD28F602FD003B3210 /* GenericMolecule.swift */; }; EAF7F0912899825D00B287F5 /* TestLabelToggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0902899825D00B287F5 /* TestLabelToggle.swift */; }; EAF7F12528A15E2300B287F5 /* VDSTypographyTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA3361FA2891D54A0071C351 /* VDSTypographyTokens.xcframework */; }; EAF7F12628A15E2300B287F5 /* VDSTypographyTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EA3361FA2891D54A0071C351 /* VDSTypographyTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -188,8 +186,6 @@ 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; }; @@ -210,7 +206,7 @@ EA84F74E28BD558F00D67ABC /* EmptyDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmptyDefaults.swift; sourceTree = ""; }; EA84F74F28BD558F00D67ABC /* CustomWrappers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomWrappers.swift; sourceTree = ""; }; EA84F75028BD558F00D67ABC /* ConveienceAdherence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConveienceAdherence.swift; sourceTree = ""; }; - EAA54A91286A47ED00B9136B /* WifiViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiViewController.swift; sourceTree = ""; }; + EAA5EEFD28F602FD003B3210 /* GenericMolecule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenericMolecule.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 = ""; }; EAF7F0902899825D00B287F5 /* TestLabelToggle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestLabelToggle.swift; sourceTree = ""; }; @@ -275,13 +271,11 @@ 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 */, EAF7F0902899825D00B287F5 /* TestLabelToggle.swift */, + EAA5EEFD28F602FD003B3210 /* GenericMolecule.swift */, ); path = JSONCreator; sourceTree = ""; @@ -557,7 +551,6 @@ files = ( EA09CDFC282C430400A7835F /* CharacteristicModel.swift in Sources */, EA84F75328BD558F00D67ABC /* OptionalWrappers.swift in Sources */, - EA3E48A82860BB9800B524AB /* WifiWidget.swift in Sources */, D2B1E3F722F4A68F0065F95C /* DetailViewController.swift in Sources */, EA84F76028BD558F00D67ABC /* ConveienceAdherence.swift in Sources */, EA09CDDD282C40CC00A7835F /* GMFGSpeedTestHandler.swift in Sources */, @@ -572,7 +565,6 @@ EA1B7BBD2893459E006AF0BC /* DecodableDefaults+VDS.swift in Sources */, EA09CE05282C45C200A7835F /* BluetoothPairBehavior.swift in Sources */, EA84F75B28BD558F00D67ABC /* DataCoding.swift in Sources */, - EAA54A92286A47ED00B9136B /* WifiViewController.swift in Sources */, EA84F75228BD558F00D67ABC /* ImmutableWrapper.swift in Sources */, EA09CDFA282C430400A7835F /* BluetoothConfigModel.swift in Sources */, D27564CA25939E91003CA713 /* LinksModel.swift in Sources */, @@ -594,7 +586,6 @@ EA09CDD6282C40CC00A7835F /* GMFGConstant.swift in Sources */, D27564C925939E91003CA713 /* Links.swift in Sources */, EA09CDE6282C416C00A7835F /* BluetoothDebuggableProtocol.swift in Sources */, - EA3E48A62860BB4D00B524AB /* WifiWidgetModel.swift in Sources */, EA84F75628BD558F00D67ABC /* StaticCodingWrappers.swift in Sources */, EA09CDD2282C40CC00A7835F /* GMFGBluetoothPair.swift in Sources */, EA09CDE9282C416C00A7835F /* BluetoothDebuggerView.swift in Sources */, @@ -605,6 +596,7 @@ EA09CDD9282C40CC00A7835F /* GMFG5GCBandSignalHandler.swift in Sources */, EA09CDF8282C430400A7835F /* BluetoothPairingProtocol.swift in Sources */, EA84F75128BD558F00D67ABC /* TransientCoding.swift in Sources */, + EAA5EEFE28F602FD003B3210 /* GenericMolecule.swift in Sources */, D2B1E3F322F4A68F0065F95C /* AppDelegate.swift in Sources */, EA09CDDA282C40CC00A7835F /* GMFGOperationHandler.swift in Sources */, EA84F75D28BD558F00D67ABC /* StaticCoding.swift in Sources */, diff --git a/JSONCreator_iOS/JSONCreator/GenericMolecule.swift b/JSONCreator_iOS/JSONCreator/GenericMolecule.swift new file mode 100644 index 0000000..d95621b --- /dev/null +++ b/JSONCreator_iOS/JSONCreator/GenericMolecule.swift @@ -0,0 +1,102 @@ +// +// GenericMolecule.swift +// JSONCreator +// +// Created by Matt Bruce on 10/11/22. +// Copyright © 2022 Verizon Wireless. All rights reserved. +// + +import Foundation +import MVMCore +import MVMCoreUI +import UIKit +import VDS + +open class GenericMolecule: UIView, MoleculeViewProtocol, MVMCoreViewProtocol, ViewMaskingProtocol { + + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public var model: MoleculeModelType! + public var delegateObject: MVMCoreUIDelegateObject? + public var additionalData: [AnyHashable: Any]? + + private var initialSetupPerformed = false + + public var shouldMaskWhileRecording: Bool { + return model?.shouldMaskRecordedView ?? false + } + + //-------------------------------------------------- + // MARK: - Initialization + //-------------------------------------------------- + + public override init(frame: CGRect) { + super.init(frame: .zero) + initialSetup() + } + + public convenience init() { + self.init(frame: .zero) + } + + public required init?(coder: NSCoder) { + super.init(coder: coder) + initialSetup() + } + + open func initialSetup() { + if !initialSetupPerformed { + initialSetupPerformed = true + setupView() + } + } + + public required init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(frame: .zero) + guard let casted = model as? MoleculeModelType else { + fatalError("Wrong MoleculeModel sent to \(self). Expected: \(MoleculeModelType.self) but received: \(type(of: model).self)") + } + self.model = casted + initialSetup() + set(with: model, delegateObject, additionalData) + } + + //-------------------------------------------------- + // MARK: - MoleculeViewProtocol + //-------------------------------------------------- + + open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + guard let castedModel = model as? MoleculeModelType else { return } + self.model = castedModel + self.delegateObject = delegateObject + self.additionalData = additionalData + viewModelUpdate(model: castedModel) + } + + open func viewModelUpdate(model: MoleculeModelType) { } + + open func reset() { + backgroundColor = .clear + } + + // MARK: Overridables + // Base classes need to implement these functions otherwise swift won't respect the subclass functions and use the ones in the protocol extension instead. + open class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? { + model.moleculeName + } + + open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { nil } + + open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? { nil } + + open func updateView(_ size: CGFloat) { } + + /// Will be called only once. + open func setupView() { + translatesAutoresizingMaskIntoConstraints = false + insetsLayoutMarginsFromSafeArea = false + MVMCoreUIUtility.setMarginsFor(self, leading: 0, top: 0, trailing: 0, bottom: 0) + } + +} diff --git a/JSONCreator_iOS/JSONCreator/JSON/Samples/Wifi/TestModel.json b/JSONCreator_iOS/JSONCreator/JSON/Samples/Wifi/TestModel.json deleted file mode 100644 index c905f6e..0000000 --- a/JSONCreator_iOS/JSONCreator/JSON/Samples/Wifi/TestModel.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "moleculeName": "testModel", - "text": "Here's your update", - "action": { - "actionType": "openPage", - "pageType": "updateProfile", - "extraParameters": { - "from": "none" - }, - "presentationStyle": "push" - }, - "actions": [ - { - "actionType": "openPage", - "pageType": "updateProfile", - "extraParameters": { - "from": "none" - }, - "presentationStyle": "push" - }, - { - "actionType": "openPage", - "pageType": "deleteProfile", - "extraParameters": { - "from": "none" - }, - "presentationStyle": "push" - } - ] -} diff --git a/JSONCreator_iOS/JSONCreator/JSON/Samples/Wifi/Wifi-1.json b/JSONCreator_iOS/JSONCreator/JSON/Samples/Wifi/Wifi-1.json deleted file mode 100644 index 952922d..0000000 --- a/JSONCreator_iOS/JSONCreator/JSON/Samples/Wifi/Wifi-1.json +++ /dev/null @@ -1,637 +0,0 @@ -{ - "Page": { - "template": "list", - "pageType": "wifiSample1", - "screenHeading": "Network Management", - "hideFabOverlay": true, - "suppressPostLaunchRequests": false, - "tabBarHidden": true, - "line": { - "moleculeName": "line", - "type": "none" - }, - "header": { - "moleculeName": "header", - "molecule": { - "moleculeName": "headlineBody", - "headline": { - "moleculeName": "label", - "text": "Wi-Fi networks" - } - }, - "line": { - "moleculeName": "line", - "type": "none" - } - }, - "molecules": [ - { - "moleculeName": "tabsListItem", - "tabs": { - "moleculeName": "tabs", - "tabs": [ - { - "label": { - "moleculeName": "label", - "text": "Primary" - } - }, - { - "label": { - "moleculeName": "label", - "text": "Guest" - } - }, - { - "label": { - "moleculeName": "label", - "text": "IoT" - } - } - ] - }, - "molecules": [ - [ - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "container", - "backgroundColor": "#F6F6F6", - "molecule": { - "moleculeName": "stack", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 16, - "useHorizontalMargins": true, - "useVerticalMargins": true, - "spacing": 16, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "stack", - "spacing": 8, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "labelToggle", - "label": { - "moleculeName": "label", - "text": "West Coast Avocado Toast", - "fontStyle": "BoldBodyLarge" - }, - "toggle": { - "moleculeName": "toggle", - "state": true, - "action": { - "actionType": "toggleWifi", - "enabled": true, - "wifiId": "primary-1" - } - } - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "label", - "text": "Primary Wi-Fi (2.4 Ghz)", - "fontStyle": "RegularMicro" - } - } - ] - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "textField", - "fieldKey": "preferredLastName", - "type": "password", - "text": "12345", - "readOnly": true - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "stack", - "axis": "horizontal", - "spacing": 8, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "link", - "title": "Edit Wi-Fi details", - "action": { - "actionType": "openPage", - "pageType": "editWifi", - "extraParameters": { - "wifiType": "primary" - } - } - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "link", - "title": "Share Wi-Fi", - "action": { - "actionType": "share", - "sharedText": "123456", - "sharedType": "Text" - } - } - } - ] - } - } - ] - } - } - }, - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "container", - "backgroundColor": "#F6F6F6", - "molecule": { - "moleculeName": "stack", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 16, - "useHorizontalMargins": true, - "useVerticalMargins": true, - "spacing": 16, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "stack", - "spacing": 8, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "labelToggle", - "label": { - "moleculeName": "label", - "text": "New England Clam Router", - "fontStyle": "BoldBodyLarge" - }, - "toggle": { - "moleculeName": "toggle", - "state": false, - "action": { - "actionType": "toggleWifi", - "enabled": false, - "wifiId": "primary-2" - } - } - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "label", - "text": "Primary Wi-Fi (5 Ghz)", - "fontStyle": "RegularMicro" - } - } - ] - } - } - ] - } - } - }, - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "line": { - "moleculeName": "line", - "type": "standard" - }, - "molecule": { - "moleculeName": "container", - "backgroundColor": "#F6F6F6", - "molecule": { - "moleculeName": "stack", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 16, - "useHorizontalMargins": true, - "useVerticalMargins": true, - "spacing": 16, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "stack", - "spacing": 8, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "labelToggle", - "label": { - "moleculeName": "label", - "text": "Chicago Pizza", - "fontStyle": "BoldBodyLarge" - }, - "toggle": { - "moleculeName": "toggle", - "state": true, - "action": { - "actionType": "toggleWifi", - "enabled": true, - "wifiId": "primary-3" - } - } - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "label", - "text": "Primary Wi-Fi (5 Ghz 2)", - "fontStyle": "RegularMicro" - } - } - ] - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "textField", - "fieldKey": "preferredLastName", - "type": "password", - "text": "12345", - "readOnly": true - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "stack", - "axis": "horizontal", - "spacing": 8, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "link", - "title": "Edit Wi-Fi details", - "action": { - "actionType": "openPage", - "pageType": "editWifi", - "extraParameters": { - "wifiType": "primary" - } - } - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "link", - "title": "Share Wi-Fi", - "action": { - "actionType": "share", - "sharedText": "123456", - "sharedType": "Text" - } - } - } - ] - } - } - ] - } - } - }, - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "container", - "backgroundColor": "#F6F6F6", - "molecule": { - "moleculeName": "stack", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 16, - "useHorizontalMargins": true, - "useVerticalMargins": true, - "spacing": 16, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "label", - "backgroundColor": "#000000", - "textColor": "#ffffff", - "text": "Disabled" - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "label", - "fontStyle": "BoldBodyLarge", - "text": "SON (Self-Organizing Network)" - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "label", - "text": "Enable SON to automatically connect your devices to the fastest available Wi-Fi network." - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "link", - "title": "Details about SON", - "action": { - "actionType": "openPage", - "pageType": "sonDetails", - "extraParameters": { - "wifiType": "primary" - } - } - } - } - ] - } - } - } - ], - [ - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "label", - "text": "Limits access to devices in your home, recommended for guests" - } - }, - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "container", - "backgroundColor": "#F6F6F6", - "molecule": { - "moleculeName": "stack", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 16, - "useHorizontalMargins": true, - "useVerticalMargins": true, - "spacing": 16, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "stack", - "spacing": 8, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "labelToggle", - "label": { - "moleculeName": "label", - "text": "You Don't Belong Here", - "fontStyle": "BoldBodyLarge" - }, - "toggle": { - "moleculeName": "toggle", - "state": true, - "action": { - "actionType": "toggleWifi", - "enabled": true, - "wifiId": "guest-1" - } - } - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "label", - "text": "Guest Wi-Fi (2.4 Ghz)", - "fontStyle": "RegularMicro" - } - } - ] - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "textField", - "fieldKey": "preferredLastName", - "type": "password", - "text": "12345", - "readOnly": true - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "stack", - "axis": "horizontal", - "spacing": 8, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "link", - "title": "Edit Wi-Fi details", - "action": { - "actionType": "openPage", - "pageType": "editWifi", - "extraParameters": { - "wifiType": "primary" - } - } - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "link", - "title": "Share Wi-Fi", - "action": { - "actionType": "share", - "sharedText": "123456", - "sharedType": "Text" - } - } - } - ] - } - } - ] - } - } - } - ], - [ - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "label", - "text": "Recommended for optimal connectivity to \"Internet of Things\" (IoT) devices, for example smart speakers, plugs, and light switches." - } - }, - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "container", - "backgroundColor": "#F6F6F6", - "molecule": { - "moleculeName": "stack", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 16, - "useHorizontalMargins": true, - "useVerticalMargins": true, - "spacing": 16, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "stack", - "spacing": 8, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "labelToggle", - "label": { - "moleculeName": "label", - "text": "Connected Homies", - "fontStyle": "BoldBodyLarge" - }, - "toggle": { - "moleculeName": "toggle", - "state": true, - "action": { - "actionType": "toggleWifi", - "enabled": true, - "wifiId": "iot-1" - } - } - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "label", - "text": "IoT (2.4 Ghz)", - "fontStyle": "RegularMicro" - } - } - ] - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "textField", - "fieldKey": "preferredLastName", - "type": "password", - "text": "12345", - "readOnly": true - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "stack", - "axis": "horizontal", - "spacing": 8, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "link", - "title": "Edit Wi-Fi details", - "action": { - "actionType": "openPage", - "pageType": "editWifi", - "extraParameters": { - "wifiType": "primary" - } - } - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "link", - "title": "Share Wi-Fi", - "action": { - "actionType": "share", - "sharedText": "123456", - "sharedType": "Text" - } - } - } - ] - } - } - ] - } - } - } - ] - ] - } - ], - "footer": {} - } -} - diff --git a/JSONCreator_iOS/JSONCreator/JSON/Samples/Wifi/Wifi-2.json b/JSONCreator_iOS/JSONCreator/JSON/Samples/Wifi/Wifi-2.json deleted file mode 100644 index 77b30cb..0000000 --- a/JSONCreator_iOS/JSONCreator/JSON/Samples/Wifi/Wifi-2.json +++ /dev/null @@ -1,357 +0,0 @@ -{ - "Page": { - "template": "list", - "pageType": "wifiSample1", - "screenHeading": "Network Management", - "hideFabOverlay": true, - "suppressPostLaunchRequests": false, - "tabBarHidden": true, - "line": { - "moleculeName": "line", - "type": "none" - }, - "header": { - "moleculeName": "header", - "molecule": { - "moleculeName": "headlineBody", - "headline": { - "moleculeName": "label", - "text": "Wi-Fi networks" - } - }, - "line": { - "moleculeName": "line", - "type": "none" - } - }, - "molecules": [ - { - "moleculeName": "tabsListItem", - "tabs": { - "moleculeName": "tabs", - "tabs": [ - { - "label": { - "moleculeName": "label", - "text": "Primary" - } - }, - { - "label": { - "moleculeName": "label", - "text": "Guest" - } - }, - { - "label": { - "moleculeName": "label", - "text": "IoT" - } - } - ] - }, - "molecules": [ - [ - { - "moleculeName": "listItem", - "verticalAlignment": "leading", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "enabled": false, - "molecule": { - "moleculeName": "toggle" - } - }, - { - "moleculeName": "listItem", - "verticalAlignment": "leading", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "disabled": true, - "molecule": { - "moleculeName": "testToggle" - } - }, - { - "moleculeName": "listItem", - "verticalAlignment": "leading", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "wifiWidget", - "backgroundColor": "#F6F6F6", - "wifiId": "primary-1", - "title": "West Coast Avocado Toast", - "enabled": true, - "enabledAction": { - "actionType": "toggleWifi", - "enabled": true, - "wifiId": "primary-1", - }, - "description": "Primary Wi-Fi (2.4 Ghz)", - "password": "1234567", - "editTitle": "Edit Wi-Fi details", - "editAction": { - "actionType": "openPage", - "pageType": "editWifi", - "extraParameters": { - "wifiId": "primary-1" - } - }, - "shareTitle": "Share Wi-Fi", - "shareAction": { - "actionType": "share", - "sharedText": "ssid: primary-1 password: 123456", - "sharedType": "Text" - } - } - }, - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "wifiWidget", - "backgroundColor": "#F6F6F6", - "wifiId": "primary-2", - "title": "New England Clam Router", - "enabled": false, - "enabledAction": { - "actionType": "toggleWifi", - "enabled": false, - "wifiId": "primary-2" - }, - "description": "Primary Wi-Fi (5.0 Ghz)", - "password": "1234567", - "editTitle": "Edit Wi-Fi details", - "editAction": { - "actionType": "openPage", - "pageType": "editWifi", - "extraParameters": { - "wifiId": "primary-2" - } - }, - "shareTitle": "Share Wi-Fi", - "shareAction": { - "actionType": "share", - "sharedText": "ssid: primary-2 password: 123456", - "sharedType": "Text" - } - } - }, - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "line": { - "moleculeName": "line", - "type": "standard" - }, - "molecule": { - "moleculeName": "wifiWidget", - "backgroundColor": "#F6F6F6", - "wifiId": "primary-3", - "title": "Chicago Pizza", - "enabled": true, - "enabledAction": { - "actionType": "toggleWifi", - "enabled": true, - "wifiId": "primary-3" - }, - "description": "Primary Wi-Fi (5.0 Ghz 2)", - "password": "1234567", - "editTitle": "Edit Wi-Fi details", - "editAction": { - "actionType": "openPage", - "pageType": "editWifi", - "extraParameters": { - "wifiId": "primary-3" - } - }, - "shareTitle": "Share Wi-Fi", - "shareAction": { - "actionType": "share", - "sharedText": "ssid: primary-3 password: 123456", - "sharedType": "Text" - } - } - }, - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "container", - "backgroundColor": "#F6F6F6", - "molecule": { - "moleculeName": "stack", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 16, - "useHorizontalMargins": true, - "useVerticalMargins": true, - "spacing": 16, - "molecules": [ - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName": "label", - "leftPadding": 5, - "rightPadding": 5, - "topPadding": 2, - "bottomPadding": 2, - "backgroundColor": "#000000", - "textColor": "#ffffff", - "text": "Disabled" - } - }, - { - "moleculeName": "stackItem", - "molecule": { - "moleculeName":"headlineBodyLink", - "headlineBody":{ - "moleculeName": "headlineBody", - "headline":{ - "moleculeName": "label", - "fontStyle": "BoldBodyLarge", - "text": "SON (Self-Organizing Network)" - }, - "body":{ - "moleculeName": "label", - "text": "Enable SON to automatically connect your devices to the fastest available Wi-Fi network." - } - }, - "link":{ - "moleculeName": "link", - "title": "Details about SON", - "action": { - "actionType": "openPage", - "pageType": "sonDetails", - "extraParameters": { - "wifiType": "primary" - } - } - } - } - } - ] - } - } - } - ], - [ - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "label", - "text": "Limits access to devices in your home, recommended for guests" - } - }, - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "wifiWidget", - "backgroundColor": "#F6F6F6", - "wifiId": "guest-1", - "title": "You Don't Belong Here", - "enabled": true, - "enabledAction": { - "actionType": "toggleWifi", - "enabled": true, - "wifiId": "guest-1" - }, - "description": "Guest Wi-Fi (2.4 Ghz)", - "password": "1234567", - "editTitle": "Edit Wi-Fi details", - "editAction": { - "actionType": "openPage", - "pageType": "editWifi", - "extraParameters": { - "wifiId": "guest-1" - } - }, - "shareTitle": "Share Wi-Fi", - "shareAction": { - "actionType": "share", - "sharedText": "ssid: guest-1 password: 123456", - "sharedType": "Text" - } - } - } - ], - [ - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "label", - "text": "Recommended for optimal connectivity to \"Internet of Things\" (IoT) devices, for example smart speakers, plugs, and light switches." - } - }, - { - "moleculeName": "listItem", - "leftPadding": 16, - "rightPadding": 16, - "topPadding": 16, - "bottomPadding": 8, - "molecule": { - "moleculeName": "wifiWidget", - "backgroundColor": "#F6F6F6", - "wifiId": "iot-2", - "title": "Connected Homies", - "enabled": true, - "enabledAction": { - "actionType": "toggleWifi", - "enabled": true, - "wifiId": "iot-1" - }, - "description": "IoT (2.4 Ghz)", - "password": "1234567", - "editTitle": "Edit Wi-Fi details", - "editAction": { - "actionType": "openPage", - "pageType": "editWifi", - "extraParameters": { - "wifiId": "iot-1" - } - }, - "shareTitle": "Share Wi-Fi", - "shareAction": { - "actionType": "share", - "sharedText": "ssid: iot-1 password: 123456", - "sharedType": "Text" - } - } - } - ] - ] - } - ], - "footer": {} - } -} - 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 bc9c9af..0000000 --- a/JSONCreator_iOS/JSONCreator/WifiWidget.swift +++ /dev/null @@ -1,118 +0,0 @@ -// -// WifiWidgetMolecule.swift -// MVMFrameworksSample -// -// Created by Matt Bruce on 6/17/22. -// - -import Foundation -import UIKit -import MVMCore -import MVMCoreUI - -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) } - -} - - -