Merge branch 'develop' into bugfix/PRODDEF-1289_accessibilityChanges
This commit is contained in:
commit
0f2f00f6d4
@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 52;
|
objectVersion = 54;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
@ -286,8 +286,10 @@
|
|||||||
AF1C33732885D481006B1001 /* MVMCoreUIActionOpenPageHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF1C33722885D481006B1001 /* MVMCoreUIActionOpenPageHandler.swift */; };
|
AF1C33732885D481006B1001 /* MVMCoreUIActionOpenPageHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF1C33722885D481006B1001 /* MVMCoreUIActionOpenPageHandler.swift */; };
|
||||||
AF60A7F62892D2E300919EEB /* ActionDismissNotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF60A7F52892D2E300919EEB /* ActionDismissNotificationModel.swift */; };
|
AF60A7F62892D2E300919EEB /* ActionDismissNotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF60A7F52892D2E300919EEB /* ActionDismissNotificationModel.swift */; };
|
||||||
AF60A7F82892D34D00919EEB /* ActionDismissNotificationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF60A7F72892D34D00919EEB /* ActionDismissNotificationHandler.swift */; };
|
AF60A7F82892D34D00919EEB /* ActionDismissNotificationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF60A7F72892D34D00919EEB /* ActionDismissNotificationHandler.swift */; };
|
||||||
|
AF766D262A3CD4C600749099 /* UIAccessibilityTraits+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF766D252A3CD4C600749099 /* UIAccessibilityTraits+Codable.swift */; };
|
||||||
AF7E509829E477C1009DC2AD /* AlertHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF7E509629E477C0009DC2AD /* AlertHandler.swift */; };
|
AF7E509829E477C1009DC2AD /* AlertHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF7E509629E477C0009DC2AD /* AlertHandler.swift */; };
|
||||||
AF7E509929E477C1009DC2AD /* AlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF7E509729E477C0009DC2AD /* AlertController.swift */; };
|
AF7E509929E477C1009DC2AD /* AlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF7E509729E477C0009DC2AD /* AlertController.swift */; };
|
||||||
|
AF8118302AB39B0900FAD1BA /* RawRepresentableCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF81182F2AB39B0900FAD1BA /* RawRepresentableCodable.swift */; };
|
||||||
AFA4932029E5CA73001A9663 /* AlertOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4931F29E5CA73001A9663 /* AlertOperation.swift */; };
|
AFA4932029E5CA73001A9663 /* AlertOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4931F29E5CA73001A9663 /* AlertOperation.swift */; };
|
||||||
AFA4932229E5EF2E001A9663 /* NotificationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4932129E5EF2E001A9663 /* NotificationHandler.swift */; };
|
AFA4932229E5EF2E001A9663 /* NotificationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4932129E5EF2E001A9663 /* NotificationHandler.swift */; };
|
||||||
AFA4933F29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4933E29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift */; };
|
AFA4933F29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4933E29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift */; };
|
||||||
@ -586,6 +588,7 @@
|
|||||||
EAB14BC327D9378D0012AB2C /* RuleAnyModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB14BC227D9378D0012AB2C /* RuleAnyModelProtocol.swift */; };
|
EAB14BC327D9378D0012AB2C /* RuleAnyModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB14BC227D9378D0012AB2C /* RuleAnyModelProtocol.swift */; };
|
||||||
EABFC1412763BB8D00E78B40 /* FormLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EABFC1402763BB8D00E78B40 /* FormLabel.swift */; };
|
EABFC1412763BB8D00E78B40 /* FormLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EABFC1402763BB8D00E78B40 /* FormLabel.swift */; };
|
||||||
EABFC152276913E800E78B40 /* FormLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EABFC151276913E800E78B40 /* FormLabelModel.swift */; };
|
EABFC152276913E800E78B40 /* FormLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EABFC151276913E800E78B40 /* FormLabelModel.swift */; };
|
||||||
|
EACCF38C2ABB346700E0F104 /* VDS-Interpreters.swift in Sources */ = {isa = PBXBuildFile; fileRef = EACCF38B2ABB346700E0F104 /* VDS-Interpreters.swift */; };
|
||||||
FD99130028E21E4900542CC3 /* RuleNotEqualsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9912FF28E21E4900542CC3 /* RuleNotEqualsModel.swift */; };
|
FD99130028E21E4900542CC3 /* RuleNotEqualsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9912FF28E21E4900542CC3 /* RuleNotEqualsModel.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
@ -871,8 +874,10 @@
|
|||||||
AF1C33722885D481006B1001 /* MVMCoreUIActionOpenPageHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUIActionOpenPageHandler.swift; sourceTree = "<group>"; };
|
AF1C33722885D481006B1001 /* MVMCoreUIActionOpenPageHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUIActionOpenPageHandler.swift; sourceTree = "<group>"; };
|
||||||
AF60A7F52892D2E300919EEB /* ActionDismissNotificationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionDismissNotificationModel.swift; sourceTree = "<group>"; };
|
AF60A7F52892D2E300919EEB /* ActionDismissNotificationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionDismissNotificationModel.swift; sourceTree = "<group>"; };
|
||||||
AF60A7F72892D34D00919EEB /* ActionDismissNotificationHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionDismissNotificationHandler.swift; sourceTree = "<group>"; };
|
AF60A7F72892D34D00919EEB /* ActionDismissNotificationHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionDismissNotificationHandler.swift; sourceTree = "<group>"; };
|
||||||
|
AF766D252A3CD4C600749099 /* UIAccessibilityTraits+Codable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIAccessibilityTraits+Codable.swift"; sourceTree = "<group>"; };
|
||||||
AF7E509629E477C0009DC2AD /* AlertHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertHandler.swift; sourceTree = "<group>"; };
|
AF7E509629E477C0009DC2AD /* AlertHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertHandler.swift; sourceTree = "<group>"; };
|
||||||
AF7E509729E477C0009DC2AD /* AlertController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertController.swift; sourceTree = "<group>"; };
|
AF7E509729E477C0009DC2AD /* AlertController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertController.swift; sourceTree = "<group>"; };
|
||||||
|
AF81182F2AB39B0900FAD1BA /* RawRepresentableCodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RawRepresentableCodable.swift; sourceTree = "<group>"; };
|
||||||
AFA4931F29E5CA73001A9663 /* AlertOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertOperation.swift; sourceTree = "<group>"; };
|
AFA4931F29E5CA73001A9663 /* AlertOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertOperation.swift; sourceTree = "<group>"; };
|
||||||
AFA4932129E5EF2E001A9663 /* NotificationHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationHandler.swift; sourceTree = "<group>"; };
|
AFA4932129E5EF2E001A9663 /* NotificationHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationHandler.swift; sourceTree = "<group>"; };
|
||||||
AFA4933E29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUILoggingDelegateProtocol.swift; sourceTree = "<group>"; };
|
AFA4933E29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUILoggingDelegateProtocol.swift; sourceTree = "<group>"; };
|
||||||
@ -1172,6 +1177,7 @@
|
|||||||
EAB14BC227D9378D0012AB2C /* RuleAnyModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyModelProtocol.swift; sourceTree = "<group>"; };
|
EAB14BC227D9378D0012AB2C /* RuleAnyModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyModelProtocol.swift; sourceTree = "<group>"; };
|
||||||
EABFC1402763BB8D00E78B40 /* FormLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormLabel.swift; sourceTree = "<group>"; };
|
EABFC1402763BB8D00E78B40 /* FormLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormLabel.swift; sourceTree = "<group>"; };
|
||||||
EABFC151276913E800E78B40 /* FormLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormLabelModel.swift; sourceTree = "<group>"; };
|
EABFC151276913E800E78B40 /* FormLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormLabelModel.swift; sourceTree = "<group>"; };
|
||||||
|
EACCF38B2ABB346700E0F104 /* VDS-Interpreters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VDS-Interpreters.swift"; sourceTree = "<group>"; };
|
||||||
FD9912FF28E21E4900542CC3 /* RuleNotEqualsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleNotEqualsModel.swift; sourceTree = "<group>"; };
|
FD9912FF28E21E4900542CC3 /* RuleNotEqualsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleNotEqualsModel.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
@ -1577,6 +1583,7 @@
|
|||||||
EA985C862981AB0F00F2FF2E /* VDS-Tilelet+Codable.swift */,
|
EA985C862981AB0F00F2FF2E /* VDS-Tilelet+Codable.swift */,
|
||||||
EA985C882981AB7100F2FF2E /* VDS-TextStyle.swift */,
|
EA985C882981AB7100F2FF2E /* VDS-TextStyle.swift */,
|
||||||
EA985C8A2983259900F2FF2E /* VDS-LabelAttributeModel.swift */,
|
EA985C8A2983259900F2FF2E /* VDS-LabelAttributeModel.swift */,
|
||||||
|
AF766D252A3CD4C600749099 /* UIAccessibilityTraits+Codable.swift */,
|
||||||
);
|
);
|
||||||
path = Extensions;
|
path = Extensions;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2149,6 +2156,7 @@
|
|||||||
D29DF2A821E7B2F9003B2FB9 /* MVMCoreUIConstants.m */,
|
D29DF2A821E7B2F9003B2FB9 /* MVMCoreUIConstants.m */,
|
||||||
0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */,
|
0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */,
|
||||||
0AF60F0826B3316E00AC3DB4 /* MVMCoreUIUtility+Extension.swift */,
|
0AF60F0826B3316E00AC3DB4 /* MVMCoreUIUtility+Extension.swift */,
|
||||||
|
AF81182F2AB39B0900FAD1BA /* RawRepresentableCodable.swift */,
|
||||||
);
|
);
|
||||||
path = Utility;
|
path = Utility;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2412,6 +2420,7 @@
|
|||||||
011B58EE23A2AA850085F53C /* ModelProtocols */,
|
011B58EE23A2AA850085F53C /* ModelProtocols */,
|
||||||
27559EFB27D691D3000836C1 /* ViewMaskingProtocol.swift */,
|
27559EFB27D691D3000836C1 /* ViewMaskingProtocol.swift */,
|
||||||
EAA7801F290081320057DFDF /* VDSMoleculeViewProtocol.swift */,
|
EAA7801F290081320057DFDF /* VDSMoleculeViewProtocol.swift */,
|
||||||
|
EACCF38B2ABB346700E0F104 /* VDS-Interpreters.swift */,
|
||||||
);
|
);
|
||||||
path = Protocols;
|
path = Protocols;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2743,6 +2752,7 @@
|
|||||||
0AE98BAF23FEF956004C5109 /* ExternalLink.swift in Sources */,
|
0AE98BAF23FEF956004C5109 /* ExternalLink.swift in Sources */,
|
||||||
012A88C4238D86E600FE3DA1 /* CarouselItemModelProtocol.swift in Sources */,
|
012A88C4238D86E600FE3DA1 /* CarouselItemModelProtocol.swift in Sources */,
|
||||||
D2E2A9A123E095AB000B42E6 /* ButtonModelProtocol.swift in Sources */,
|
D2E2A9A123E095AB000B42E6 /* ButtonModelProtocol.swift in Sources */,
|
||||||
|
AF8118302AB39B0900FAD1BA /* RawRepresentableCodable.swift in Sources */,
|
||||||
94C2D9AB23872EB50006CF46 /* LabelAttributeActionModel.swift in Sources */,
|
94C2D9AB23872EB50006CF46 /* LabelAttributeActionModel.swift in Sources */,
|
||||||
D22D8395241FB41200D3DF69 /* UIStackView+Extension.swift in Sources */,
|
D22D8395241FB41200D3DF69 /* UIStackView+Extension.swift in Sources */,
|
||||||
52B201D324081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift in Sources */,
|
52B201D324081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift in Sources */,
|
||||||
@ -2833,6 +2843,7 @@
|
|||||||
0A7EF86723D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift in Sources */,
|
0A7EF86723D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift in Sources */,
|
||||||
444FB7C32821B76B00DFE692 /* TitleLockupModel.swift in Sources */,
|
444FB7C32821B76B00DFE692 /* TitleLockupModel.swift in Sources */,
|
||||||
D29C94D5242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift in Sources */,
|
D29C94D5242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift in Sources */,
|
||||||
|
AF766D262A3CD4C600749099 /* UIAccessibilityTraits+Codable.swift in Sources */,
|
||||||
D260105323CEA61600764D80 /* ToggleModel.swift in Sources */,
|
D260105323CEA61600764D80 /* ToggleModel.swift in Sources */,
|
||||||
014AA72523C501E2006F3E93 /* ContainerModel.swift in Sources */,
|
014AA72523C501E2006F3E93 /* ContainerModel.swift in Sources */,
|
||||||
0A7EF86523D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift in Sources */,
|
0A7EF86523D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift in Sources */,
|
||||||
@ -2968,6 +2979,7 @@
|
|||||||
D28BA741248025A300B75CB8 /* TabBarModel.swift in Sources */,
|
D28BA741248025A300B75CB8 /* TabBarModel.swift in Sources */,
|
||||||
D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */,
|
D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */,
|
||||||
D2A92882241AAB67004E01C6 /* ScrollingViewController.swift in Sources */,
|
D2A92882241AAB67004E01C6 /* ScrollingViewController.swift in Sources */,
|
||||||
|
EACCF38C2ABB346700E0F104 /* VDS-Interpreters.swift in Sources */,
|
||||||
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */,
|
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */,
|
||||||
0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */,
|
0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */,
|
||||||
D2FA83D22513EA6900564112 /* NotificationXButton.swift in Sources */,
|
D2FA83D22513EA6900564112 /* NotificationXButton.swift in Sources */,
|
||||||
|
|||||||
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "1500"
|
||||||
|
version = "1.7">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "D29DF0CB21E404D4003B2FB9"
|
||||||
|
BuildableName = "MVMCoreUI.framework"
|
||||||
|
BlueprintName = "MVMCoreUI"
|
||||||
|
ReferencedContainer = "container:MVMCoreUI.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
shouldAutocreateTestPlan = "YES">
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
launchStyle = "0"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
allowLocationSimulation = "YES">
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES">
|
||||||
|
<MacroExpansion>
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "D29DF0CB21E404D4003B2FB9"
|
||||||
|
BuildableName = "MVMCoreUI.framework"
|
||||||
|
BlueprintName = "MVMCoreUI"
|
||||||
|
ReferencedContainer = "container:MVMCoreUI.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</MacroExpansion>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
||||||
@ -51,30 +51,33 @@ public class AlertOperation: MVMCoreOperation {
|
|||||||
// Observe for when it is removed.
|
// Observe for when it is removed.
|
||||||
observeForCurrentAlertViewDismissal()
|
observeForCurrentAlertViewDismissal()
|
||||||
|
|
||||||
// Adds the presentation to the animation queue.
|
Task(priority: .high) {
|
||||||
let blockingOperation = MVMCoreOperation()
|
guard let viewControllerToPresentOn = await NavigationHandler.shared().getViewControllerToPresentOn() else {
|
||||||
self.blockingOperation = blockingOperation
|
markAsFinished()
|
||||||
Task { @MainActor in
|
return
|
||||||
MVMCoreNavigationHandler.shared()?.present(alertController, animated: true, delegate: nil) { [weak self] in
|
|
||||||
guard let self = self else {
|
|
||||||
blockingOperation.markAsFinished()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Task {
|
|
||||||
// We finished but it was not displayed yet. It's possible that it was cancelled. Finish this task
|
|
||||||
if await !self.properties.getIsDisplayed() {
|
|
||||||
self.markAsFinished()
|
|
||||||
} else {
|
|
||||||
(CoreUIObject.sharedInstance()?.loggingDelegate as? MVMCoreUILoggingDelegateProtocol)?.logAlert(with: self.alertObject)
|
|
||||||
if self.isCancelled {
|
|
||||||
await self.dismissAlertView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block navigations until this alert is removed.
|
// Presents the alert.
|
||||||
MVMCoreNavigationHandler.shared()?.addNavigationOperation(blockingOperation)
|
let presentationOperation = await NavigationOperation(with: .present(viewController: alertController, onController: viewControllerToPresentOn), tryToReplace: false)
|
||||||
|
|
||||||
|
let blockingOperation = MVMCoreOperation()
|
||||||
|
blockingOperation.addDependency(presentationOperation)
|
||||||
|
self.blockingOperation = blockingOperation
|
||||||
|
|
||||||
|
// Block other navigation until this alert is removed.
|
||||||
|
NavigationHandler.shared().navigationQueue.addOperation(blockingOperation)
|
||||||
|
|
||||||
|
await NavigationHandler.shared().navigate(with: presentationOperation)
|
||||||
|
|
||||||
|
// We finished but it was not displayed yet. It's possible that it was cancelled. Finish this task
|
||||||
|
if await !self.properties.getIsDisplayed() {
|
||||||
|
self.markAsFinished()
|
||||||
|
} else {
|
||||||
|
(MVMCoreObject.sharedInstance()?.loggingDelegate as? MVMCoreUILoggingDelegateProtocol)?.logAlert(with: self.alertObject)
|
||||||
|
if self.isCancelled {
|
||||||
|
await self.dismissAlertView()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,10 +92,13 @@ public class AlertOperation: MVMCoreOperation {
|
|||||||
private func dismissAlertView() async {
|
private func dismissAlertView() async {
|
||||||
guard await properties.getIsDisplayed() else { return }
|
guard await properties.getIsDisplayed() else { return }
|
||||||
await withCheckedContinuation { continuation in
|
await withCheckedContinuation { continuation in
|
||||||
Task { @MainActor in
|
Task {
|
||||||
MVMCoreNavigationHandler.shared()?.dismiss(alertController, animated: true, delegate: nil) {
|
let dismissOperation = await NavigationOperation(with: .dismiss(viewController: alertController))
|
||||||
continuation.resume()
|
dismissOperation.queuePriority = .veryHigh
|
||||||
}
|
let task = Task(priority: .high) { await NavigationHandler.shared().navigate(with: dismissOperation) }
|
||||||
|
blockingOperation?.markAsFinished()
|
||||||
|
_ = await task.result
|
||||||
|
continuation.resume()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,29 +8,32 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import VDSColorTokens
|
import VDSColorTokens
|
||||||
|
import VDS
|
||||||
|
import MVMCore
|
||||||
|
|
||||||
public typealias FacadeElements = (fill: UIColor?, text: UIColor?, border: UIColor?)
|
public typealias FacadeElements = (fill: UIColor?, text: UIColor?, border: UIColor?)
|
||||||
|
|
||||||
|
|
||||||
open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWatcherFieldProtocol {
|
open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWatcherFieldProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
//Making static property as class property so that subclasses can override getter function of the property
|
//Making static property as class property so that subclasses can override getter function of the property
|
||||||
open class var identifier: String { "button" }
|
open class var identifier: String { "button" }
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public var accessibilityText: String?
|
public var accessibilityText: String?
|
||||||
public var title: String
|
public var title: String
|
||||||
public var action: ActionModelProtocol
|
public var action: ActionModelProtocol
|
||||||
public var enabled: Bool = true
|
public var enabled: Bool = true
|
||||||
public var width: CGFloat?
|
public var width: CGFloat?
|
||||||
public var style: Styler.Button.Style? {
|
public var style: Use? {
|
||||||
didSet {
|
didSet {
|
||||||
guard let style = style else { return }
|
guard let style = style else { return }
|
||||||
setFacade(by: style)
|
setFacade(by: style)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public var size: Styler.Button.Size? = .standard
|
public var size: VDS.Button.Size = .large
|
||||||
public var groupName: String = ""
|
public var groupName: String = ""
|
||||||
public var inverted: Bool = false
|
public var inverted: Bool = false
|
||||||
|
|
||||||
@ -158,14 +161,14 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
disabledBorderColor_inverted = Color(uiColor: VDSColor.interactiveDisabledOndark)
|
disabledBorderColor_inverted = Color(uiColor: VDSColor.interactiveDisabledOndark)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setFacade(by style: Styler.Button.Style) {
|
public func setFacade(by style: VDS.Use) {
|
||||||
|
|
||||||
switch style {
|
switch style {
|
||||||
case .primary:
|
case .primary:
|
||||||
setPrimaryFacade()
|
setPrimaryFacade()
|
||||||
|
|
||||||
case .secondary:
|
case .secondary:
|
||||||
setSecondaryFacade()
|
setSecondaryFacade()
|
||||||
|
@unknown default:
|
||||||
|
setPrimaryFacade()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,6 +177,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
@ -201,23 +205,24 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
title = try typeContainer.decode(String.self, forKey: .title)
|
title = try typeContainer.decode(String.self, forKey: .title)
|
||||||
action = try typeContainer.decodeModel(codingKey: .action)
|
action = try typeContainer.decodeModel(codingKey: .action)
|
||||||
|
|
||||||
///Style captured from the JSON
|
///Style captured from the JSON
|
||||||
if let style = try typeContainer.decodeIfPresent(Styler.Button.Style.self, forKey: .style){
|
if let style = try typeContainer.decodeIfPresent(Use.self, forKey: .style) {
|
||||||
self.style = style
|
self.style = style
|
||||||
setFacade(by: style)
|
setFacade(by: style)
|
||||||
} else if let style = decoder.context?.value(forKey: CodingKeys.style.stringValue) as? Styler.Button.Style { ///Reading the style param from context which is set is molecules, ex: TwoButtonView
|
} else if let style = decoder.context?.value(forKey: CodingKeys.style.stringValue) as? Use { ///Reading the style param from context which is set is molecules, ex: TwoButtonView
|
||||||
self.style = style
|
self.style = style
|
||||||
setFacade(by: style)
|
setFacade(by: style)
|
||||||
} else { ///Default style
|
} else { ///Default style
|
||||||
setFacade(by: .primary)
|
setFacade(by: .primary)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let size = try typeContainer.decodeIfPresent(Styler.Button.Size.self, forKey: .size) {
|
if let size = try typeContainer.decodeIfPresent(VDS.Button.Size.self, forKey: .size) {
|
||||||
self.size = size
|
self.size = size
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,6 +268,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(title, forKey: .title)
|
try container.encode(title, forKey: .title)
|
||||||
try container.encode(enabled, forKey: .enabled)
|
try container.encode(enabled, forKey: .enabled)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol, Enablea
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "caretLink"
|
public static var identifier: String = "caretLink"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public var title: String
|
public var title: String
|
||||||
@ -41,6 +42,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol, Enablea
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
case title
|
case title
|
||||||
@ -61,6 +63,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol, Enablea
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
title = try typeContainer.decode(String.self, forKey: .title)
|
title = try typeContainer.decode(String.self, forKey: .title)
|
||||||
@ -94,6 +97,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol, Enablea
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(title, forKey: .title)
|
try container.encode(title, forKey: .title)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
|
|||||||
@ -14,8 +14,9 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "imageButton"
|
public static var identifier: String = "imageButton"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
public var image: ImageViewModel?
|
public var image: ImageViewModel?
|
||||||
|
|
||||||
public var accessibilityText: String?
|
public var accessibilityText: String?
|
||||||
@ -34,6 +35,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case image
|
case image
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
@ -52,6 +54,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image)
|
image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image)
|
||||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
@ -77,6 +80,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(image, forKey: .image)
|
try container.encodeIfPresent(image, forKey: .image)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
|
|||||||
@ -11,30 +11,26 @@ import UIKit
|
|||||||
|
|
||||||
open class ExternalLink: Link {
|
open class ExternalLink: Link {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
open var exportImageView: UIImageView?
|
||||||
public var exportImageView: UIImageView?
|
open var exportImageHeight: NSLayoutConstraint?
|
||||||
|
open var exportImageWidth: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - MoleculeViewProtocol
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
open override func viewModelDidUpdate() {
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
super.viewModelDidUpdate()
|
||||||
super.set(with: model, delegateObject, additionalData)
|
exportImageView?.tintColor = textColor
|
||||||
|
exportImageWidth?.constant = textStyle.lineHeight
|
||||||
guard let model = model as? ExternalLinkModel else { return }
|
exportImageHeight?.constant = textStyle.lineHeight
|
||||||
|
|
||||||
exportImageView?.tintColor = titleColor(for: model.enabled ? .normal : .disabled)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
open override func setupView() {
|
|
||||||
super.setupView()
|
|
||||||
|
|
||||||
|
open override func setup() {
|
||||||
|
super.setup()
|
||||||
|
contentHorizontalAlignment = .left
|
||||||
|
|
||||||
let image = MVMCoreUIUtility.imageNamed("externalLink")
|
let image = MVMCoreUIUtility.imageNamed("externalLink")
|
||||||
exportImageView = UIImageView(image: image?.withRenderingMode(.alwaysTemplate))
|
exportImageView = UIImageView(image: image?.withRenderingMode(.alwaysTemplate))
|
||||||
|
|
||||||
@ -46,10 +42,10 @@ open class ExternalLink: Link {
|
|||||||
addSubview(exportIcon)
|
addSubview(exportIcon)
|
||||||
trailingAnchor.constraint(greaterThanOrEqualTo: exportIcon.trailingAnchor).isActive = true
|
trailingAnchor.constraint(greaterThanOrEqualTo: exportIcon.trailingAnchor).isActive = true
|
||||||
|
|
||||||
if let titleLabel = titleLabel {
|
exportImageHeight = exportIcon.heightAnchor.constraint(equalToConstant: textStyle.pointSize).activate()
|
||||||
let dimension = titleLabel.font.pointSize
|
exportImageWidth = exportIcon.widthAnchor.constraint(equalToConstant: textStyle.pointSize).activate()
|
||||||
exportIcon.heightAnchor.constraint(equalToConstant: dimension).isActive = true
|
|
||||||
exportIcon.widthAnchor.constraint(equalToConstant: dimension).isActive = true
|
if let titleLabel {
|
||||||
exportIcon.leadingAnchor.constraint(equalTo: titleLabel.trailingAnchor, constant: 4).isActive = true
|
exportIcon.leadingAnchor.constraint(equalTo: titleLabel.trailingAnchor, constant: 4).isActive = true
|
||||||
exportIcon.bottomAnchor.constraint(equalTo: titleLabel.lastBaselineAnchor, constant: 3).isActive = true
|
exportIcon.bottomAnchor.constraint(equalTo: titleLabel.lastBaselineAnchor, constant: 3).isActive = true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,83 +8,59 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import VDSColorTokens
|
import VDSColorTokens
|
||||||
|
import VDS
|
||||||
|
|
||||||
|
open class Link: VDS.TextLink, VDSMoleculeViewProtocol {
|
||||||
|
|
||||||
@objcMembers open class Link: Button {
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Draw
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
open var viewModel: LinkModel!
|
||||||
|
open var delegateObject: MVMCoreUIDelegateObject?
|
||||||
|
open var additionalData: [AnyHashable : Any]?
|
||||||
|
|
||||||
open override func draw(_ rect: CGRect) {
|
//--------------------------------------------------
|
||||||
|
// MARK: - Public Functions
|
||||||
|
//--------------------------------------------------
|
||||||
|
open func viewModelDidUpdate() {
|
||||||
|
isEnabled = viewModel.enabled
|
||||||
|
size = viewModel.size
|
||||||
|
text = viewModel.title
|
||||||
|
surface = viewModel.surface
|
||||||
|
|
||||||
guard let textRect = titleLabel?.frame,
|
onClick = { [weak self] control in
|
||||||
let context = UIGraphicsGetCurrentContext()
|
guard let self else { return }
|
||||||
else { return }
|
MVMCoreUIActionHandler.performActionUnstructured(with: self.viewModel.action,
|
||||||
|
sourceModel: self.viewModel,
|
||||||
|
additionalData: self.additionalData,
|
||||||
|
delegateObject: self.delegateObject)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Overrides
|
||||||
|
//--------------------------------------------------
|
||||||
|
open override func updateAccessibility() {
|
||||||
|
super.updateAccessibility()
|
||||||
|
|
||||||
// Set line to the same color as the text
|
guard let viewModel = viewModel else { return }
|
||||||
if let color = titleLabel?.textColor?.cgColor {
|
if let accessibilityText = viewModel.accessibilityText {
|
||||||
context.setStrokeColor(color)
|
self.accessibilityLabel = accessibilityText
|
||||||
}
|
}
|
||||||
|
|
||||||
// x should be according to the text, not the button
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
let x = textRect.origin.x
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
|
||||||
// Line is 0 point below the text
|
|
||||||
let y = textRect.origin.y + textRect.size.height
|
|
||||||
|
|
||||||
context.move(to: CGPoint(x: x, y: y))
|
|
||||||
context.addLine(to: CGPoint(x: x + textRect.size.width, y: y))
|
|
||||||
context.strokePath()
|
|
||||||
}
|
|
||||||
|
|
||||||
open override var intrinsicContentSize: CGSize {
|
|
||||||
guard let size = titleLabel?.intrinsicContentSize else { return super.intrinsicContentSize }
|
|
||||||
return CGSize(width: size.width, height: size.height + 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - MoleculeViewProtocol
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
|
||||||
super.set(with: model, delegateObject, additionalData)
|
|
||||||
|
|
||||||
guard let model = model as? LinkModel else { return }
|
|
||||||
|
|
||||||
setTitle(model.title, for: .normal)
|
|
||||||
if let accessibilityText = model.accessibilityText {
|
|
||||||
accessibilityLabel = accessibilityText
|
|
||||||
}
|
}
|
||||||
setTitleColor((model.inverted ? model.enabledColor_inverted : model.enabledColor).uiColor, for: .normal)
|
|
||||||
setTitleColor((model.inverted ? model.disabledColor_inverted : model.disabledColor).uiColor, for: .disabled)
|
|
||||||
setTitleColor((model.inverted ? model.activeColor_inverted : model.activeColor).uiColor, for: .highlighted)
|
|
||||||
isEnabled = model.enabled
|
|
||||||
titleLabel?.font = model.getFont(model.size)
|
|
||||||
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { 31 }
|
//--------------------------------------------------
|
||||||
}
|
// MARK: - MVMCoreViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { 31 }
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
open func updateView(_ size: CGFloat) { }
|
||||||
extension Link {
|
|
||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open func setupView() {}
|
||||||
super.updateView(size)
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func setupView() {
|
|
||||||
super.setupView()
|
|
||||||
backgroundColor = .clear
|
|
||||||
contentMode = .redraw
|
|
||||||
setTitleColor(VDSColor.elementsPrimaryOnlight, for: .normal)
|
|
||||||
setTitleColor(VDSColor.interactiveDisabledOnlight, for: .disabled)
|
|
||||||
setTitleColor(VDSColor.interactiveActiveOnlight, for: .highlighted)
|
|
||||||
titleLabel?.numberOfLines = 1
|
|
||||||
titleLabel?.lineBreakMode = .byTruncatingTail
|
|
||||||
titleLabel?.textAlignment = .left
|
|
||||||
contentHorizontalAlignment = .left
|
|
||||||
contentVerticalAlignment = .top
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreUIViewConstrainingProtocol
|
// MARK: - MVMCoreUIViewConstrainingProtocol
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import VDSColorTokens
|
import VDS
|
||||||
|
|
||||||
open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableModelProtocol {
|
open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -15,6 +15,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public class var identifier: String { "link" }
|
public class var identifier: String { "link" }
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
@ -22,15 +23,9 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
|
|||||||
public var accessibilityText: String?
|
public var accessibilityText: String?
|
||||||
public var action: ActionModelProtocol
|
public var action: ActionModelProtocol
|
||||||
public var enabled = true
|
public var enabled = true
|
||||||
public var enabledColor = Color(uiColor: VDSColor.elementsPrimaryOnlight)
|
|
||||||
public var enabledColor_inverted = Color(uiColor: VDSColor.elementsPrimaryOndark)
|
|
||||||
public var disabledColor = Color(uiColor: VDSColor.interactiveDisabledOnlight)
|
|
||||||
public var disabledColor_inverted = Color(uiColor: VDSColor.interactiveDisabledOndark)
|
|
||||||
public var activeColor = Color(uiColor: VDSColor.interactiveActiveOnlight)
|
|
||||||
public var activeColor_inverted = Color(uiColor: VDSColor.interactiveActiveOndark)
|
|
||||||
|
|
||||||
public var inverted = false
|
public var inverted = false
|
||||||
public var size:linkFontSize = linkFontSize.small
|
public var size: TextLink.Size = .small
|
||||||
|
|
||||||
public var shouldMaskRecordedView: Bool? = false
|
public var shouldMaskRecordedView: Bool? = false
|
||||||
|
|
||||||
@ -48,6 +43,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
@ -55,34 +51,10 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
|
|||||||
case title
|
case title
|
||||||
case action
|
case action
|
||||||
case enabled
|
case enabled
|
||||||
case enabledColor
|
|
||||||
case enabledColor_inverted
|
|
||||||
case disabledColor
|
|
||||||
case disabledColor_inverted
|
|
||||||
case activeColor
|
|
||||||
case activeColor_inverted
|
|
||||||
case inverted
|
case inverted
|
||||||
case size
|
case size
|
||||||
case shouldMaskRecordedView
|
case shouldMaskRecordedView
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum linkFontSize: String, Codable {
|
|
||||||
case small
|
|
||||||
case large
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Method
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
func getFont(_ type: linkFontSize) -> UIFont {
|
|
||||||
switch type {
|
|
||||||
case .small:
|
|
||||||
return MFStyler.fontRegularBodySmall()
|
|
||||||
case .large:
|
|
||||||
return MFStyler.fontRegularBodyLarge()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Codec
|
// MARK: - Codec
|
||||||
@ -91,6 +63,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
title = try typeContainer.decode(String.self, forKey: .title)
|
title = try typeContainer.decode(String.self, forKey: .title)
|
||||||
@ -105,30 +78,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
|
|||||||
self.inverted = inverted
|
self.inverted = inverted
|
||||||
}
|
}
|
||||||
|
|
||||||
if let enabledColor = try typeContainer.decodeIfPresent(Color.self, forKey: .enabledColor) {
|
if let size = try typeContainer.decodeIfPresent(TextLink.Size.self, forKey: .size) {
|
||||||
self.enabledColor = enabledColor
|
|
||||||
}
|
|
||||||
|
|
||||||
if let enabledColor_inverted = try typeContainer.decodeIfPresent(Color.self, forKey: .enabledColor_inverted) {
|
|
||||||
self.enabledColor_inverted = enabledColor_inverted
|
|
||||||
}
|
|
||||||
|
|
||||||
if let disabledColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor) {
|
|
||||||
self.disabledColor = disabledColor
|
|
||||||
}
|
|
||||||
|
|
||||||
if let disabledColor_inverted = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor_inverted) {
|
|
||||||
self.disabledColor_inverted = disabledColor_inverted
|
|
||||||
}
|
|
||||||
|
|
||||||
if let activeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .activeColor) {
|
|
||||||
self.activeColor = activeColor
|
|
||||||
}
|
|
||||||
|
|
||||||
if let activeColor_inverted = try typeContainer.decodeIfPresent(Color.self, forKey: .activeColor_inverted) {
|
|
||||||
self.activeColor_inverted = activeColor_inverted
|
|
||||||
}
|
|
||||||
if let size = try typeContainer.decodeIfPresent(linkFontSize.self, forKey: .size) {
|
|
||||||
self.size = size
|
self.size = size
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +87,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(title, forKey: .title)
|
try container.encode(title, forKey: .title)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
@ -144,13 +95,11 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
|
|||||||
try container.encodeModel(action, forKey: .action)
|
try container.encodeModel(action, forKey: .action)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
try container.encode(enabled, forKey: .enabled)
|
try container.encode(enabled, forKey: .enabled)
|
||||||
try container.encode(enabledColor, forKey: .enabledColor)
|
|
||||||
try container.encode(enabledColor_inverted, forKey: .enabledColor_inverted)
|
|
||||||
try container.encode(disabledColor, forKey: .disabledColor)
|
|
||||||
try container.encode(disabledColor_inverted, forKey: .disabledColor_inverted)
|
|
||||||
try container.encode(activeColor, forKey: .activeColor)
|
|
||||||
try container.encode(activeColor_inverted, forKey: .activeColor_inverted)
|
|
||||||
try container.encodeIfPresent(size, forKey: .size)
|
try container.encodeIfPresent(size, forKey: .size)
|
||||||
try container.encode(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
|
try container.encode(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension LinkModel {
|
||||||
|
public var surface: Surface { inverted ? .dark : .light }
|
||||||
|
}
|
||||||
|
|||||||
@ -8,223 +8,68 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import VDSColorTokens
|
import VDSColorTokens
|
||||||
|
import VDS
|
||||||
|
import MVMCore
|
||||||
|
import Combine
|
||||||
|
|
||||||
open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
|
open class PillButton: VDS.Button, MVMCoreUIViewConstrainingProtocol, MFButtonProtocol, VDSMoleculeViewProtocol {
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
/// Used to size the button.
|
open var viewModel: ButtonModel!
|
||||||
var size = MVMCoreUIUtility.getWidth()
|
public var delegateObject: MVMCoreUIDelegateObject?
|
||||||
|
public var additionalData: [AnyHashable: Any]?
|
||||||
var buttonModel: ButtonModel? {
|
|
||||||
get { model as? ButtonModel }
|
internal var onClickCancellable: Cancellable?
|
||||||
}
|
|
||||||
|
|
||||||
/// Need to re-style on set.
|
|
||||||
open override var isEnabled: Bool {
|
|
||||||
didSet { style(with: buttonModel) }
|
|
||||||
}
|
|
||||||
|
|
||||||
open var buttonSize: Styler.Button.Size = .standard {
|
|
||||||
didSet { buttonModel?.size = buttonSize }
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Constraints
|
// MARK: - VDSMoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var widthConstraint: NSLayoutConstraint?
|
open func viewModelDidUpdate() {
|
||||||
public var minimumWidthConstraint: NSLayoutConstraint?
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Initializers
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
@objc public convenience init(asPrimaryButton isPrimary: Bool, makeTiny istiny: Bool) {
|
|
||||||
let model = ButtonModel(with: "", action: ActionNoopModel())
|
|
||||||
model.style = isPrimary ? .primary : .secondary
|
|
||||||
model.size = istiny ? .tiny : .standard
|
|
||||||
self.init(model: model, nil, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Computed Properties
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
public var enabledTitleColor: UIColor? {
|
|
||||||
get { titleColor(for: .normal) }
|
|
||||||
set { setTitleColor(newValue, for: .normal) }
|
|
||||||
}
|
|
||||||
|
|
||||||
public var disabledTitleColor: UIColor? {
|
|
||||||
get { titleColor(for: .disabled) }
|
|
||||||
set { setTitleColor(newValue, for: .disabled) }
|
|
||||||
}
|
|
||||||
|
|
||||||
public var borderColor: UIColor? {
|
|
||||||
get {
|
|
||||||
guard let currentColor = layer.borderColor else { return nil }
|
|
||||||
return UIColor(cgColor: currentColor)
|
|
||||||
}
|
|
||||||
set { layer.borderColor = newValue?.cgColor }
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Methods
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
/// The primary styling for a button. Should be used for main buttons
|
|
||||||
public func stylePrimary() {
|
|
||||||
let buttonModel = ButtonModel(primaryButtonWith: "", action: ActionNoopModel())
|
|
||||||
style(with: buttonModel)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The secondary styling for a button. Should be used for secondary buttons
|
|
||||||
public func styleSecondary() {
|
|
||||||
let buttonModel = ButtonModel(secondaryButtonWith: "", action: ActionNoopModel())
|
|
||||||
style(with: buttonModel)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Styles the button based on the model style
|
|
||||||
private func style(with model: ButtonModel?) {
|
|
||||||
|
|
||||||
layer.borderWidth = model?.style == .secondary ? 1 : 0
|
|
||||||
|
|
||||||
if let titleColor = model?.enabledColors.text {
|
|
||||||
enabledTitleColor = titleColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let disabledTitleColor = model?.disabledColors.text {
|
text = viewModel.title
|
||||||
self.disabledTitleColor = disabledTitleColor
|
isEnabled = viewModel.enabled
|
||||||
|
size = viewModel.size
|
||||||
|
use = viewModel.style ?? .primary
|
||||||
|
surface = viewModel.inverted ? .dark : .light
|
||||||
|
if let accessibilityText = viewModel.accessibilityText {
|
||||||
|
accessibilityLabel = accessibilityText
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
// Useful to detect with isHittable when performing UI testing.
|
|
||||||
isAccessibilityElement = isEnabled
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if isEnabled {
|
|
||||||
if let fillColor = model?.enabledColors.fill {
|
|
||||||
backgroundColor = fillColor
|
|
||||||
}
|
|
||||||
|
|
||||||
if let borderColor = model?.enabledColors.border {
|
set(with: viewModel.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
self.borderColor = borderColor
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if let fillColor = model?.disabledColors.fill {
|
|
||||||
backgroundColor = fillColor
|
|
||||||
}
|
|
||||||
|
|
||||||
if let borderColor = model?.disabledColors.border {
|
|
||||||
self.borderColor = borderColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func getInnerPadding() -> CGFloat {
|
|
||||||
buttonSize.getHeight() / 2.0
|
|
||||||
}
|
|
||||||
|
|
||||||
private func getContentEdgeInsets() -> UIEdgeInsets {
|
viewModel.updateUI = { [weak self] in
|
||||||
var verticalPadding = 0.0
|
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
||||||
var horizontalPadding = 0.0
|
guard let self = self else { return }
|
||||||
switch buttonSize {
|
self.isEnabled = self.viewModel.enabled
|
||||||
case .standard:
|
})
|
||||||
verticalPadding = Padding.Three
|
|
||||||
horizontalPadding = Padding.Five
|
|
||||||
break
|
|
||||||
case .small:
|
|
||||||
verticalPadding = Padding.Two
|
|
||||||
horizontalPadding = Padding.Four
|
|
||||||
break
|
|
||||||
case .tiny:
|
|
||||||
verticalPadding = Padding.One
|
|
||||||
horizontalPadding = Padding.Two
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
return UIEdgeInsets(top: verticalPadding, left: horizontalPadding, bottom: verticalPadding, right: horizontalPadding)
|
|
||||||
|
FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate)
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
// The button will get styled in the enable check in super.
|
return (model as? ButtonModel)?.size.height
|
||||||
super.set(with: model, delegateObject, additionalData)
|
|
||||||
|
|
||||||
guard let model = model as? ButtonModel else { return }
|
|
||||||
|
|
||||||
setTitle(model.title, for: .normal)
|
|
||||||
if let accessibilityText = model.accessibilityText {
|
|
||||||
accessibilityLabel = accessibilityText
|
|
||||||
}
|
|
||||||
|
|
||||||
if let size = model.size {
|
|
||||||
buttonSize = size
|
|
||||||
}
|
|
||||||
|
|
||||||
model.updateUI = { [weak self] in
|
|
||||||
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
|
||||||
self?.enableField(model.enabled)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open func updateView(_ size: CGFloat) {}
|
||||||
return (model as? ButtonModel)?.size?.getHeight()
|
|
||||||
|
open override func setup() {
|
||||||
|
super.setup()
|
||||||
|
setupView()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open func setupView() {}
|
||||||
super.updateView(size)
|
|
||||||
self.size = size
|
|
||||||
|
|
||||||
switch buttonSize {
|
|
||||||
case .tiny:
|
|
||||||
titleLabel?.font = Styler.Font.BoldMicro.getFont(false)
|
|
||||||
case .small:
|
|
||||||
titleLabel?.font = Styler.Font.BoldBodySmall.getFont(false)
|
|
||||||
case .standard:
|
|
||||||
titleLabel?.font = Styler.Font.BoldBodyLarge.getFont(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
layer.cornerRadius = getInnerPadding()
|
|
||||||
contentEdgeInsets = getContentEdgeInsets()
|
|
||||||
|
|
||||||
if let contraint = buttonModel?.width {
|
|
||||||
|
|
||||||
if widthConstraint == nil {
|
|
||||||
widthConstraint = widthAnchor.constraint(equalToConstant: contraint)
|
|
||||||
} else if widthConstraint?.constant != contraint {
|
|
||||||
widthConstraint?.constant = contraint
|
|
||||||
}
|
|
||||||
widthConstraint?.isActive = true
|
|
||||||
minimumWidthConstraint?.isActive = false
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if minimumWidthConstraint == nil {
|
|
||||||
minimumWidthConstraint = widthAnchor.constraint(greaterThanOrEqualToConstant: buttonSize.minimumWidth())
|
|
||||||
} else {
|
|
||||||
minimumWidthConstraint?.constant = buttonSize.minimumWidth()
|
|
||||||
}
|
|
||||||
minimumWidthConstraint?.isActive = true
|
|
||||||
widthConstraint?.isActive = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func setupView() {
|
|
||||||
super.setupView()
|
|
||||||
|
|
||||||
titleLabel?.numberOfLines = 1
|
|
||||||
titleLabel?.lineBreakMode = .byTruncatingTail
|
|
||||||
titleLabel?.textAlignment = .center
|
|
||||||
contentHorizontalAlignment = .center
|
|
||||||
stylePrimary()
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - MVMCoreUIViewConstrainingProtocol
|
// MARK: - MVMCoreUIViewConstrainingProtocol
|
||||||
@ -232,7 +77,21 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
|
|
||||||
open func horizontalAlignment() -> UIStackView.Alignment { .center }
|
open func horizontalAlignment() -> UIStackView.Alignment { .center }
|
||||||
|
|
||||||
public func enableField(_ enable: Bool) {
|
//--------------------------------------------------
|
||||||
isEnabled = enable
|
// MARK: - Action
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
open func set(with actionModel: ActionModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
onClick = { [weak self] control in
|
||||||
|
guard let self = self, let viewModel = self.viewModel else { return }
|
||||||
|
Task(priority: .userInitiated) {
|
||||||
|
try await Self.performButtonAction(with: viewModel.action, button: self, delegateObject: delegateObject, additionalData: additionalData, sourceModel: viewModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class func performButtonAction(with model: ActionModelProtocol, button: MFButtonProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, sourceModel: MoleculeModelProtocol? = nil) async throws {
|
||||||
|
guard delegateObject?.buttonDelegate?.button?(button, shouldPerformActionWithMap: model.toJSON(), additionalData: additionalData) ?? true else { return }
|
||||||
|
try await (delegateObject?.actionDelegate as? ActionDelegateProtocol)?.performAction(with: model, additionalData: MVMCoreUIActionHandler.add(sourceModel: sourceModel, to: additionalData), delegateObject: delegateObject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,11 +11,14 @@ import MVMCore
|
|||||||
|
|
||||||
@objcMembers public class TagModel: MoleculeModelProtocol {
|
@objcMembers public class TagModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "tag"
|
public static var identifier: String = "tag"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var label: LabelModel
|
public var label: LabelModel
|
||||||
public var action: ActionModelProtocol?
|
public var action: ActionModelProtocol?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case label
|
case label
|
||||||
case action
|
case action
|
||||||
@ -38,6 +41,7 @@ import MVMCore
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
label = try typeContainer.decode(LabelModel.self, forKey: .label)
|
label = try typeContainer.decode(LabelModel.self, forKey: .label)
|
||||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
@ -45,6 +49,7 @@ import MVMCore
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(label, forKey: .label)
|
try container.encode(label, forKey: .label)
|
||||||
try container.encodeModelIfPresent(action, forKey: .action)
|
try container.encodeModelIfPresent(action, forKey: .action)
|
||||||
|
|||||||
@ -11,10 +11,13 @@ import MVMCore
|
|||||||
|
|
||||||
@objcMembers public class TagsModel: MoleculeModelProtocol {
|
@objcMembers public class TagsModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "tags"
|
public static var identifier: String = "tags"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var tags: [TagModel]
|
public var tags: [TagModel]
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case tags
|
case tags
|
||||||
@ -30,12 +33,14 @@ import MVMCore
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
tags = try typeContainer.decode([TagModel].self, forKey: .tags)
|
tags = try typeContainer.decode([TagModel].self, forKey: .tags)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(tags, forKey: .tags)
|
try container.encode(tags, forKey: .tags)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public class var identifier: String { "" }
|
public class var identifier: String { "" }
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
@ -63,6 +64,7 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
@ -138,6 +140,7 @@ import Foundation
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
||||||
@ -166,6 +169,7 @@ import Foundation
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
|
|||||||
@ -144,7 +144,9 @@ import MVMCore
|
|||||||
picker.displayedPropertyKeys = ["phoneNumbers"]
|
picker.displayedPropertyKeys = ["phoneNumbers"]
|
||||||
picker.predicateForEnablingContact = NSPredicate(format: "phoneNumbers.@count > 0")
|
picker.predicateForEnablingContact = NSPredicate(format: "phoneNumbers.@count > 0")
|
||||||
picker.predicateForSelectionOfProperty = NSPredicate(format: "key == 'phoneNumbers'")
|
picker.predicateForSelectionOfProperty = NSPredicate(format: "key == 'phoneNumbers'")
|
||||||
MVMCoreNavigationHandler.shared()?.present(picker, animated: true)
|
Task(priority: .userInitiated) {
|
||||||
|
await NavigationHandler.shared().present(viewController: picker, animated: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "checkbox"
|
public static var identifier: String = "checkbox"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public var selected: Bool = false
|
public var selected: Bool = false
|
||||||
@ -51,6 +52,7 @@
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
case checked
|
case checked
|
||||||
@ -107,6 +109,8 @@
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
|
||||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
if let borderWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .borderWidth) {
|
if let borderWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .borderWidth) {
|
||||||
@ -180,6 +184,7 @@
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(groupName, forKey: .groupName)
|
try container.encodeIfPresent(groupName, forKey: .groupName)
|
||||||
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
|
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
|
||||||
|
|||||||
@ -14,6 +14,8 @@ open class HeartModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "heart"
|
public static var identifier: String = "heart"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public var isActive: Bool = false
|
public var isActive: Bool = false
|
||||||
@ -27,6 +29,7 @@ open class HeartModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
@ -49,6 +52,8 @@ open class HeartModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
|
||||||
if let isActive = try typeContainer.decodeIfPresent(Bool.self, forKey: .isActive) {
|
if let isActive = try typeContainer.decodeIfPresent(Bool.self, forKey: .isActive) {
|
||||||
self.isActive = isActive
|
self.isActive = isActive
|
||||||
}
|
}
|
||||||
@ -75,6 +80,7 @@ open class HeartModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(isActive, forKey: .isActive)
|
try container.encode(isActive, forKey: .isActive)
|
||||||
try container.encode(activeColor, forKey: .activeColor)
|
try container.encode(activeColor, forKey: .activeColor)
|
||||||
|
|||||||
@ -13,6 +13,8 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "radioBox"
|
public static var identifier: String = "radioBox"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var text: String
|
public var text: String
|
||||||
public var subText: String?
|
public var subText: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
@ -30,6 +32,7 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case text
|
case text
|
||||||
case subText
|
case subText
|
||||||
@ -58,6 +61,8 @@ import MVMCore
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
text = try typeContainer.decode(String.self, forKey: .text)
|
text = try typeContainer.decode(String.self, forKey: .text)
|
||||||
subText = try typeContainer.decodeIfPresent(String.self, forKey: .subText)
|
subText = try typeContainer.decodeIfPresent(String.self, forKey: .subText)
|
||||||
selectedAccentColor = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedAccentColor)
|
selectedAccentColor = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedAccentColor)
|
||||||
@ -81,6 +86,7 @@ import MVMCore
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(text, forKey: .text)
|
try container.encode(text, forKey: .text)
|
||||||
try container.encodeIfPresent(subText, forKey: .subText)
|
try container.encodeIfPresent(subText, forKey: .subText)
|
||||||
|
|||||||
@ -13,6 +13,8 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "radioBoxes"
|
public static var identifier: String = "radioBoxes"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var boxes: [RadioBoxModel]
|
public var boxes: [RadioBoxModel]
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
@ -49,6 +51,7 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case enabled
|
case enabled
|
||||||
case readOnly
|
case readOnly
|
||||||
@ -75,6 +78,7 @@ import MVMCore
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
selectedAccentColor = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedAccentColor)
|
selectedAccentColor = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedAccentColor)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
@ -91,6 +95,7 @@ import MVMCore
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(boxes, forKey: .boxes)
|
try container.encode(boxes, forKey: .boxes)
|
||||||
try container.encodeIfPresent(selectedAccentColor, forKey: .selectedAccentColor)
|
try container.encodeIfPresent(selectedAccentColor, forKey: .selectedAccentColor)
|
||||||
|
|||||||
@ -15,6 +15,8 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "radioButton"
|
public static var identifier: String = "radioButton"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public var state: Bool = false
|
public var state: Bool = false
|
||||||
@ -35,6 +37,7 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
@ -80,6 +83,8 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
|
||||||
if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) {
|
if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) {
|
||||||
self.state = state
|
self.state = state
|
||||||
}
|
}
|
||||||
@ -105,6 +110,7 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(state, forKey: .state)
|
try container.encode(state, forKey: .state)
|
||||||
try container.encode(enabled, forKey: .enabled)
|
try container.encode(enabled, forKey: .enabled)
|
||||||
|
|||||||
@ -13,6 +13,8 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "radioSwatch"
|
public static var identifier: String = "radioSwatch"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public var color: Color = Color(uiColor: .mvmBlue)
|
public var color: Color = Color(uiColor: .mvmBlue)
|
||||||
@ -29,6 +31,7 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
@ -54,6 +57,7 @@ import MVMCore
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
@ -79,6 +83,7 @@ import MVMCore
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
|
|||||||
@ -13,6 +13,8 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "radioSwatches"
|
public static var identifier: String = "radioSwatches"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public var swatches: [RadioSwatchModel]
|
public var swatches: [RadioSwatchModel]
|
||||||
@ -43,6 +45,7 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
@ -67,6 +70,7 @@ import MVMCore
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
swatches = try typeContainer.decode([RadioSwatchModel].self, forKey: .swatches)
|
swatches = try typeContainer.decode([RadioSwatchModel].self, forKey: .swatches)
|
||||||
@ -81,6 +85,7 @@ import MVMCore
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
|
|||||||
@ -13,6 +13,8 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "toggle"
|
public static var identifier: String = "toggle"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var selected: Bool = false
|
public var selected: Bool = false
|
||||||
@ -36,6 +38,7 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case state
|
case state
|
||||||
case animated
|
case animated
|
||||||
@ -86,6 +89,8 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
|
||||||
if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) {
|
if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) {
|
||||||
self.selected = state
|
self.selected = state
|
||||||
}
|
}
|
||||||
@ -128,6 +133,7 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeModelIfPresent(action, forKey: .action)
|
try container.encodeModelIfPresent(action, forKey: .action)
|
||||||
|
|||||||
@ -17,8 +17,9 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
public static var identifier: String {
|
public static var identifier: String {
|
||||||
return "arrow"
|
return "arrow"
|
||||||
}
|
}
|
||||||
|
|
||||||
public var moleculeName: String?
|
public var moleculeName: String?
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var disabledColor: Color = Color(uiColor: .mvmCoolGray3)
|
public var disabledColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||||
public var color: Color = Color(uiColor: .mvmBlack)
|
public var color: Color = Color(uiColor: .mvmBlack)
|
||||||
@ -57,6 +58,7 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case disabledColor
|
case disabledColor
|
||||||
@ -75,7 +77,7 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
|
||||||
if let disabledColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor) {
|
if let disabledColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor) {
|
||||||
@ -113,6 +115,7 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(disabledColor, forKey: .disabledColor)
|
try container.encode(disabledColor, forKey: .disabledColor)
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "caretView"
|
public static var identifier: String = "caretView"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var strokeColor: Color = Color(uiColor: .mvmBlack)
|
public var strokeColor: Color = Color(uiColor: .mvmBlack)
|
||||||
public var strokeColor_inverted: Color = Color(uiColor: .mvmWhite)
|
public var strokeColor_inverted: Color = Color(uiColor: .mvmWhite)
|
||||||
@ -28,6 +29,7 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case strokeColor
|
case strokeColor
|
||||||
@ -51,6 +53,8 @@ import MVMCore
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
|
||||||
if let strokeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .strokeColor) {
|
if let strokeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .strokeColor) {
|
||||||
self.strokeColor = strokeColor
|
self.strokeColor = strokeColor
|
||||||
}
|
}
|
||||||
@ -78,6 +82,7 @@ import MVMCore
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(strokeColor, forKey: .strokeColor)
|
try container.encode(strokeColor, forKey: .strokeColor)
|
||||||
try container.encode(strokeColor_inverted, forKey: .strokeColor_inverted)
|
try container.encode(strokeColor_inverted, forKey: .strokeColor_inverted)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var moleculeName: String?
|
public var moleculeName: String?
|
||||||
public var numberOfPages: Int = 0
|
public var numberOfPages: Int = 0
|
||||||
@ -44,6 +45,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case currentIndex
|
case currentIndex
|
||||||
@ -66,6 +68,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
|
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
|
||||||
@ -112,6 +115,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(numberOfPages, forKey: .numberOfPages)
|
try container.encode(numberOfPages, forKey: .numberOfPages)
|
||||||
|
|||||||
@ -18,6 +18,8 @@ public enum CheckboxPosition: String, Codable {
|
|||||||
@objcMembers open class CheckboxLabelModel: MoleculeModelProtocol {
|
@objcMembers open class CheckboxLabelModel: MoleculeModelProtocol {
|
||||||
open class var identifier: String { "checkboxLabel" }
|
open class var identifier: String { "checkboxLabel" }
|
||||||
public var moleculeName: String = CheckboxLabelModel.identifier
|
public var moleculeName: String = CheckboxLabelModel.identifier
|
||||||
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var checkboxAlignment: CheckboxPosition?
|
public var checkboxAlignment: CheckboxPosition?
|
||||||
public var checkbox: CheckboxModel
|
public var checkbox: CheckboxModel
|
||||||
|
|||||||
@ -15,6 +15,8 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "dashLine"
|
public static var identifier: String = "dashLine"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public var dashColor: Color = Color(uiColor: .mvmCoolGray3)
|
public var dashColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||||
@ -35,6 +37,7 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
@ -56,6 +59,8 @@ import MVMCore
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
|
||||||
if let dashColor = try typeContainer.decodeIfPresent(Color.self, forKey: .dashColor) {
|
if let dashColor = try typeContainer.decodeIfPresent(Color.self, forKey: .dashColor) {
|
||||||
self.dashColor = dashColor
|
self.dashColor = dashColor
|
||||||
}
|
}
|
||||||
@ -74,6 +79,7 @@ import MVMCore
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(dashColor, forKey: .dashColor)
|
try container.encode(dashColor, forKey: .dashColor)
|
||||||
try container.encode(isHidden, forKey: .isHidden)
|
try container.encode(isHidden, forKey: .isHidden)
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open class var identifier: String { "image" }
|
open class var identifier: String { "image" }
|
||||||
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var moleculeName: String = ImageViewModel.identifier
|
public var moleculeName: String = ImageViewModel.identifier
|
||||||
@ -45,6 +46,7 @@
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case image
|
case image
|
||||||
|
|||||||
@ -276,6 +276,9 @@ public typealias ActionBlock = () -> ()
|
|||||||
guard let labelModel = model as? LabelModel else { return }
|
guard let labelModel = model as? LabelModel else { return }
|
||||||
|
|
||||||
text = labelModel.text
|
text = labelModel.text
|
||||||
|
if let accessibilityTraits = labelModel.accessibilityTraits {
|
||||||
|
self.accessibilityTraits = accessibilityTraits
|
||||||
|
}
|
||||||
|
|
||||||
resetAttributeStyle()
|
resetAttributeStyle()
|
||||||
|
|
||||||
|
|||||||
@ -7,13 +7,14 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class LabelModel: MoleculeModelProtocol, Identifiable {
|
@objcMembers open class LabelModel: MoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open class var identifier: String { "label" }
|
open class var identifier: String { "label" }
|
||||||
public var id: String
|
public var id: String
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var text: String
|
public var text: String
|
||||||
public var accessibilityText: String?
|
public var accessibilityText: String?
|
||||||
@ -28,14 +29,15 @@
|
|||||||
public var makeWholeViewClickable: Bool?
|
public var makeWholeViewClickable: Bool?
|
||||||
public var numberOfLines: Int?
|
public var numberOfLines: Int?
|
||||||
public var shouldMaskRecordedView: Bool? = false
|
public var shouldMaskRecordedView: Bool? = false
|
||||||
|
public var accessibilityTraits: UIAccessibilityTraits?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
|
||||||
case id
|
case id
|
||||||
|
case moleculeName
|
||||||
case text
|
case text
|
||||||
case accessibilityText
|
case accessibilityText
|
||||||
case textColor
|
case textColor
|
||||||
@ -50,6 +52,7 @@
|
|||||||
case makeWholeViewClickable
|
case makeWholeViewClickable
|
||||||
case numberOfLines
|
case numberOfLines
|
||||||
case shouldMaskRecordedView
|
case shouldMaskRecordedView
|
||||||
|
case accessibilityTraits
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AttributeTypeKey: String, CodingKey {
|
enum AttributeTypeKey: String, CodingKey {
|
||||||
@ -97,6 +100,7 @@
|
|||||||
makeWholeViewClickable = try typeContainer.decodeIfPresent(Bool.self, forKey: .makeWholeViewClickable)
|
makeWholeViewClickable = try typeContainer.decodeIfPresent(Bool.self, forKey: .makeWholeViewClickable)
|
||||||
numberOfLines = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfLines)
|
numberOfLines = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfLines)
|
||||||
shouldMaskRecordedView = try typeContainer.decodeIfPresent(Bool.self, forKey: .shouldMaskRecordedView) ?? false
|
shouldMaskRecordedView = try typeContainer.decodeIfPresent(Bool.self, forKey: .shouldMaskRecordedView) ?? false
|
||||||
|
accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits)
|
||||||
|
|
||||||
// Later make protocol based validate outside of decoding?
|
// Later make protocol based validate outside of decoding?
|
||||||
if let attributes = attributes {
|
if let attributes = attributes {
|
||||||
@ -107,7 +111,7 @@
|
|||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(text, forKey: .text)
|
try container.encode(text, forKey: .text)
|
||||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||||
try container.encodeIfPresent(textColor, forKey: .textColor)
|
try container.encodeIfPresent(textColor, forKey: .textColor)
|
||||||
@ -122,5 +126,6 @@
|
|||||||
try container.encodeIfPresent(makeWholeViewClickable, forKey: .makeWholeViewClickable)
|
try container.encodeIfPresent(makeWholeViewClickable, forKey: .makeWholeViewClickable)
|
||||||
try container.encodeIfPresent(numberOfLines, forKey: .numberOfLines)
|
try container.encodeIfPresent(numberOfLines, forKey: .numberOfLines)
|
||||||
try container.encodeIfPresent(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
|
try container.encodeIfPresent(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
|
||||||
|
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,8 @@ import UIKit
|
|||||||
|
|
||||||
public static var identifier: String = "leftRightLabelView"
|
public static var identifier: String = "leftRightLabelView"
|
||||||
public var moleculeName: String = LeftRightLabelModel.identifier
|
public var moleculeName: String = LeftRightLabelModel.identifier
|
||||||
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var leftText: LabelModel
|
public var leftText: LabelModel
|
||||||
public var rightText: LabelModel?
|
public var rightText: LabelModel?
|
||||||
|
|||||||
@ -7,116 +7,112 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import VDS
|
||||||
|
|
||||||
|
@objcMembers open class Line: VDS.Line, VDSMoleculeViewProtocol {
|
||||||
@objcMembers open class Line: View {
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
open var viewModel: LineModel!
|
||||||
|
open var delegateObject: MVMCoreUIDelegateObject?
|
||||||
|
open var additionalData: [AnyHashable : Any]?
|
||||||
|
|
||||||
var lineModel: LineModel? {
|
open override var orientation: Line.Orientation {
|
||||||
get { return model as? LineModel }
|
didSet {
|
||||||
}
|
if orientation == .horizontal {
|
||||||
|
setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||||
//--------------------------------------------------
|
setContentHuggingPriority(.required, for: .vertical)
|
||||||
// MARK: - Constraints
|
setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||||
//--------------------------------------------------
|
setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
} else {
|
||||||
public var heightConstraint: NSLayoutConstraint?
|
setContentHuggingPriority(.required, for: .horizontal)
|
||||||
public var widthConstraint: NSLayoutConstraint?
|
setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||||
|
setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
open func updateLineConstraints(constant: CGFloat) {
|
setContentCompressionResistancePriority(.defaultLow, for: .vertical)
|
||||||
if let useVerticalLine = lineModel?.useVerticalLine, useVerticalLine {
|
}
|
||||||
heightConstraint?.isActive = false
|
|
||||||
widthConstraint?.isActive = true
|
|
||||||
widthConstraint?.constant = constant
|
|
||||||
} else {
|
|
||||||
widthConstraint?.isActive = false
|
|
||||||
heightConstraint?.isActive = true
|
|
||||||
heightConstraint?.constant = constant
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public convenience init(pinTo view: UIView, edge: UIRectEdge, useMargin: Bool) {
|
public convenience init(pinTo view: UIView, edge: UIRectEdge, useMargin: Bool) {
|
||||||
self.init(frame: .zero)
|
self.init(frame: .zero)
|
||||||
addLine(to: view, edge: edge, useMargin: useMargin)
|
addLine(to: view, edge: edge, useMargin: useMargin)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init() {
|
public required init() {
|
||||||
super.init(frame: .zero)
|
super.init()
|
||||||
model = LineModel(type: .secondary)
|
viewModel = LineModel(type: .secondary)
|
||||||
setStyle(.secondary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
model = LineModel(type: .secondary)
|
viewModel = LineModel(type: .secondary)
|
||||||
setStyle(.secondary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
public required init?(coder: NSCoder) {
|
||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
model = LineModel(type: .secondary)
|
viewModel = LineModel(type: .secondary)
|
||||||
setStyle(.secondary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
|
||||||
super.init(model: model, delegateObject, additionalData)
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Methods
|
// MARK: - Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open func setStyle(_ style: LineModel.Style) {
|
|
||||||
lineModel?.type = style
|
|
||||||
backgroundColor = lineModel?.backgroundColor?.uiColor
|
|
||||||
updateLineConstraints(constant: lineModel?.thickness ?? 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
open func shouldBeVisible() -> Bool {
|
open func shouldBeVisible() -> Bool {
|
||||||
guard let type = lineModel?.type else { return false }
|
guard let type = viewModel?.type else { return false }
|
||||||
return type != .none
|
return type != .none
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
open func setStyle(_ style: LineModel.Style) {
|
||||||
// MARK: - MoleculeViewProtocol
|
viewModel.type = style
|
||||||
//--------------------------------------------------
|
update(viewModel: viewModel)
|
||||||
|
}
|
||||||
|
|
||||||
open func addLine(to view: UIView, edge: UIRectEdge, useMargin: Bool) {
|
open func addLine(to view: UIView, edge: UIRectEdge, useMargin: Bool) {
|
||||||
view.addSubview(self)
|
view.addSubview(self)
|
||||||
NSLayoutConstraint.activate(Array(NSLayoutConstraint.pinView(toSuperview: self, useMargins: useMargin, pinTop: edge != .bottom, pinBottom: edge != .top, pinLeft: edge != .right, pinRight: edge != .left).values))
|
NSLayoutConstraint.activate(
|
||||||
|
Array(
|
||||||
|
NSLayoutConstraint.pinView(toSuperview: self,
|
||||||
|
useMargins: useMargin,
|
||||||
|
pinTop: edge != .bottom,
|
||||||
|
pinBottom: edge != .top,
|
||||||
|
pinLeft: edge != .right,
|
||||||
|
pinRight: edge != .left).values
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setupView() {
|
open override func draw(_ rect: CGRect) {
|
||||||
super.setupView()
|
guard viewModel.type != .none else { return }
|
||||||
heightConstraint = heightAnchor.constraint(equalToConstant: 1)
|
super.draw(rect)
|
||||||
heightConstraint?.isActive = true
|
|
||||||
widthConstraint = widthAnchor.constraint(equalToConstant: 1)
|
|
||||||
widthConstraint?.isActive = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
//--------------------------------------------------
|
||||||
super.set(with: model, delegateObject, additionalData)
|
// MARK: - VDSMoleculeViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
open func viewModelDidUpdate() {
|
||||||
|
surface = viewModel.surface
|
||||||
|
style = VDS.Line.Style(rawValue: viewModel.type.rawValue) ?? .primary
|
||||||
|
orientation = viewModel.orientation
|
||||||
|
}
|
||||||
|
|
||||||
if let lineModel = model as? LineModel {
|
//--------------------------------------------------
|
||||||
setStyle(lineModel.type)
|
// MARK: - MoleculeViewProtocol
|
||||||
}
|
//--------------------------------------------------
|
||||||
|
public func updateView(_ size: CGFloat) {
|
||||||
|
setNeedsDisplay()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
setStyle(.secondary)
|
return 1
|
||||||
}
|
|
||||||
|
|
||||||
public override static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
|
||||||
return (model as? LineModel)?.thickness ?? 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - MVMCoreUIViewConstrainingProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
extension Line: MVMCoreUIViewConstrainingProtocol {
|
extension Line: MVMCoreUIViewConstrainingProtocol {
|
||||||
|
|
||||||
open func needsToBeConstrained() -> Bool {
|
open func needsToBeConstrained() -> Bool {
|
||||||
|
|||||||
@ -8,8 +8,9 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import VDSColorTokens
|
import VDSColorTokens
|
||||||
|
import VDS
|
||||||
|
|
||||||
@objcMembers public class LineModel: MoleculeModelProtocol {
|
public class LineModel: MoleculeModelProtocol, Invertable {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Enums
|
// MARK: - Enums
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -30,12 +31,12 @@ import VDSColorTokens
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The style of the line:
|
The style of the line:
|
||||||
- secondary (1 height, silver)
|
- secondary (VDS Secondary)
|
||||||
- primary (1 height, black)
|
- primary (VDS Primary)
|
||||||
- standard (1 height, silver) - deprecated
|
- standard (VDS Secondary) - deprecated
|
||||||
- thin (1 height, black) - deprecated
|
- thin (VDS Primar) - deprecated
|
||||||
- medium (2 height, black)
|
- medium (VDS Primar)
|
||||||
- heavy (4 height, black)
|
- heavy (VDS Primar)
|
||||||
- none (hidden)
|
- none (hidden)
|
||||||
*/
|
*/
|
||||||
public enum Style: String, Codable {
|
public enum Style: String, Codable {
|
||||||
@ -53,52 +54,15 @@ import VDSColorTokens
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "line"
|
public static var identifier: String = "line"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
public var type: Style = .secondary
|
public var type: Style = .secondary
|
||||||
public var frequency: Frequency? = .allExceptTop
|
public var frequency: Frequency? = .allExceptTop
|
||||||
|
|
||||||
//TODO: use color insted of backgroundColor. Needs server changes
|
|
||||||
// public var color: Color?
|
|
||||||
private var _backgroundColor: Color?
|
|
||||||
public var backgroundColor: Color? {
|
|
||||||
get {
|
|
||||||
if let backgroundColor = _backgroundColor { return backgroundColor }
|
|
||||||
if inverted {
|
|
||||||
if type == .secondary || type == .standard { return Color(uiColor: VDSColor.paletteGray20) }
|
|
||||||
return Color(uiColor: VDSColor.elementsPrimaryOndark)
|
|
||||||
}
|
|
||||||
if type == .secondary || type == .standard { return Color(uiColor: VDSColor.paletteGray85) }
|
|
||||||
return Color(uiColor: VDSColor.elementsPrimaryOnlight)
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
_backgroundColor = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var _thickness: CGFloat?
|
|
||||||
public var thickness: CGFloat {
|
|
||||||
get {
|
|
||||||
if let thickness = _thickness { return thickness }
|
|
||||||
switch type {
|
|
||||||
case .heavy:
|
|
||||||
return 4
|
|
||||||
case .medium:
|
|
||||||
return 2
|
|
||||||
case .none:
|
|
||||||
return 0
|
|
||||||
default:
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
_thickness = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var inverted: Bool = false
|
public var inverted: Bool = false
|
||||||
|
|
||||||
// Use this to show vertical line
|
public var orientation: VDS.Line.Orientation = .horizontal
|
||||||
// Default is false
|
|
||||||
public var useVerticalLine: Bool?
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
@ -106,13 +70,11 @@ import VDSColorTokens
|
|||||||
|
|
||||||
public init(type: Style) {
|
public init(type: Style) {
|
||||||
self.type = type
|
self.type = type
|
||||||
self.useVerticalLine = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(verticalLineOf type: Style, backgroundColor: Color? = nil) {
|
public init(verticalLineOf type: Style) {
|
||||||
self.type = type
|
self.type = type
|
||||||
self.backgroundColor = backgroundColor
|
orientation = .vertical
|
||||||
self.useVerticalLine = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -120,15 +82,13 @@ import VDSColorTokens
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case type
|
case type
|
||||||
case backgroundColor
|
|
||||||
case backgroundColor_inverted
|
|
||||||
case color
|
|
||||||
case frequency
|
case frequency
|
||||||
case inverted
|
case inverted
|
||||||
case useVerticalLine
|
case useVerticalLine
|
||||||
case thickness
|
case orientation
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -138,6 +98,8 @@ import VDSColorTokens
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
|
||||||
if let type = try typeContainer.decodeIfPresent(Style.self, forKey: .type) {
|
if let type = try typeContainer.decodeIfPresent(Style.self, forKey: .type) {
|
||||||
self.type = type
|
self.type = type
|
||||||
}
|
}
|
||||||
@ -150,19 +112,21 @@ import VDSColorTokens
|
|||||||
self.inverted = inverted
|
self.inverted = inverted
|
||||||
}
|
}
|
||||||
|
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
/// adding code to look for the old useVerticalLine or the new orientation
|
||||||
useVerticalLine = try typeContainer.decodeIfPresent(Bool.self, forKey: .useVerticalLine)
|
if let useVerticalLine = try typeContainer.decodeIfPresent(Bool.self, forKey: .useVerticalLine) {
|
||||||
_thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
|
orientation = useVerticalLine ? .vertical : .horizontal
|
||||||
|
} else if let orientation = try typeContainer.decodeIfPresent(VDS.Line.Orientation.self, forKey: .orientation) {
|
||||||
|
self.orientation = orientation
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(type, forKey: .type)
|
try container.encode(type, forKey: .type)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
try container.encodeIfPresent(frequency, forKey: .frequency)
|
try container.encodeIfPresent(frequency, forKey: .frequency)
|
||||||
try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor)
|
try container.encode(orientation == .vertical, forKey: .useVerticalLine)
|
||||||
try container.encodeIfPresent(useVerticalLine, forKey: .useVerticalLine)
|
|
||||||
try container.encodeIfPresent(_thickness, forKey: .thickness)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,9 +13,10 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
|
||||||
public static var identifier: String = "loadingSpinner"
|
public static var identifier: String = "loadingSpinner"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
|
public var backgroundColor: Color?
|
||||||
public var strokeColor = Color(uiColor: .mvmBlack)
|
public var strokeColor = Color(uiColor: .mvmBlack)
|
||||||
public var lineWidth: CGFloat = 4
|
public var lineWidth: CGFloat = 4
|
||||||
public var diameter: CGFloat = 40
|
public var diameter: CGFloat = 40
|
||||||
@ -25,6 +26,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case strokeColor
|
case strokeColor
|
||||||
@ -45,6 +47,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
|
||||||
if let diameter = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .diameter) {
|
if let diameter = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .diameter) {
|
||||||
@ -62,6 +65,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(diameter, forKey: .diameter)
|
try container.encodeIfPresent(diameter, forKey: .diameter)
|
||||||
|
|||||||
@ -19,13 +19,17 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objcMembers public class MultiProgressBarModel: MoleculeModelProtocol {
|
@objcMembers public class MultiProgressBarModel: MoleculeModelProtocol {
|
||||||
|
|
||||||
public static var identifier: String = "multiProgressBar"
|
public static var identifier: String = "multiProgressBar"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var progressList: [SingleProgressBarModel]
|
public var progressList: [SingleProgressBarModel]
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var thickness: CGFloat?
|
public var thickness: CGFloat?
|
||||||
public var roundedCorners: Bool?
|
public var roundedCorners: Bool?
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case progressList
|
case progressList
|
||||||
case thickness
|
case thickness
|
||||||
@ -39,6 +43,7 @@ import Foundation
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
progressList = try typeContainer.decode([SingleProgressBarModel].self, forKey: .progressList)
|
progressList = try typeContainer.decode([SingleProgressBarModel].self, forKey: .progressList)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
|
thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
|
||||||
@ -47,6 +52,7 @@ import Foundation
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(progressList, forKey: .progressList)
|
try container.encode(progressList, forKey: .progressList)
|
||||||
try container.encodeIfPresent(thickness, forKey: .thickness)
|
try container.encodeIfPresent(thickness, forKey: .thickness)
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import Foundation
|
|||||||
|
|
||||||
@objcMembers public class ProgressBarModel: MoleculeModelProtocol {
|
@objcMembers public class ProgressBarModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "progressBar"
|
public static var identifier: String = "progressBar"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
@Percent public var percent: CGFloat
|
@Percent public var percent: CGFloat
|
||||||
public var color: Color = Color(uiColor: .mfCerulean())
|
public var color: Color = Color(uiColor: .mfCerulean())
|
||||||
public var backgroundColor: Color? = Color(uiColor: .mfLightSilver())
|
public var backgroundColor: Color? = Color(uiColor: .mfLightSilver())
|
||||||
@ -17,6 +19,7 @@ import Foundation
|
|||||||
public var thickness: CGFloat?
|
public var thickness: CGFloat?
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case roundedCorners
|
case roundedCorners
|
||||||
case thickness
|
case thickness
|
||||||
@ -31,6 +34,7 @@ import Foundation
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
percent = try typeContainer.decode(CGFloat.self, forKey: .percent)
|
percent = try typeContainer.decode(CGFloat.self, forKey: .percent)
|
||||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) {
|
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) {
|
||||||
self.color = color
|
self.color = color
|
||||||
@ -44,6 +48,7 @@ import Foundation
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(percent, forKey: .percent)
|
try container.encode(percent, forKey: .percent)
|
||||||
try container.encode(color, forKey: .color)
|
try container.encode(color, forKey: .color)
|
||||||
|
|||||||
@ -13,6 +13,8 @@ open class StarModel: MoleculeModelProtocol {
|
|||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public static var identifier: String = "star"
|
public static var identifier: String = "star"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
@Percent public var percent: CGFloat = 0
|
@Percent public var percent: CGFloat = 0
|
||||||
public var borderColor: Color?
|
public var borderColor: Color?
|
||||||
@ -23,6 +25,7 @@ open class StarModel: MoleculeModelProtocol {
|
|||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case percent
|
case percent
|
||||||
@ -43,6 +46,7 @@ open class StarModel: MoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
if let percent = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .percent) {
|
if let percent = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .percent) {
|
||||||
self.percent = percent
|
self.percent = percent
|
||||||
}
|
}
|
||||||
@ -56,6 +60,7 @@ open class StarModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(percent, forKey: .percent)
|
try container.encode(percent, forKey: .percent)
|
||||||
|
|||||||
@ -13,6 +13,8 @@ import MVMCore
|
|||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public static var identifier: String = "stars"
|
public static var identifier: String = "stars"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var starBackgroundColor: Color?
|
public var starBackgroundColor: Color?
|
||||||
public var stars: [StarModel]
|
public var stars: [StarModel]
|
||||||
@ -25,6 +27,7 @@ import MVMCore
|
|||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case starBackgroundColor
|
case starBackgroundColor
|
||||||
@ -48,6 +51,8 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
stars = try typeContainer.decode([StarModel].self, forKey: .stars)
|
stars = try typeContainer.decode([StarModel].self, forKey: .stars)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
starBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .starBackgroundColor)
|
starBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .starBackgroundColor)
|
||||||
@ -63,6 +68,7 @@ import MVMCore
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(stars, forKey: .stars)
|
try container.encode(stars, forKey: .stars)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
|
|||||||
@ -37,8 +37,11 @@ open class Tilelet: VDS.Tilelet, VDSMoleculeViewProtocol{
|
|||||||
padding = viewModel.padding
|
padding = viewModel.padding
|
||||||
aspectRatio = viewModel.aspectRatio
|
aspectRatio = viewModel.aspectRatio
|
||||||
width = viewModel.width
|
width = viewModel.width
|
||||||
textWidth = viewModel.textWidth
|
if let value = viewModel.textWidth {
|
||||||
textPercentage = viewModel.textPercentage
|
textWidth = .value(value)
|
||||||
|
} else if let percentage = viewModel.textPercentage {
|
||||||
|
textWidth = .percentage(percentage)
|
||||||
|
}
|
||||||
titleModel = viewModel.titleModel(delegateObject: delegateObject, additionalData: additionalData)
|
titleModel = viewModel.titleModel(delegateObject: delegateObject, additionalData: additionalData)
|
||||||
subTitleModel = viewModel.subTitleModel(delegateObject: delegateObject, additionalData: additionalData)
|
subTitleModel = viewModel.subTitleModel(delegateObject: delegateObject, additionalData: additionalData)
|
||||||
badgeModel = viewModel.badge
|
badgeModel = viewModel.badge
|
||||||
@ -47,14 +50,13 @@ open class Tilelet: VDS.Tilelet, VDSMoleculeViewProtocol{
|
|||||||
//setup action
|
//setup action
|
||||||
if let action = viewModel.action {
|
if let action = viewModel.action {
|
||||||
//add the subscriber
|
//add the subscriber
|
||||||
onClickSubscriber = publisher(for: .touchUpInside)
|
onClick = { [weak self] control in
|
||||||
.sink {[weak self] control in
|
guard let self, let viewModel = self.viewModel else { return }
|
||||||
guard let self else { return }
|
MVMCoreUIActionHandler.performActionUnstructured(with: action,
|
||||||
MVMCoreUIActionHandler.performActionUnstructured(with: action,
|
sourceModel: viewModel,
|
||||||
sourceModel: self.viewModel,
|
additionalData: self.additionalData,
|
||||||
additionalData: self.additionalData,
|
delegateObject: self.delegateObject)
|
||||||
delegateObject: self.delegateObject)
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@ open class TileletModel: MoleculeModelProtocol {
|
|||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public static var identifier: String = "tilelet"
|
public static var identifier: String = "tilelet"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var color: TileContainer.BackgroundColor
|
public var color: TileContainer.BackgroundColor
|
||||||
public var padding: TileContainer.Padding
|
public var padding: TileContainer.Padding
|
||||||
@ -30,6 +31,7 @@ open class TileletModel: MoleculeModelProtocol {
|
|||||||
public var action: ActionModelProtocol?
|
public var action: ActionModelProtocol?
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case color
|
case color
|
||||||
@ -47,6 +49,7 @@ open class TileletModel: MoleculeModelProtocol {
|
|||||||
}
|
}
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
self.id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
self.backgroundColor = try container.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
self.backgroundColor = try container.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
self.color = try container.decodeIfPresent(TileContainer.BackgroundColor.self, forKey: .color) ?? TileContainer.BackgroundColor.black
|
self.color = try container.decodeIfPresent(TileContainer.BackgroundColor.self, forKey: .color) ?? TileContainer.BackgroundColor.black
|
||||||
self.padding = try container.decodeIfPresent(TileContainer.Padding.self, forKey: .padding) ?? TileContainer.Padding.padding4X
|
self.padding = try container.decodeIfPresent(TileContainer.Padding.self, forKey: .padding) ?? TileContainer.Padding.padding4X
|
||||||
@ -86,6 +89,7 @@ open class TileletModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(color, forKey: .color)
|
try container.encodeIfPresent(color, forKey: .color)
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import Foundation
|
|||||||
|
|
||||||
open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
|
open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
|
||||||
public static var identifier = "video"
|
public static var identifier = "video"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var video: String
|
public var video: String
|
||||||
public var showControls = false
|
public var showControls = false
|
||||||
@ -43,6 +44,7 @@ open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
|
|||||||
private var resignActiveListener: Any?
|
private var resignActiveListener: Any?
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case video
|
case video
|
||||||
case showControls
|
case showControls
|
||||||
@ -57,6 +59,7 @@ open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
video = try typeContainer.decode(String.self, forKey:.video)
|
video = try typeContainer.decode(String.self, forKey:.video)
|
||||||
if let showControls = try typeContainer.decodeIfPresent(Bool.self, forKey: .showControls) {
|
if let showControls = try typeContainer.decodeIfPresent(Bool.self, forKey: .showControls) {
|
||||||
self.showControls = showControls
|
self.showControls = showControls
|
||||||
@ -72,6 +75,7 @@ open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
|
|||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(video, forKey: .video)
|
try container.encode(video, forKey: .video)
|
||||||
try container.encode(showControls, forKey: .showControls)
|
try container.encode(showControls, forKey: .showControls)
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import MVMCore
|
|||||||
@objcMembers public class WebViewModel: MoleculeModelProtocol {
|
@objcMembers public class WebViewModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "webview"
|
public static var identifier: String = "webview"
|
||||||
public var moleculeName: String = WebViewModel.identifier
|
public var moleculeName: String = WebViewModel.identifier
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var url: URL?
|
public var url: URL?
|
||||||
public var htmlString: String?
|
public var htmlString: String?
|
||||||
@ -23,6 +25,7 @@ import MVMCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey{
|
private enum CodingKeys: String, CodingKey{
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case url
|
case url
|
||||||
@ -39,6 +42,7 @@ import MVMCore
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
url = try typeContainer.decodeIfPresent(URL.self, forKey: .url)
|
url = try typeContainer.decodeIfPresent(URL.self, forKey: .url)
|
||||||
htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString)
|
htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString)
|
||||||
@ -51,6 +55,7 @@ import MVMCore
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(url, forKey: .url)
|
try container.encodeIfPresent(url, forKey: .url)
|
||||||
|
|||||||
@ -19,6 +19,8 @@ public enum GraphStyle: String, Codable {
|
|||||||
public class WheelModel: MoleculeModelProtocol {
|
public class WheelModel: MoleculeModelProtocol {
|
||||||
|
|
||||||
public static var identifier: String = "wheel"
|
public static var identifier: String = "wheel"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var style: GraphStyle = .unlimited {
|
public var style: GraphStyle = .unlimited {
|
||||||
didSet {
|
didSet {
|
||||||
updateStyle()
|
updateStyle()
|
||||||
@ -43,6 +45,7 @@ public class WheelModel: MoleculeModelProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case style
|
case style
|
||||||
case size
|
case size
|
||||||
case diameter
|
case diameter
|
||||||
@ -56,6 +59,8 @@ public class WheelModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
|
||||||
if let style = try typeContainer.decodeIfPresent(GraphStyle.self, forKey: .style) {
|
if let style = try typeContainer.decodeIfPresent(GraphStyle.self, forKey: .style) {
|
||||||
self.style = style
|
self.style = style
|
||||||
}
|
}
|
||||||
@ -84,6 +89,7 @@ public class WheelModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(style, forKey: .style)
|
try container.encode(style, forKey: .style)
|
||||||
try container.encode(size, forKey: .size)
|
try container.encode(size, forKey: .size)
|
||||||
|
|||||||
125
MVMCoreUI/Atomic/Extensions/UIAccessibilityTraits+Codable.swift
Normal file
125
MVMCoreUI/Atomic/Extensions/UIAccessibilityTraits+Codable.swift
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
//
|
||||||
|
// UIAccessibilityTraits+Codable.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Scott Pfeil on 6/16/23.
|
||||||
|
// Copyright © 2023 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension UIAccessibilityTraits: Codable {
|
||||||
|
private static func trait(from string: String) throws -> UIAccessibilityTraits {
|
||||||
|
switch string {
|
||||||
|
case "none":
|
||||||
|
return .none
|
||||||
|
case "button":
|
||||||
|
return .button
|
||||||
|
case "link":
|
||||||
|
return .link
|
||||||
|
case "image":
|
||||||
|
return .image
|
||||||
|
case "searchField":
|
||||||
|
return .searchField
|
||||||
|
case "keyboardKey":
|
||||||
|
return .keyboardKey
|
||||||
|
case "staticText":
|
||||||
|
return .staticText
|
||||||
|
case "header":
|
||||||
|
return .header
|
||||||
|
case "tabBar":
|
||||||
|
return .tabBar
|
||||||
|
case "summaryElement":
|
||||||
|
return .summaryElement
|
||||||
|
case "selected":
|
||||||
|
return .selected
|
||||||
|
case "notEnabled":
|
||||||
|
return .notEnabled
|
||||||
|
case "adjustable":
|
||||||
|
return .adjustable
|
||||||
|
case "allowsDirectInteraction":
|
||||||
|
return .allowsDirectInteraction
|
||||||
|
case "updatesFrequently":
|
||||||
|
return .updatesFrequently
|
||||||
|
case "causesPageTurn":
|
||||||
|
return .causesPageTurn
|
||||||
|
case "playsSound":
|
||||||
|
return .playsSound
|
||||||
|
case "startsMediaSession":
|
||||||
|
return .startsMediaSession
|
||||||
|
default:
|
||||||
|
throw ModelRegistry.Error.decoderOther(message: "Unsupported accessibility trait: \(string)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(from decoder: Decoder) throws {
|
||||||
|
var container = try decoder.unkeyedContainer()
|
||||||
|
|
||||||
|
// Iterate and decode each.
|
||||||
|
var accessibilityTrait: UIAccessibilityTraits = []
|
||||||
|
while !container.isAtEnd {
|
||||||
|
let traitString = try container.decode(String.self)
|
||||||
|
let trait = try UIAccessibilityTraits.trait(from: traitString)
|
||||||
|
accessibilityTrait.insert(trait)
|
||||||
|
}
|
||||||
|
self = accessibilityTrait
|
||||||
|
}
|
||||||
|
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.unkeyedContainer()
|
||||||
|
if self.contains(.none) {
|
||||||
|
try container.encode("none")
|
||||||
|
}
|
||||||
|
if self.contains(.button) {
|
||||||
|
try container.encode("button")
|
||||||
|
}
|
||||||
|
if self.contains(.link) {
|
||||||
|
try container.encode("link")
|
||||||
|
}
|
||||||
|
if self.contains(.image) {
|
||||||
|
try container.encode("image")
|
||||||
|
}
|
||||||
|
if self.contains(.searchField) {
|
||||||
|
try container.encode("searchField")
|
||||||
|
}
|
||||||
|
if self.contains(.keyboardKey) {
|
||||||
|
try container.encode("keyboardKey")
|
||||||
|
}
|
||||||
|
if self.contains(.staticText) {
|
||||||
|
try container.encode("staticText")
|
||||||
|
}
|
||||||
|
if self.contains(.header) {
|
||||||
|
try container.encode("header")
|
||||||
|
}
|
||||||
|
if self.contains(.tabBar) {
|
||||||
|
try container.encode("tabBar")
|
||||||
|
}
|
||||||
|
if self.contains(.summaryElement) {
|
||||||
|
try container.encode("summaryElement")
|
||||||
|
}
|
||||||
|
if self.contains(.selected) {
|
||||||
|
try container.encode("selected")
|
||||||
|
}
|
||||||
|
if self.contains(.notEnabled) {
|
||||||
|
try container.encode("notEnabled")
|
||||||
|
}
|
||||||
|
if self.contains(.adjustable) {
|
||||||
|
try container.encode("adjustable")
|
||||||
|
}
|
||||||
|
if self.contains(.allowsDirectInteraction) {
|
||||||
|
try container.encode("allowsDirectInteraction")
|
||||||
|
}
|
||||||
|
if self.contains(.updatesFrequently) {
|
||||||
|
try container.encode("updatesFrequently")
|
||||||
|
}
|
||||||
|
if self.contains(.causesPageTurn) {
|
||||||
|
try container.encode("causesPageTurn")
|
||||||
|
}
|
||||||
|
if self.contains(.playsSound) {
|
||||||
|
try container.encode("playsSound")
|
||||||
|
}
|
||||||
|
if self.contains(.startsMediaSession) {
|
||||||
|
try container.encode("startsMediaSession")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -16,3 +16,11 @@ extension Icon.Size: Codable {}
|
|||||||
extension TileContainer.BackgroundColor: Codable {}
|
extension TileContainer.BackgroundColor: Codable {}
|
||||||
extension TileContainer.Padding: Codable {}
|
extension TileContainer.Padding: Codable {}
|
||||||
extension TileContainer.AspectRatio: Codable {}
|
extension TileContainer.AspectRatio: Codable {}
|
||||||
|
extension TextLink.Size: Codable {}
|
||||||
|
extension VDS.Line.Style: Codable {}
|
||||||
|
extension VDS.Line.Orientation: Codable {}
|
||||||
|
extension Use: Codable {}
|
||||||
|
extension VDS.Button.Size: RawRepresentableCodable {
|
||||||
|
public static var mapping: [String : VDS.Button.Size] { ["standard": .large, "tiny": .small] }
|
||||||
|
public static var defaultValue: VDS.Button.Size? { nil }
|
||||||
|
}
|
||||||
@ -7,7 +7,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
public class HeadersH1ButtonModel: HeaderModel, MoleculeModelProtocol {
|
public class HeadersH1ButtonModel: HeaderModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -15,6 +16,10 @@ public class HeadersH1ButtonModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
public var headlineBody: HeadlineBodyModel
|
public var headlineBody: HeadlineBodyModel
|
||||||
public var buttons: TwoButtonViewModel
|
public var buttons: TwoButtonViewModel
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headlineBody, buttons]
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -25,6 +30,17 @@ public class HeadersH1ButtonModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Subclass
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public override func setDefaults() {
|
||||||
|
if headlineBody.headline?.accessibilityTraits == nil {
|
||||||
|
headlineBody.headline?.accessibilityTraits = .header
|
||||||
|
}
|
||||||
|
super.setDefaults()
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class HeadersH1LandingPageHeaderModel: HeaderModel, MoleculeModelProtocol {
|
public class HeadersH1LandingPageHeaderModel: HeaderModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -20,6 +20,10 @@ public class HeadersH1LandingPageHeaderModel: HeaderModel, MoleculeModelProtocol
|
|||||||
public var link: LinkModel
|
public var link: LinkModel
|
||||||
public var buttons: TwoButtonViewModel
|
public var buttons: TwoButtonViewModel
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headline, headline2, subHeadline, body, link, buttons]
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -32,6 +36,17 @@ public class HeadersH1LandingPageHeaderModel: HeaderModel, MoleculeModelProtocol
|
|||||||
self.buttons = buttons
|
self.buttons = buttons
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Subclass
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public override func setDefaults() {
|
||||||
|
if headline.accessibilityTraits == nil {
|
||||||
|
headline.accessibilityTraits = .header
|
||||||
|
}
|
||||||
|
super.setDefaults()
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class HeadersH1NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol {
|
public class HeadersH1NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -16,6 +16,10 @@ public class HeadersH1NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol
|
|||||||
public static var identifier: String = "headerH1"
|
public static var identifier: String = "headerH1"
|
||||||
public var headlineBody: HeadlineBodyModel
|
public var headlineBody: HeadlineBodyModel
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headlineBody]
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -25,6 +29,17 @@ public class HeadersH1NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Subclass
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public override func setDefaults() {
|
||||||
|
if headlineBody.headline?.accessibilityTraits == nil {
|
||||||
|
headlineBody.headline?.accessibilityTraits = .header
|
||||||
|
}
|
||||||
|
super.setDefaults()
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class HeadersH2ButtonsModel: HeaderModel, MoleculeModelProtocol {
|
public class HeadersH2ButtonsModel: HeaderModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -18,6 +18,10 @@ public class HeadersH2ButtonsModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
public var headlineBody: HeadlineBodyModel
|
public var headlineBody: HeadlineBodyModel
|
||||||
public var buttons: TwoButtonViewModel
|
public var buttons: TwoButtonViewModel
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headlineBody, buttons]
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -39,6 +43,9 @@ public class HeadersH2ButtonsModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
if bottomPadding == nil {
|
if bottomPadding == nil {
|
||||||
bottomPadding = Padding.Component.VerticalMarginSpacing
|
bottomPadding = Padding.Component.VerticalMarginSpacing
|
||||||
}
|
}
|
||||||
|
if headlineBody.headline?.accessibilityTraits == nil {
|
||||||
|
headlineBody.headline?.accessibilityTraits = .header
|
||||||
|
}
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
public class HeadersH2CaretLinkModel: HeaderModel, MoleculeModelProtocol {
|
public class HeadersH2CaretLinkModel: HeaderModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -15,6 +15,10 @@ public class HeadersH2CaretLinkModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
public var headlineBody: HeadlineBodyModel
|
public var headlineBody: HeadlineBodyModel
|
||||||
public var caretLink: CaretLinkModel
|
public var caretLink: CaretLinkModel
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headlineBody, caretLink]
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -34,6 +38,9 @@ public class HeadersH2CaretLinkModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
if bottomPadding == nil {
|
if bottomPadding == nil {
|
||||||
bottomPadding = Padding.Component.VerticalMarginSpacing
|
bottomPadding = Padding.Component.VerticalMarginSpacing
|
||||||
}
|
}
|
||||||
|
if headlineBody.headline?.accessibilityTraits == nil {
|
||||||
|
headlineBody.headline?.accessibilityTraits = .header
|
||||||
|
}
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class HeadersH2LinkModel: HeaderModel, MoleculeModelProtocol {
|
public class HeadersH2LinkModel: HeaderModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -17,6 +17,10 @@ public class HeadersH2LinkModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
public var headlineBody: HeadlineBodyModel
|
public var headlineBody: HeadlineBodyModel
|
||||||
public var link: LinkModel
|
public var link: LinkModel
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headlineBody, link]
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -38,6 +42,9 @@ public class HeadersH2LinkModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
if bottomPadding == nil {
|
if bottomPadding == nil {
|
||||||
bottomPadding = Padding.Component.VerticalMarginSpacing
|
bottomPadding = Padding.Component.VerticalMarginSpacing
|
||||||
}
|
}
|
||||||
|
if headlineBody.headline?.accessibilityTraits == nil {
|
||||||
|
headlineBody.headline?.accessibilityTraits = .header
|
||||||
|
}
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class HeadersH2NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol {
|
public class HeadersH2NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -17,6 +17,10 @@ public class HeadersH2NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol
|
|||||||
public static var identifier: String = "headerH2"
|
public static var identifier: String = "headerH2"
|
||||||
public var headlineBody: HeadlineBodyModel
|
public var headlineBody: HeadlineBodyModel
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headlineBody]
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -33,6 +37,9 @@ public class HeadersH2NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol
|
|||||||
if bottomPadding == nil {
|
if bottomPadding == nil {
|
||||||
bottomPadding = Padding.Component.VerticalMarginSpacing
|
bottomPadding = Padding.Component.VerticalMarginSpacing
|
||||||
}
|
}
|
||||||
|
if headlineBody.headline?.accessibilityTraits == nil {
|
||||||
|
headlineBody.headline?.accessibilityTraits = .header
|
||||||
|
}
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,6 +42,13 @@ import Foundation
|
|||||||
return Stack<StackModel>.createStack(with: [headline, horizontalStack], spacing: 8)
|
return Stack<StackModel>.createStack(with: [headline, horizontalStack], spacing: 8)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// MARK: - Constraints
|
||||||
|
//-------------------------------------------------------
|
||||||
|
public var verticalLine1HeightConstraint: NSLayoutConstraint?
|
||||||
|
public var verticalLine2HeightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
@ -51,11 +58,10 @@ import Foundation
|
|||||||
body.lineBreakMode = .byTruncatingTail
|
body.lineBreakMode = .byTruncatingTail
|
||||||
body2.lineBreakMode = .byTruncatingTail
|
body2.lineBreakMode = .byTruncatingTail
|
||||||
body3.lineBreakMode = .byTruncatingTail
|
body3.lineBreakMode = .byTruncatingTail
|
||||||
|
|
||||||
verticalLine1.widthConstraint?.isActive = true
|
// setup lines
|
||||||
verticalLine1.backgroundColor = .mvmBlack
|
verticalLine1.orientation = .vertical
|
||||||
verticalLine2.widthConstraint?.isActive = true
|
verticalLine2.orientation = .vertical
|
||||||
verticalLine2.backgroundColor = .mvmBlack
|
|
||||||
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
@ -80,13 +86,13 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
open func setLineHeight() {
|
open func setLineHeight() {
|
||||||
verticalLine1.heightConstraint?.isActive = false
|
verticalLine1HeightConstraint?.isActive = false
|
||||||
verticalLine1.heightConstraint = verticalLine1.heightAnchor.constraint(equalTo: body2.heightAnchor, multiplier: 1)
|
verticalLine1HeightConstraint = verticalLine1.heightAnchor.constraint(equalTo: body2.heightAnchor, multiplier: 1)
|
||||||
verticalLine1.heightConstraint?.isActive = true
|
verticalLine1HeightConstraint?.isActive = true
|
||||||
|
|
||||||
verticalLine2.heightConstraint?.isActive = false
|
verticalLine2HeightConstraint?.isActive = false
|
||||||
verticalLine2.heightConstraint = verticalLine2.heightAnchor.constraint(equalTo: body3.heightAnchor, multiplier: 1)
|
verticalLine2HeightConstraint = verticalLine2.heightAnchor.constraint(equalTo: body3.heightAnchor, multiplier: 1)
|
||||||
verticalLine2.heightConstraint?.isActive = true
|
verticalLine2HeightConstraint?.isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class HeadersH2PricingTwoRowsModel: HeaderModel, MoleculeModelProtocol {
|
public class HeadersH2PricingTwoRowsModel: HeaderModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -21,6 +21,10 @@ public class HeadersH2PricingTwoRowsModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
public var body3: LabelModel
|
public var body3: LabelModel
|
||||||
public var subBody3: LabelModel?
|
public var subBody3: LabelModel?
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headline, body, subBody, body2, subBody2, body3, subBody3].compactMap({$0})
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -45,6 +49,9 @@ public class HeadersH2PricingTwoRowsModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
if bottomPadding == nil {
|
if bottomPadding == nil {
|
||||||
bottomPadding = Padding.Component.VerticalMarginSpacing
|
bottomPadding = Padding.Component.VerticalMarginSpacing
|
||||||
}
|
}
|
||||||
|
if headline.accessibilityTraits == nil {
|
||||||
|
headline.accessibilityTraits = .header
|
||||||
|
}
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
subBody?.attributes = [LabelAttributeStrikeThroughModel(0, subBody?.text.count ?? 0)]
|
subBody?.attributes = [LabelAttributeStrikeThroughModel(0, subBody?.text.count ?? 0)]
|
||||||
subBody2?.attributes = [LabelAttributeStrikeThroughModel(0, subBody2?.text.count ?? 0)]
|
subBody2?.attributes = [LabelAttributeStrikeThroughModel(0, subBody2?.text.count ?? 0)]
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class HeadersH2TinyButtonModel: HeaderModel, MoleculeModelProtocol {
|
public class HeadersH2TinyButtonModel: HeaderModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -18,6 +18,10 @@ public class HeadersH2TinyButtonModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
public var headlineBody: HeadlineBodyModel
|
public var headlineBody: HeadlineBodyModel
|
||||||
public var button: ButtonModel
|
public var button: ButtonModel
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headlineBody, button]
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -39,6 +43,9 @@ public class HeadersH2TinyButtonModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
if bottomPadding == nil {
|
if bottomPadding == nil {
|
||||||
bottomPadding = Padding.Component.VerticalMarginSpacing
|
bottomPadding = Padding.Component.VerticalMarginSpacing
|
||||||
}
|
}
|
||||||
|
if headlineBody.headline?.accessibilityTraits == nil {
|
||||||
|
headlineBody.headline?.accessibilityTraits = .header
|
||||||
|
}
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
button.style = .secondary
|
button.style = .secondary
|
||||||
button.size = .small
|
button.size = .small
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class ListDeviceComplexButtonMediumModel: ListItemModel, MoleculeModelPro
|
|||||||
|
|
||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
button.size = .tiny
|
button.size = .small
|
||||||
button.style = .secondary
|
button.style = .secondary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class ListDeviceComplexButtonSmallModel: ListItemModel, MoleculeModelProt
|
|||||||
|
|
||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
button.size = .tiny
|
button.size = .small
|
||||||
button.style = .secondary
|
button.style = .secondary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class ListProgressBarThin: TableViewCell {
|
open class ListProgressBarThin: TableViewCell {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -15,7 +15,11 @@
|
|||||||
public let progressBar = ProgressBar()
|
public let progressBar = ProgressBar()
|
||||||
public let leftHeadline = Label(fontStyle: .BoldBodySmall)
|
public let leftHeadline = Label(fontStyle: .BoldBodySmall)
|
||||||
public let leftBody = Label(fontStyle: .BoldBodySmall)
|
public let leftBody = Label(fontStyle: .BoldBodySmall)
|
||||||
public let rightBar = Line()
|
public let rightBar: DataLine = {
|
||||||
|
var line = DataLine()
|
||||||
|
line.heightConstraint.constant = 2
|
||||||
|
return line
|
||||||
|
}()
|
||||||
public let rightLabel = Label(fontStyle: .BoldBodySmall)
|
public let rightLabel = Label(fontStyle: .BoldBodySmall)
|
||||||
private let barStackItem: StackItem
|
private let barStackItem: StackItem
|
||||||
private let rightLabelStackItem: StackItem
|
private let rightLabelStackItem: StackItem
|
||||||
@ -102,7 +106,6 @@
|
|||||||
leftHeadline.styleB1(true)
|
leftHeadline.styleB1(true)
|
||||||
leftBody.styleB2(true)
|
leftBody.styleB2(true)
|
||||||
rightLabel.styleB2(true)
|
rightLabel.styleB2(true)
|
||||||
rightBar.setStyle(.medium)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|||||||
@ -16,14 +16,14 @@ public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol {
|
|||||||
public var progressBar: ProgressBarModel
|
public var progressBar: ProgressBarModel
|
||||||
public var leftHeadline: LabelModel
|
public var leftHeadline: LabelModel
|
||||||
public var leftBody: LabelModel?
|
public var leftBody: LabelModel?
|
||||||
public var rightBar: LineModel
|
public var rightBar: DataLineModel
|
||||||
public var rightLabel: LabelModel
|
public var rightLabel: LabelModel
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(progressBar: ProgressBarModel, leftHeadline: LabelModel, leftBody: LabelModel? = nil, rightBar: LineModel, rightLabel: LabelModel) {
|
public init(progressBar: ProgressBarModel, leftHeadline: LabelModel, leftBody: LabelModel? = nil, rightBar: DataLineModel, rightLabel: LabelModel) {
|
||||||
self.progressBar = progressBar
|
self.progressBar = progressBar
|
||||||
self.leftHeadline = leftHeadline
|
self.leftHeadline = leftHeadline
|
||||||
self.leftBody = leftBody
|
self.leftBody = leftBody
|
||||||
@ -38,9 +38,7 @@ public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol {
|
|||||||
|
|
||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
|
|
||||||
rightBar.type = .medium
|
|
||||||
|
|
||||||
if rightBar.backgroundColor == nil {
|
if rightBar.backgroundColor == nil {
|
||||||
rightBar.backgroundColor = Color(uiColor: .gray)
|
rightBar.backgroundColor = Color(uiColor: .gray)
|
||||||
}
|
}
|
||||||
@ -74,7 +72,7 @@ public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol {
|
|||||||
progressBar = try typeContainer.decode(ProgressBarModel.self, forKey:.progressBar)
|
progressBar = try typeContainer.decode(ProgressBarModel.self, forKey:.progressBar)
|
||||||
leftHeadline = try typeContainer.decode(LabelModel.self, forKey: .leftHeadline)
|
leftHeadline = try typeContainer.decode(LabelModel.self, forKey: .leftHeadline)
|
||||||
leftBody = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .leftBody)
|
leftBody = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .leftBody)
|
||||||
rightBar = try typeContainer.decode(LineModel.self, forKey: .rightBar)
|
rightBar = try typeContainer.decode(DataLineModel.self, forKey: .rightBar)
|
||||||
rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel)
|
rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel)
|
||||||
try super.init(from: decoder)
|
try super.init(from: decoder)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,11 +55,11 @@ import Foundation
|
|||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let headlineLabel = headlineBody.headlineLabel.text {
|
if let headlineLabel = headlineBody.headlineLabel.accessibilityLabel ?? headlineBody.headlineLabel.text {
|
||||||
message += headlineLabel + ", "
|
message += headlineLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let messageLabel = headlineBody.messageLabel.text {
|
if let messageLabel = headlineBody.messageLabel.accessibilityLabel ?? headlineBody.messageLabel.text {
|
||||||
message += messageLabel
|
message += messageLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class ListRightVariableButtonAllTextAndLinksModel: ListItemModel, Molecul
|
|||||||
|
|
||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
self.button.size = .tiny
|
self.button.size = .small
|
||||||
self.button.style = .secondary
|
self.button.style = .secondary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,15 +6,26 @@
|
|||||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
open class DataLine: View {
|
||||||
|
|
||||||
|
lazy var heightConstraint = heightAnchor.constraint(equalToConstant: 4)
|
||||||
|
lazy var widthConstraint = widthAnchor.constraint(equalToConstant: 20)
|
||||||
|
|
||||||
|
open override func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
heightConstraint.isActive = true
|
||||||
|
widthConstraint.isActive = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objcMembers open class ListRightVariableTotalData: TableViewCell {
|
open class ListRightVariableTotalData: TableViewCell {
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public let leftLabel = Label(fontStyle: .BoldBodySmall)
|
public let leftLabel = Label(fontStyle: .BoldBodySmall)
|
||||||
public let rightLabel = Label(fontStyle: .RegularBodySmall)
|
public let rightLabel = Label(fontStyle: .RegularBodySmall)
|
||||||
public let bar = Line()
|
public let bar = DataLine()
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@ -44,8 +55,6 @@
|
|||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
bar.setStyle(.heavy)
|
|
||||||
bar.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
@ -74,7 +83,6 @@
|
|||||||
super.reset()
|
super.reset()
|
||||||
leftLabel.setFontStyle(.BoldBodySmall)
|
leftLabel.setFontStyle(.BoldBodySmall)
|
||||||
rightLabel.setFontStyle(.RegularBodySmall)
|
rightLabel.setFontStyle(.RegularBodySmall)
|
||||||
bar.setStyle(.heavy)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -6,8 +6,18 @@
|
|||||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
public struct DataLineModel: Codable, MoleculeModelProtocol {
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
public static var identifier: String = "line"
|
||||||
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case backgroundColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtocol {
|
public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtocol {
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -15,7 +25,7 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
|
|||||||
public static var identifier: String = "listRVLine"
|
public static var identifier: String = "listRVLine"
|
||||||
public var leftLabel: LabelModel
|
public var leftLabel: LabelModel
|
||||||
public var rightLabel: LabelModel
|
public var rightLabel: LabelModel
|
||||||
public var bar: LineModel
|
public var bar: DataLineModel
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Method
|
// MARK: - Method
|
||||||
@ -24,8 +34,6 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
|
|||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
rightLabel.hero = 0
|
rightLabel.hero = 0
|
||||||
bar.type = .heavy
|
|
||||||
|
|
||||||
if bar.backgroundColor == nil {
|
if bar.backgroundColor == nil {
|
||||||
bar.backgroundColor = Color(uiColor: .mvmBlue)
|
bar.backgroundColor = Color(uiColor: .mvmBlue)
|
||||||
}
|
}
|
||||||
@ -35,7 +43,7 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
|
|||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(leftLabel: LabelModel, rightlabel:LabelModel, bar: LineModel){
|
public init(leftLabel: LabelModel, rightlabel:LabelModel, bar: DataLineModel) {
|
||||||
self.leftLabel = leftLabel
|
self.leftLabel = leftLabel
|
||||||
self.rightLabel = rightlabel
|
self.rightLabel = rightlabel
|
||||||
self.bar = bar
|
self.bar = bar
|
||||||
@ -46,7 +54,7 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
|
|||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey{
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case leftLabel
|
case leftLabel
|
||||||
case rightLabel
|
case rightLabel
|
||||||
@ -61,7 +69,7 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
|
|||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)
|
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)
|
||||||
rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel)
|
rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel)
|
||||||
bar = try typeContainer.decode(LineModel.self, forKey: .bar)
|
bar = try typeContainer.decode(DataLineModel.self, forKey: .bar)
|
||||||
try super.init(from: decoder)
|
try super.init(from: decoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,8 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
|
|||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public static var identifier: String = "planNamesLockup"
|
public static var identifier: String = "planNamesLockup"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var headline: LabelModel
|
public var headline: LabelModel
|
||||||
public var subHeadline: LabelModel
|
public var subHeadline: LabelModel
|
||||||
@ -31,6 +33,7 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
|
|||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case headline
|
case headline
|
||||||
@ -43,6 +46,7 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
|
headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
|
||||||
subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline)
|
subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline)
|
||||||
@ -51,6 +55,7 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(headline, forKey: .headline)
|
try container.encode(headline, forKey: .headline)
|
||||||
|
|||||||
@ -14,6 +14,8 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "planLockup"
|
public static var identifier: String = "planLockup"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var planLabel : LabelModel
|
public var planLabel : LabelModel
|
||||||
public var headline : LabelModel
|
public var headline : LabelModel
|
||||||
@ -43,6 +45,7 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case planLabel
|
case planLabel
|
||||||
@ -57,6 +60,7 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
planLabel = try typeContainer.decode(LabelModel.self, forKey: .planLabel)
|
planLabel = try typeContainer.decode(LabelModel.self, forKey: .planLabel)
|
||||||
headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
|
headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
|
||||||
@ -67,6 +71,7 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(planLabel, forKey: .planLabel)
|
try container.encode(planLabel, forKey: .planLabel)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ public class TitleLockupModel: MoleculeModelProtocol, ParentMoleculeModelProtoco
|
|||||||
|
|
||||||
public static var identifier: String = "titleLockup"
|
public static var identifier: String = "titleLockup"
|
||||||
public var moleculeName: String = TitleLockupModel.identifier
|
public var moleculeName: String = TitleLockupModel.identifier
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var eyebrow: LabelModel?
|
public var eyebrow: LabelModel?
|
||||||
public var title: LabelModel
|
public var title: LabelModel
|
||||||
@ -130,6 +131,7 @@ public class TitleLockupModel: MoleculeModelProtocol, ParentMoleculeModelProtoco
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case eyebrow
|
case eyebrow
|
||||||
@ -145,6 +147,7 @@ public class TitleLockupModel: MoleculeModelProtocol, ParentMoleculeModelProtoco
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
title = try typeContainer.decodeMolecule(codingKey: .title)
|
title = try typeContainer.decodeMolecule(codingKey: .title)
|
||||||
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
||||||
subTitle = try typeContainer.decodeMoleculeIfPresent(codingKey: .subTitle)
|
subTitle = try typeContainer.decodeMoleculeIfPresent(codingKey: .subTitle)
|
||||||
@ -164,6 +167,7 @@ public class TitleLockupModel: MoleculeModelProtocol, ParentMoleculeModelProtoco
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(eyebrow, forKey: .eyebrow)
|
try container.encodeIfPresent(eyebrow, forKey: .eyebrow)
|
||||||
try container.encodeModel(title, forKey: .title)
|
try container.encodeModel(title, forKey: .title)
|
||||||
|
|||||||
@ -84,5 +84,6 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
accessibilityTraits.update(with: .header)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class ListOneColumnFullWidthTextDividerSubsectionModel: ListItemModel, MoleculeModelProtocol {
|
public class ListOneColumnFullWidthTextDividerSubsectionModel: ListItemModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -18,6 +18,10 @@ public class ListOneColumnFullWidthTextDividerSubsectionModel: ListItemModel, Mo
|
|||||||
public var headline: LabelModel
|
public var headline: LabelModel
|
||||||
public var body: LabelModel?
|
public var body: LabelModel?
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headline, body].compactMap({$0})
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -84,5 +84,6 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
accessibilityTraits.update(with: .header)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class ListOneColumnTextWithWhitespaceDividerShortModel: ListItemModel, MoleculeModelProtocol {
|
public class ListOneColumnTextWithWhitespaceDividerShortModel: ListItemModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -18,6 +18,10 @@ public class ListOneColumnTextWithWhitespaceDividerShortModel: ListItemModel, Mo
|
|||||||
public var headline: LabelModel
|
public var headline: LabelModel
|
||||||
public var body: LabelModel?
|
public var body: LabelModel?
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headline, body].compactMap({$0})
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -84,5 +84,6 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
accessibilityTraits.update(with: .header)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class ListOneColumnTextWithWhitespaceDividerTallModel: ListItemModel, MoleculeModelProtocol {
|
public class ListOneColumnTextWithWhitespaceDividerTallModel: ListItemModel, MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -18,6 +18,10 @@ public class ListOneColumnTextWithWhitespaceDividerTallModel: ListItemModel, Mol
|
|||||||
public var headline: LabelModel
|
public var headline: LabelModel
|
||||||
public var body: LabelModel?
|
public var body: LabelModel?
|
||||||
|
|
||||||
|
public var children: [MoleculeModelProtocol] {
|
||||||
|
[headline, body].compactMap({$0})
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -14,9 +14,11 @@ import Foundation
|
|||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
|
||||||
public static var identifier: String = "doughnutChartItem"
|
public static var identifier: String = "doughnutChartItem"
|
||||||
public var moleculeName: String = DoughnutChartItemModel.identifier
|
public var moleculeName: String = DoughnutChartItemModel.identifier
|
||||||
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
|
||||||
|
public var backgroundColor: Color?
|
||||||
public var label: LabelModel
|
public var label: LabelModel
|
||||||
@Percent public var percent: CGFloat
|
@Percent public var percent: CGFloat
|
||||||
public var color: Color
|
public var color: Color
|
||||||
|
|||||||
@ -14,9 +14,11 @@ import Foundation
|
|||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
|
||||||
public static var identifier: String = "doughnutChart"
|
public static var identifier: String = "doughnutChart"
|
||||||
public var moleculeName: String = DoughnutChartModel.identifier
|
public var moleculeName: String = DoughnutChartModel.identifier
|
||||||
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
|
||||||
|
public var backgroundColor: Color?
|
||||||
public var title: LabelModel?
|
public var title: LabelModel?
|
||||||
public var subtitle: LabelModel?
|
public var subtitle: LabelModel?
|
||||||
public var sections: [DoughnutChartItemModel]
|
public var sections: [DoughnutChartItemModel]
|
||||||
|
|||||||
@ -24,5 +24,14 @@
|
|||||||
if bottomPadding == nil {
|
if bottomPadding == nil {
|
||||||
bottomPadding = PaddingDefaultVerticalSpacing
|
bottomPadding = PaddingDefaultVerticalSpacing
|
||||||
}
|
}
|
||||||
|
guard !MVMCoreGetterUtility.isOnIPad(),
|
||||||
|
horizontalAlignment == nil else { return }
|
||||||
|
|
||||||
|
if let _ = molecule as? ButtonModel {
|
||||||
|
horizontalAlignment = .fill
|
||||||
|
} else if let model = molecule as? TwoButtonViewModel,
|
||||||
|
model.primaryButton == nil || model.secondaryButton == nil {
|
||||||
|
horizontalAlignment = .fill
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,8 @@ public class ImageHeadlineBodyModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public static var identifier: String = "imageHeadlineBody"
|
public static var identifier: String = "imageHeadlineBody"
|
||||||
public var moleculeName: String = ImageHeadlineBodyModel.identifier
|
public var moleculeName: String = ImageHeadlineBodyModel.identifier
|
||||||
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var image: ImageViewModel
|
public var image: ImageViewModel
|
||||||
public var headlineBody: HeadlineBodyModel
|
public var headlineBody: HeadlineBodyModel
|
||||||
|
|||||||
@ -15,6 +15,8 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "radioButtonLabel"
|
public static var identifier: String = "radioButtonLabel"
|
||||||
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var moleculeName: String = RadioButtonLabelModel.identifier
|
public var moleculeName: String = RadioButtonLabelModel.identifier
|
||||||
public var radioButton: RadioButtonModel
|
public var radioButton: RadioButtonModel
|
||||||
|
|||||||
@ -50,7 +50,7 @@ import VDSColorTokens
|
|||||||
setItems(tabs, animated: false)
|
setItems(tabs, animated: false)
|
||||||
selectedItem = tabs[model.selectedTab]
|
selectedItem = tabs[model.selectedTab]
|
||||||
|
|
||||||
guard let lineModel = line.lineModel else { return }
|
guard let lineModel = line.viewModel else { return }
|
||||||
lineModel.inverted = model.style == .dark
|
lineModel.inverted = model.style == .dark
|
||||||
line.set(with: lineModel, delegateObject, additionalData)
|
line.set(with: lineModel, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,8 @@ import VDSColorTokens
|
|||||||
|
|
||||||
open class TabBarModel: MoleculeModelProtocol {
|
open class TabBarModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "tabBar"
|
public static var identifier: String = "tabBar"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
open var tabs: [TabBarItemModel]
|
open var tabs: [TabBarItemModel]
|
||||||
|
|
||||||
private var _backgroundColor: Color?
|
private var _backgroundColor: Color?
|
||||||
@ -58,6 +60,7 @@ open class TabBarModel: MoleculeModelProtocol {
|
|||||||
open var selectedTab: Int = 0
|
open var selectedTab: Int = 0
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case tabs
|
case tabs
|
||||||
@ -73,6 +76,7 @@ open class TabBarModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
tabs = try typeContainer.decode([TabBarItemModel].self, forKey: .tabs)
|
tabs = try typeContainer.decode([TabBarItemModel].self, forKey: .tabs)
|
||||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) {
|
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) {
|
||||||
backgroundColor = color
|
backgroundColor = color
|
||||||
@ -93,6 +97,7 @@ open class TabBarModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(tabs, forKey: .tabs)
|
try container.encode(tabs, forKey: .tabs)
|
||||||
try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor)
|
||||||
|
|||||||
@ -174,7 +174,7 @@ import VDSColorTokens
|
|||||||
self.additionalData = additionalData
|
self.additionalData = additionalData
|
||||||
selectedIndex = tabsModel?.selectedIndex ?? 0
|
selectedIndex = tabsModel?.selectedIndex ?? 0
|
||||||
selectionLine.backgroundColor = tabsModel?.selectedBarColor.uiColor
|
selectionLine.backgroundColor = tabsModel?.selectedBarColor.uiColor
|
||||||
let lineModel = bottomLine.lineModel ?? LineModel(type: .secondary)
|
let lineModel = bottomLine.viewModel ?? LineModel(type: .secondary)
|
||||||
lineModel.inverted = tabsModel?.style == .dark
|
lineModel.inverted = tabsModel?.style == .dark
|
||||||
bottomLine.set(with: lineModel, delegateObject, additionalData)
|
bottomLine.set(with: lineModel, delegateObject, additionalData)
|
||||||
reloadData()
|
reloadData()
|
||||||
|
|||||||
@ -11,6 +11,8 @@ import VDSColorTokens
|
|||||||
|
|
||||||
open class TabsModel: MoleculeModelProtocol {
|
open class TabsModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "tabs"
|
public static var identifier: String = "tabs"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
open var tabs: [TabItemModel]
|
open var tabs: [TabItemModel]
|
||||||
|
|
||||||
open var style: NavigationItemStyle?
|
open var style: NavigationItemStyle?
|
||||||
@ -71,6 +73,7 @@ open class TabsModel: MoleculeModelProtocol {
|
|||||||
open var selectedIndex: Int = 0
|
open var selectedIndex: Int = 0
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case tabs
|
case tabs
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
@ -87,6 +90,7 @@ open class TabsModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
tabs = try typeContainer.decode([TabItemModel].self, forKey: .tabs)
|
tabs = try typeContainer.decode([TabItemModel].self, forKey: .tabs)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
_selectedColor = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedColor)
|
_selectedColor = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedColor)
|
||||||
@ -100,6 +104,7 @@ open class TabsModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(tabs, forKey: .tabs)
|
try container.encode(tabs, forKey: .tabs)
|
||||||
try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor)
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import VDS
|
||||||
|
|
||||||
@objcMembers open class TwoButtonView: View, MVMCoreUIViewConstrainingProtocol {
|
@objcMembers open class TwoButtonView: View, MVMCoreUIViewConstrainingProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -29,9 +29,8 @@ import UIKit
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func setDefaultAppearance() {
|
public func setDefaultAppearance() {
|
||||||
|
primaryButton.use = .primary
|
||||||
primaryButton.stylePrimary()
|
secondaryButton.use = .secondary
|
||||||
secondaryButton.styleSecondary()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import VDS
|
||||||
|
|
||||||
public class TwoButtonViewModel: ParentMoleculeModelProtocol {
|
public class TwoButtonViewModel: ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -15,6 +15,7 @@ public class TwoButtonViewModel: ParentMoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "twoButtonView"
|
public static var identifier: String = "twoButtonView"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var primaryButton: ButtonModel?
|
public var primaryButton: ButtonModel?
|
||||||
public var secondaryButton: ButtonModel?
|
public var secondaryButton: ButtonModel?
|
||||||
@ -28,6 +29,7 @@ public class TwoButtonViewModel: ParentMoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case primaryButton
|
case primaryButton
|
||||||
@ -49,23 +51,25 @@ public class TwoButtonViewModel: ParentMoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
|
||||||
//set context value for 'primary' style to be set for the primaryButton in case the
|
//set context value for 'primary' style to be set for the primaryButton in case the
|
||||||
//property is not returned in the JSON and once decoded, this value is removed from the context
|
//property is not returned in the JSON and once decoded, this value is removed from the context
|
||||||
try decoder.setContext(value: Styler.Button.Style.primary, for: "style") {
|
try decoder.setContext(value: Use.primary, for: "style") {
|
||||||
self.primaryButton = try typeContainer.decodeMoleculeIfPresent(codingKey: .primaryButton)
|
self.primaryButton = try typeContainer.decodeMoleculeIfPresent(codingKey: .primaryButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
//set context value for 'secondary' style to be set for the primaryButton in case the
|
//set context value for 'secondary' style to be set for the primaryButton in case the
|
||||||
//property is not returned in the JSON and once decoded, this value is removed from the context
|
//property is not returned in the JSON and once decoded, this value is removed from the context
|
||||||
try decoder.setContext(value: Styler.Button.Style.secondary, for: "style") {
|
try decoder.setContext(value: Use.secondary, for: "style") {
|
||||||
self.secondaryButton = try typeContainer.decodeMoleculeIfPresent(codingKey: .secondaryButton)
|
self.secondaryButton = try typeContainer.decodeMoleculeIfPresent(codingKey: .secondaryButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(primaryButton, forKey: .primaryButton)
|
try container.encodeIfPresent(primaryButton, forKey: .primaryButton)
|
||||||
|
|||||||
@ -10,11 +10,14 @@ import Foundation
|
|||||||
|
|
||||||
public class TwoLinkViewModel: MoleculeModelProtocol {
|
public class TwoLinkViewModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "twoLinkView"
|
public static var identifier: String = "twoLinkView"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var rightLink: LinkModel?
|
public var rightLink: LinkModel?
|
||||||
public var leftLink: LinkModel?
|
public var leftLink: LinkModel?
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case rightLink
|
case rightLink
|
||||||
@ -28,6 +31,7 @@ public class TwoLinkViewModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
rightLink = try typeContainer.decodeIfPresent(LinkModel.self, forKey: .rightLink)
|
rightLink = try typeContainer.decodeIfPresent(LinkModel.self, forKey: .rightLink)
|
||||||
leftLink = try typeContainer.decodeIfPresent(LinkModel.self, forKey: .leftLink)
|
leftLink = try typeContainer.decodeIfPresent(LinkModel.self, forKey: .leftLink)
|
||||||
@ -35,6 +39,7 @@ public class TwoLinkViewModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(rightLink, forKey: .rightLink)
|
try container.encodeIfPresent(rightLink, forKey: .rightLink)
|
||||||
|
|||||||
@ -11,6 +11,8 @@ import Foundation
|
|||||||
public class ActionDetailWithImageModel: MoleculeModelProtocol {
|
public class ActionDetailWithImageModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "actionDetailWithImage"
|
public static var identifier: String = "actionDetailWithImage"
|
||||||
public var moleculeName: String = ActionDetailWithImageModel.identifier
|
public var moleculeName: String = ActionDetailWithImageModel.identifier
|
||||||
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var headlineBodyButton: HeadlineBodyButtonModel
|
public var headlineBodyButton: HeadlineBodyButtonModel
|
||||||
public var image: ImageViewModel
|
public var image: ImageViewModel
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import MVMCore
|
|||||||
|
|
||||||
public class CornerLabelsModel: ParentMoleculeModelProtocol {
|
public class CornerLabelsModel: ParentMoleculeModelProtocol {
|
||||||
public static var identifier: String = "cornerLabels"
|
public static var identifier: String = "cornerLabels"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var topLeftLabel: LabelModel?
|
public var topLeftLabel: LabelModel?
|
||||||
public var topRightLabel: LabelModel?
|
public var topRightLabel: LabelModel?
|
||||||
@ -26,6 +27,7 @@ public class CornerLabelsModel: ParentMoleculeModelProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case topLeftLabel
|
case topLeftLabel
|
||||||
case topRightLabel
|
case topRightLabel
|
||||||
@ -37,6 +39,7 @@ public class CornerLabelsModel: ParentMoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
molecule = try typeContainer.decodeModelIfPresent(codingKey: .molecule)
|
molecule = try typeContainer.decodeModelIfPresent(codingKey: .molecule)
|
||||||
topLeftLabel = try typeContainer.decodeMoleculeIfPresent(codingKey: .topLeftLabel)
|
topLeftLabel = try typeContainer.decodeMoleculeIfPresent(codingKey: .topLeftLabel)
|
||||||
@ -47,6 +50,7 @@ public class CornerLabelsModel: ParentMoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeModelIfPresent(molecule, forKey: .molecule)
|
try container.encodeModelIfPresent(molecule, forKey: .molecule)
|
||||||
try container.encodeModelIfPresent(topLeftLabel, forKey: .topLeftLabel)
|
try container.encodeModelIfPresent(topLeftLabel, forKey: .topLeftLabel)
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import Foundation
|
|||||||
public class HeadlineBodyLinkToggleModel: MoleculeModelProtocol {
|
public class HeadlineBodyLinkToggleModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "headlineBodyLinkToggle"
|
public static var identifier: String = "headlineBodyLinkToggle"
|
||||||
public var moleculeName: String = HeadlineBodyLinkToggleModel.identifier
|
public var moleculeName: String = HeadlineBodyLinkToggleModel.identifier
|
||||||
|
@DecodableDefault.UUIDString public var id: String
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var headlineBodyLink: HeadlineBodyLinkModel
|
public var headlineBodyLink: HeadlineBodyLinkModel
|
||||||
public var toggle: ToggleModel
|
public var toggle: ToggleModel
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import Foundation
|
|||||||
open class HeadlineBodyToggleModel: MoleculeModelProtocol {
|
open class HeadlineBodyToggleModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "headlineBodyToggle"
|
public static var identifier: String = "headlineBodyToggle"
|
||||||
public var moleculeName: String = HeadlineBodyToggleModel.identifier
|
public var moleculeName: String = HeadlineBodyToggleModel.identifier
|
||||||
|
@DecodableDefault.UUIDString public var id: String
|
||||||
open var backgroundColor: Color?
|
open var backgroundColor: Color?
|
||||||
open var headlineBody: HeadlineBodyModel
|
open var headlineBody: HeadlineBodyModel
|
||||||
open var toggle: ToggleModel
|
open var toggle: ToggleModel
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import MVMCore
|
|||||||
public class LabelToggleModel: MoleculeModelProtocol {
|
public class LabelToggleModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "labelToggle"
|
public static var identifier: String = "labelToggle"
|
||||||
public var moleculeName: String = LabelToggleModel.identifier
|
public var moleculeName: String = LabelToggleModel.identifier
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var label: LabelModel
|
public var label: LabelModel
|
||||||
public var toggle: ToggleModel
|
public var toggle: ToggleModel
|
||||||
@ -22,6 +24,7 @@ public class LabelToggleModel: MoleculeModelProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case label
|
case label
|
||||||
@ -30,6 +33,7 @@ public class LabelToggleModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey:.backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey:.backgroundColor)
|
||||||
label = try typeContainer.decode(LabelModel.self, forKey:.label)
|
label = try typeContainer.decode(LabelModel.self, forKey:.label)
|
||||||
toggle = try typeContainer.decode(ToggleModel.self, forKey:.toggle)
|
toggle = try typeContainer.decode(ToggleModel.self, forKey:.toggle)
|
||||||
@ -38,6 +42,7 @@ public class LabelToggleModel: MoleculeModelProtocol {
|
|||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(label, forKey: .label)
|
try container.encode(label, forKey: .label)
|
||||||
try container.encode(toggle, forKey: .toggle)
|
try container.encode(toggle, forKey: .toggle)
|
||||||
|
|||||||
@ -13,9 +13,11 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
|
|||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public static var identifier: String = "navigationImageButton"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public static var identifier: String = "navigationImageButton"
|
|
||||||
public var image: String
|
public var image: String
|
||||||
public var action: ActionModelProtocol
|
public var action: ActionModelProtocol
|
||||||
public var accessibilityText: String?
|
public var accessibilityText: String?
|
||||||
@ -35,6 +37,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case image
|
case image
|
||||||
case action
|
case action
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
@ -49,6 +52,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
image = try typeContainer.decode(String.self, forKey: .image)
|
image = try typeContainer.decode(String.self, forKey: .image)
|
||||||
action = try typeContainer.decodeModel(codingKey: .action)
|
action = try typeContainer.decodeModel(codingKey: .action)
|
||||||
@ -60,6 +64,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
|
|||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(image, forKey: .image)
|
try container.encode(image, forKey: .image)
|
||||||
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
|||||||
@ -12,8 +12,10 @@ open class NavigationLabelButtonModel: NavigationButtonModelProtocol, MoleculeMo
|
|||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open var backgroundColor: Color?
|
|
||||||
open class var identifier: String { "navigationLabelButton" }
|
open class var identifier: String { "navigationLabelButton" }
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
|
open var backgroundColor: Color?
|
||||||
open var accessibilityIdentifier: String?
|
open var accessibilityIdentifier: String?
|
||||||
open var title: String
|
open var title: String
|
||||||
open var action: ActionModelProtocol
|
open var action: ActionModelProtocol
|
||||||
@ -32,6 +34,7 @@ open class NavigationLabelButtonModel: NavigationButtonModelProtocol, MoleculeMo
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case accessibilityIdentifier
|
case accessibilityIdentifier
|
||||||
case title
|
case title
|
||||||
@ -44,6 +47,7 @@ open class NavigationLabelButtonModel: NavigationButtonModelProtocol, MoleculeMo
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
title = try typeContainer.decode(String.self, forKey: .title)
|
title = try typeContainer.decode(String.self, forKey: .title)
|
||||||
action = try typeContainer.decodeModel(codingKey: .action)
|
action = try typeContainer.decodeModel(codingKey: .action)
|
||||||
@ -51,6 +55,7 @@ open class NavigationLabelButtonModel: NavigationButtonModelProtocol, MoleculeMo
|
|||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(title, forKey: .title)
|
try container.encode(title, forKey: .title)
|
||||||
|
|||||||
@ -19,6 +19,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open class var identifier: String { "navigationBar" }
|
open class var identifier: String { "navigationBar" }
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
private let defaultHidesSystemBackButton = true
|
private let defaultHidesSystemBackButton = true
|
||||||
|
|
||||||
@ -74,6 +75,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case title
|
case title
|
||||||
case hidden
|
case hidden
|
||||||
@ -96,6 +98,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
||||||
if let hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden) {
|
if let hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden) {
|
||||||
self.hidden = hidden
|
self.hidden = hidden
|
||||||
@ -122,6 +125,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(title, forKey: .title)
|
try container.encodeIfPresent(title, forKey: .title)
|
||||||
try container.encode(hidden, forKey: .hidden)
|
try container.encode(hidden, forKey: .hidden)
|
||||||
|
|||||||
@ -9,11 +9,15 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
open class ModuleMoleculeModel: MoleculeModelProtocol {
|
open class ModuleMoleculeModel: MoleculeModelProtocol {
|
||||||
public var backgroundColor: Color?
|
|
||||||
public static var identifier: String = "moduleMolecule"
|
public static var identifier: String = "moduleMolecule"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
|
public var backgroundColor: Color?
|
||||||
public var moduleName: String
|
public var moduleName: String
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moduleName
|
case moduleName
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,11 +27,13 @@ open class ModuleMoleculeModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
moduleName = try typeContainer.decode(String.self, forKey:.moduleName)
|
moduleName = try typeContainer.decode(String.self, forKey:.moduleName)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moduleName, forKey: .moduleName)
|
try container.encode(moduleName, forKey: .moduleName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,7 +114,7 @@ import MVMCore
|
|||||||
|
|
||||||
open func performBlockOperation(with block: @escaping (MVMCoreBlockOperation) -> Void) {
|
open func performBlockOperation(with block: @escaping (MVMCoreBlockOperation) -> Void) {
|
||||||
let operation = MVMCoreBlockOperation(block: block)!
|
let operation = MVMCoreBlockOperation(block: block)!
|
||||||
MVMCoreNavigationHandler.shared()?.addNavigationOperation(operation)
|
NavigationHandler.shared().navigationQueue.addOperation(operation)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Collapses after a delay
|
/// Collapses after a delay
|
||||||
|
|||||||
@ -89,7 +89,7 @@ open class NotificationMoleculeModel: ContainerModel, MoleculeModelProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button?.size = .tiny
|
button?.size = .small
|
||||||
button?.style = .secondary
|
button?.style = .secondary
|
||||||
switch style {
|
switch style {
|
||||||
case .error, .warning:
|
case .error, .warning:
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import Foundation
|
|||||||
|
|
||||||
public let headline = Label(fontStyle: .BoldBodySmall)
|
public let headline = Label(fontStyle: .BoldBodySmall)
|
||||||
public let body = Label(fontStyle: .RegularBodySmall)
|
public let body = Label(fontStyle: .RegularBodySmall)
|
||||||
public let button = PillButton(asPrimaryButton: false, makeTiny: true)
|
public let button = PillButton()
|
||||||
public let closeButton = NotificationXButton()
|
public let closeButton = NotificationXButton()
|
||||||
public var labelStack: Stack<StackModel>!
|
public var labelStack: Stack<StackModel>!
|
||||||
public var horizontalStack: Stack<StackModel>!
|
public var horizontalStack: Stack<StackModel>!
|
||||||
|
|||||||
@ -10,12 +10,16 @@ import Foundation
|
|||||||
import MVMCore
|
import MVMCore
|
||||||
|
|
||||||
public class NotificationXButtonModel: ButtonModelProtocol, MoleculeModelProtocol {
|
public class NotificationXButtonModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||||
|
|
||||||
public static var identifier: String = "notificationXButton"
|
public static var identifier: String = "notificationXButton"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var color: Color?
|
public var color: Color?
|
||||||
public var action: ActionModelProtocol = ActionNoopModel()
|
public var action: ActionModelProtocol = ActionNoopModel()
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case color
|
case color
|
||||||
case action
|
case action
|
||||||
@ -28,6 +32,7 @@ public class NotificationXButtonModel: ButtonModelProtocol, MoleculeModelProtoco
|
|||||||
|
|
||||||
public required init(from decoder: Decoder) throws {
|
public required init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
color = try typeContainer.decodeIfPresent(Color.self, forKey: .color)
|
color = try typeContainer.decodeIfPresent(Color.self, forKey: .color)
|
||||||
if let action: ActionModelProtocol = try typeContainer.decodeModelIfPresent(codingKey: .action) {
|
if let action: ActionModelProtocol = try typeContainer.decodeModelIfPresent(codingKey: .action) {
|
||||||
self.action = action
|
self.action = action
|
||||||
@ -36,6 +41,7 @@ public class NotificationXButtonModel: ButtonModelProtocol, MoleculeModelProtoco
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(color, forKey: .color)
|
try container.encodeIfPresent(color, forKey: .color)
|
||||||
try container.encodeModel(action, forKey: .action)
|
try container.encodeModel(action, forKey: .action)
|
||||||
|
|||||||
@ -54,7 +54,7 @@ public class BGImageHeadlineBodyButtonModel: ContainerModel, MoleculeModelProtoc
|
|||||||
image.height = BGImageHeadlineBodyButton.heightConstant
|
image.height = BGImageHeadlineBodyButton.heightConstant
|
||||||
}
|
}
|
||||||
|
|
||||||
button?.size = .tiny
|
button?.size = .small
|
||||||
button?.style = .secondary
|
button?.style = .secondary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol, ParentMolecule
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "eyebrowHeadlineBodyLink"
|
public static var identifier: String = "eyebrowHeadlineBodyLink"
|
||||||
|
public var id: String = UUID().uuidString
|
||||||
public var moleculeName: String = EyebrowHeadlineBodyLinkModel.identifier
|
public var moleculeName: String = EyebrowHeadlineBodyLinkModel.identifier
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var eyebrow: LabelModel?
|
public var eyebrow: LabelModel?
|
||||||
@ -56,6 +57,7 @@ public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol, ParentMolecule
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case eyebrow
|
case eyebrow
|
||||||
@ -70,6 +72,7 @@ public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol, ParentMolecule
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
||||||
headline = try typeContainer.decodeMoleculeIfPresent(codingKey: .headline)
|
headline = try typeContainer.decodeMoleculeIfPresent(codingKey: .headline)
|
||||||
@ -84,6 +87,7 @@ public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol, ParentMolecule
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(eyebrow, forKey: .eyebrow)
|
try container.encodeIfPresent(eyebrow, forKey: .eyebrow)
|
||||||
|
|||||||
@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
headlineBody.headlineLabel.font = Styler.Font.BoldTitleMedium.getFont()
|
headlineBody.headlineLabel.font = Styler.Font.BoldTitleMedium.getFont()
|
||||||
headlineBody.messageLabel.font = Styler.Font.RegularMicro.getFont()
|
headlineBody.messageLabel.font = Styler.Font.RegularMicro.getFont()
|
||||||
button.styleSecondary()
|
button.use = .secondary
|
||||||
button.isHidden = false
|
button.isHidden = false
|
||||||
buttonHeadlinePadding = PaddingTwo
|
buttonHeadlinePadding = PaddingTwo
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user