From 97ecf292ddac6c52ea86839a38fea9c98c1e083b Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 17 Jun 2021 10:00:36 -0400 Subject: [PATCH] added new behaviors for select all boxes. --- MVMCoreUI.xcodeproj/project.pbxproj | 4 ++ .../Behaviors/SelectAllBoxesBehavior.swift | 60 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 MVMCoreUI/Behaviors/SelectAllBoxesBehavior.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 6b5b0a14..5eedcf5b 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -108,6 +108,7 @@ 0A9D09222433796500D2E6C0 /* CarouselIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D091C2433796500D2E6C0 /* CarouselIndicator.swift */; }; 0AA33B3A2398524F0067DD0F /* Toggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AA33B392398524F0067DD0F /* Toggle.swift */; }; 0AA4D2E125CAEC72008DB32D /* AccessibilityModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AA4D2E025CAEC72008DB32D /* AccessibilityModelProtocol.swift */; }; + 0AAB7855267B86F900DD6437 /* SelectAllBoxesBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AAB7854267B86F900DD6437 /* SelectAllBoxesBehavior.swift */; }; 0AB000BA24BF63490090C5E7 /* ModalListPageTemplateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AB000B924BF63490090C5E7 /* ModalListPageTemplateModel.swift */; }; 0AB000BC24BF64A50090C5E7 /* ModalStackPageTemplateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AB000BB24BF64A50090C5E7 /* ModalStackPageTemplateModel.swift */; }; 0AB764D124460F6300E7FE72 /* UIDatePicker+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AB764D024460F6300E7FE72 /* UIDatePicker+Extension.swift */; }; @@ -674,6 +675,7 @@ 0AA33B33239813C50067DD0F /* UIColor+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Extension.swift"; sourceTree = ""; }; 0AA33B392398524F0067DD0F /* Toggle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toggle.swift; sourceTree = ""; }; 0AA4D2E025CAEC72008DB32D /* AccessibilityModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilityModelProtocol.swift; sourceTree = ""; }; + 0AAB7854267B86F900DD6437 /* SelectAllBoxesBehavior.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectAllBoxesBehavior.swift; sourceTree = ""; }; 0AB000B924BF63490090C5E7 /* ModalListPageTemplateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalListPageTemplateModel.swift; sourceTree = ""; }; 0AB000BB24BF64A50090C5E7 /* ModalStackPageTemplateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalStackPageTemplateModel.swift; sourceTree = ""; }; 0AB764D024460F6300E7FE72 /* UIDatePicker+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIDatePicker+Extension.swift"; sourceTree = ""; }; @@ -1316,6 +1318,7 @@ 27F97369246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift */, D23A900826125FFB007E14CE /* GetContactBehavior.swift */, 0A01DE262626236300C2CAAC /* PlayAudioBehavior.swift */, + 0AAB7854267B86F900DD6437 /* SelectAllBoxesBehavior.swift */, ); path = Behaviors; sourceTree = ""; @@ -2718,6 +2721,7 @@ 011D959B240451E3000E3791 /* RuleRequiredModel.swift in Sources */, 526A265C240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift in Sources */, D2A92886241ACD99004E01C6 /* ProgrammaticTableViewController.swift in Sources */, + 0AAB7855267B86F900DD6437 /* SelectAllBoxesBehavior.swift in Sources */, BBAA4F05243D8E3B005AAD5F /* RadioBoxesModel.swift in Sources */, 01509D952327ED1900EF99AA /* HeadlineBodyLinkToggle.swift in Sources */, AA104ADA244734DB004D2810 /* HeadersH1LandingPageHeader.swift in Sources */, diff --git a/MVMCoreUI/Behaviors/SelectAllBoxesBehavior.swift b/MVMCoreUI/Behaviors/SelectAllBoxesBehavior.swift new file mode 100644 index 00000000..70e5fdf0 --- /dev/null +++ b/MVMCoreUI/Behaviors/SelectAllBoxesBehavior.swift @@ -0,0 +1,60 @@ +// +// SelectAllBoxesBehavior.swift +// MVMCoreUI +// +// Created by Kevin Christiano on 6/17/21. +// Copyright © 2021 Verizon Wireless. All rights reserved. +// + + +public class SelectAllBoxesBehaviorModel: PageBehaviorModelProtocol { + public class var identifier: String { "selectAllBoxesBehavior" } + public var shouldAllowMultipleInstances: Bool { false } + + public init() { } +} + +public class SelectAllBoxesBehavior: PageCustomActionHandlerBehavior { + //-------------------------------------------------- + // MARK: - Active Model + //-------------------------------------------------- + + //-------------------------------------------------- + // MARK: - Delegate + //-------------------------------------------------- + + var delegate: MVMCoreUIDelegateObject? + + //-------------------------------------------------- + // MARK: - Init + //-------------------------------------------------- + + public required init(model: PageBehaviorModelProtocol, delegateObject: MVMCoreUIDelegateObject?) { + self.delegate = delegateObject + } + + //-------------------------------------------------- + // MARK: - Custom Action + //-------------------------------------------------- + + // Either play or pause + public func handleAction(type actionType: String?, information: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?) -> Bool { + + guard actionType == "selectAllBoxes" else { return false } + + // Update the model. play -> pause OR pause -> play + if true { + + } else { + + } + + // TODO: Tell Template to update this cell (needs to be built). Currently it updates all cells. + + return true + } + + public func onPageHidden(_ delegateObject: MVMCoreUIDelegateObject?) { + // TODO: Stop player + } +}