audio behavior
This commit is contained in:
parent
6702e9bc75
commit
06a42cfa21
@ -61,6 +61,7 @@
|
||||
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 */; };
|
||||
@ -622,6 +623,7 @@
|
||||
01EB368C23609801006832FA /* HeaderModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeaderModel.swift; sourceTree = "<group>"; };
|
||||
01EB368D23609801006832FA /* HeadlineBodyModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeadlineBodyModel.swift; sourceTree = "<group>"; };
|
||||
01F2A03123A4498200D954D8 /* CaretLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CaretLinkModel.swift; sourceTree = "<group>"; };
|
||||
0A01DE262626236300C2CAAC /* PlayAudioBehavior.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayAudioBehavior.swift; sourceTree = "<group>"; };
|
||||
0A0FEC7325D42A5E00AF2548 /* BaseItemPickerEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseItemPickerEntryField.swift; sourceTree = "<group>"; };
|
||||
0A0FEC7725D42A8500AF2548 /* BaseItemPickerEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseItemPickerEntryFieldModel.swift; sourceTree = "<group>"; };
|
||||
0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionDetailWithImage.swift; sourceTree = "<group>"; };
|
||||
@ -1311,6 +1313,7 @@
|
||||
0A1C30972620F61A00B47F3B /* Protocols */,
|
||||
27F97369246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift */,
|
||||
D23A900826125FFB007E14CE /* GetContactBehavior.swift */,
|
||||
0A01DE262626236300C2CAAC /* PlayAudioBehavior.swift */,
|
||||
);
|
||||
path = Behaviors;
|
||||
sourceTree = "<group>";
|
||||
@ -2878,6 +2881,7 @@
|
||||
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 */,
|
||||
|
||||
54
MVMCoreUI/Behaviors/PlayAudioBehavior.swift
Normal file
54
MVMCoreUI/Behaviors/PlayAudioBehavior.swift
Normal file
@ -0,0 +1,54 @@
|
||||
//
|
||||
// PlayAudioBehavior.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Kevin Christiano on 4/9/21.
|
||||
// Copyright © 2021 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
public protocol PagePlayAudioBehaviorConsumerProtocol {
|
||||
// func getMatchParameters() -> (NSPredicate, [CNKeyDescriptor])?
|
||||
// func consume(contacts: [CNContact])
|
||||
}
|
||||
|
||||
public class PagePlayAudioBehaviorModel: PageBehaviorModelProtocol {
|
||||
public class var identifier: String { "pagePlayAudioBehavior" }
|
||||
public var shouldAllowMultipleInstances: Bool { false }
|
||||
|
||||
public init() { }
|
||||
}
|
||||
|
||||
public class PagePlayAudioBehavior: PageVisibilityBehavior {
|
||||
var delegate: MVMCoreUIDelegateObject?
|
||||
|
||||
public required init(model: PageBehaviorModelProtocol, delegateObject: MVMCoreUIDelegateObject?) {
|
||||
self.delegate = delegateObject
|
||||
}
|
||||
|
||||
public func onPageShown(_ delegateObject: MVMCoreUIDelegateObject?) {
|
||||
// Ask for permission
|
||||
// CNContactStore().requestAccess(for: .contacts) { [weak self] (access, error) in
|
||||
// guard access,
|
||||
// error == nil,
|
||||
// // TODO: Clean up this interface
|
||||
// let model = (self?.delegate?.moleculeDelegate as? PageProtocol)?.pageModel as? TemplateModelProtocol else { return }
|
||||
// // Iterate models and provide contact
|
||||
// let store = CNContactStore()
|
||||
// let consumers: [PagePlayAudioBehaviorConsumerProtocol] = model.allMoleculesOfType()
|
||||
// for consumer in consumers {
|
||||
// guard let parameters = consumer.getMatchParameters(),
|
||||
// let contacts = try? store.unifiedContacts(matching: parameters.0, keysToFetch: parameters.1) else { return }
|
||||
// consumer.consume(contacts: contacts)
|
||||
// }
|
||||
//
|
||||
// // Tell template to update
|
||||
// MVMCoreDispatchUtility.performBlock(onMainThread: {
|
||||
// // TODO: move to protocol function instead
|
||||
// (self?.delegate?.moleculeDelegate as? ViewController)?.handleNewData()
|
||||
// })
|
||||
// }
|
||||
}
|
||||
|
||||
public func onPageHidden(_ delegateObject: MVMCoreUIDelegateObject?) {}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user