From edbe68429b0d791dde49f365ce7dc4710b0a1a77 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Wed, 14 Jul 2021 00:19:00 +0530 Subject: [PATCH] Moving PlayAudioBehavior to MobileFirst --- MVMCoreUI.xcodeproj/project.pbxproj | 4 - MVMCoreUI/Behaviors/PlayAudioBehavior.swift | 77 ------------------- .../OtherHandlers/CoreUIModelMapping.swift | 1 - 3 files changed, 82 deletions(-) delete mode 100644 MVMCoreUI/Behaviors/PlayAudioBehavior.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 9d145d5a..15f22974 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -61,7 +61,6 @@ 01EB369323609801006832FA /* HeaderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01EB368C23609801006832FA /* HeaderModel.swift */; }; 01EB369423609801006832FA /* HeadlineBodyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01EB368D23609801006832FA /* HeadlineBodyModel.swift */; }; 01F2A03223A4498200D954D8 /* CaretLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A03123A4498200D954D8 /* CaretLinkModel.swift */; }; - 0A01DE272626236300C2CAAC /* PlayAudioBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A01DE262626236300C2CAAC /* PlayAudioBehavior.swift */; }; 0A0FEC7425D42A5E00AF2548 /* BaseItemPickerEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A0FEC7325D42A5E00AF2548 /* BaseItemPickerEntryField.swift */; }; 0A0FEC7825D42A8500AF2548 /* BaseItemPickerEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A0FEC7725D42A8500AF2548 /* BaseItemPickerEntryFieldModel.swift */; }; 0A1214A022C11A18007C7030 /* ActionDetailWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */; }; @@ -625,7 +624,6 @@ 01EB368C23609801006832FA /* HeaderModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeaderModel.swift; sourceTree = ""; }; 01EB368D23609801006832FA /* HeadlineBodyModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeadlineBodyModel.swift; sourceTree = ""; }; 01F2A03123A4498200D954D8 /* CaretLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CaretLinkModel.swift; sourceTree = ""; }; - 0A01DE262626236300C2CAAC /* PlayAudioBehavior.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayAudioBehavior.swift; sourceTree = ""; }; 0A0FEC7325D42A5E00AF2548 /* BaseItemPickerEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseItemPickerEntryField.swift; sourceTree = ""; }; 0A0FEC7725D42A8500AF2548 /* BaseItemPickerEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseItemPickerEntryFieldModel.swift; sourceTree = ""; }; 0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionDetailWithImage.swift; sourceTree = ""; }; @@ -1319,7 +1317,6 @@ 0A1C30972620F61A00B47F3B /* Protocols */, 27F97369246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift */, D23A900826125FFB007E14CE /* GetContactBehavior.swift */, - 0A01DE262626236300C2CAAC /* PlayAudioBehavior.swift */, ); path = Behaviors; sourceTree = ""; @@ -2886,7 +2883,6 @@ D2092355244FA0FD0044AD09 /* ThreeLayerTemplateModelProtocol.swift in Sources */, 0AE14F64238315D2005417F8 /* TextField.swift in Sources */, 0A51F3E22475CB73002E08B6 /* LoadingSpinnerModel.swift in Sources */, - 0A01DE272626236300C2CAAC /* PlayAudioBehavior.swift in Sources */, D2169303251E53D9002A6324 /* SectionListTemplateModel.swift in Sources */, 0AB764D124460F6300E7FE72 /* UIDatePicker+Extension.swift in Sources */, BB105859248DEFF70069D008 /* UICollectionViewLeftAlignedLayout.swift in Sources */, diff --git a/MVMCoreUI/Behaviors/PlayAudioBehavior.swift b/MVMCoreUI/Behaviors/PlayAudioBehavior.swift deleted file mode 100644 index ebb9f46c..00000000 --- a/MVMCoreUI/Behaviors/PlayAudioBehavior.swift +++ /dev/null @@ -1,77 +0,0 @@ -// -// PlayAudioBehavior.swift -// MVMCoreUI -// -// Created by Kevin Christiano on 4/9/21. -// Copyright © 2021 Verizon Wireless. All rights reserved. -// - - -public protocol PagePlayAudioBehaviorConsumerProtocol { - func togglePlayPause() - func play() - func pause() - func stop() - var isPlaying: Bool { get } - var messageID: String? { get } - var audioFileURL: URL? { get set } -} - -public class PagePlayAudioBehaviorModel: PageBehaviorModelProtocol { - public class var identifier: String { "pagePlayAudioBehavior" } - public var shouldAllowMultipleInstances: Bool { false } - - public init() { } -} - -public class PagePlayAudioBehavior: PageCustomActionHandlerBehavior, PageVisibilityBehavior { - - //-------------------------------------------------- - // MARK: - Active Model - //-------------------------------------------------- - - public static var activeAudioPlayerDelegate: PagePlayAudioBehaviorConsumerProtocol? - - //-------------------------------------------------- - // MARK: - Delegate - //-------------------------------------------------- - - weak 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 == "playAudio" else { return false } - - // Update the model. play -> pause OR pause -> play - if Self.activeAudioPlayerDelegate?.isPlaying ?? false { - Self.activeAudioPlayerDelegate?.pause() - } else { - Self.activeAudioPlayerDelegate?.play() - } - return true - } - - //-------------------------------------------------- - // MARK: - PageVisibilityBehavior - //-------------------------------------------------- - - public func onPageShown(_ delegateObject: MVMCoreUIDelegateObject?) { } - - public func onPageHidden(_ delegateObject: MVMCoreUIDelegateObject?) { - //Stop player - Self.activeAudioPlayerDelegate?.pause() - } -} diff --git a/MVMCoreUI/OtherHandlers/CoreUIModelMapping.swift b/MVMCoreUI/OtherHandlers/CoreUIModelMapping.swift index c95964b2..1edea27b 100644 --- a/MVMCoreUI/OtherHandlers/CoreUIModelMapping.swift +++ b/MVMCoreUI/OtherHandlers/CoreUIModelMapping.swift @@ -222,7 +222,6 @@ open class CoreUIModelMapping: ModelMapping { open class func registerBehaviors() { ModelRegistry.register(handler: ScreenBrightnessModifierBehavior.self, for: ScreenBrightnessModifierBehaviorModel.self) ModelRegistry.register(handler: PageGetContactBehavior.self, for: PageGetContactBehaviorModel.self) - ModelRegistry.register(handler: PagePlayAudioBehavior.self, for: PagePlayAudioBehaviorModel.self) } open override class func registerActions() {