select all behavior.
This commit is contained in:
parent
97ecf292dd
commit
975f3fa012
@ -10,10 +10,10 @@
|
|||||||
public class SelectAllBoxesBehaviorModel: PageBehaviorModelProtocol {
|
public class SelectAllBoxesBehaviorModel: PageBehaviorModelProtocol {
|
||||||
public class var identifier: String { "selectAllBoxesBehavior" }
|
public class var identifier: String { "selectAllBoxesBehavior" }
|
||||||
public var shouldAllowMultipleInstances: Bool { false }
|
public var shouldAllowMultipleInstances: Bool { false }
|
||||||
|
|
||||||
public init() { }
|
public init() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SelectAllBoxesBehavior: PageCustomActionHandlerBehavior {
|
public class SelectAllBoxesBehavior: PageCustomActionHandlerBehavior {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Active Model
|
// MARK: - Active Model
|
||||||
@ -42,19 +42,26 @@ public class SelectAllBoxesBehavior: PageCustomActionHandlerBehavior {
|
|||||||
|
|
||||||
guard actionType == "selectAllBoxes" else { return false }
|
guard actionType == "selectAllBoxes" else { return false }
|
||||||
|
|
||||||
// Update the model. play -> pause OR pause -> play
|
let currentVC = MVMCoreUIUtility.getCurrentVisibleController()
|
||||||
if true {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
traverseAndSelectCheckboxes(view: currentVC.view)
|
||||||
|
|
||||||
// TODO: Tell Template to update this cell (needs to be built). Currently it updates all cells.
|
// TODO: A) select all boxes and the change the nav button title to "deselect all"
|
||||||
|
// TODO: B) deselect all boxes and change nav nutton title to "select all"
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
public func onPageHidden(_ delegateObject: MVMCoreUIDelegateObject?) {
|
private func traverseAndSelectCheckboxes(view: UIView) {
|
||||||
// TODO: Stop player
|
|
||||||
|
if let checkbox = view as? Checkbox {
|
||||||
|
checkbox.isSelected = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for subview in view.subviews {
|
||||||
|
traverseAndSelectCheckboxes(view: subview)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -225,6 +225,7 @@ open class CoreUIModelMapping: ModelMapping {
|
|||||||
try? ModelRegistry.register(handler: ScreenBrightnessModifierBehavior.self, for: ScreenBrightnessModifierBehaviorModel.self)
|
try? ModelRegistry.register(handler: ScreenBrightnessModifierBehavior.self, for: ScreenBrightnessModifierBehaviorModel.self)
|
||||||
try? ModelRegistry.register(handler: PageGetContactBehavior.self, for: PageGetContactBehaviorModel.self)
|
try? ModelRegistry.register(handler: PageGetContactBehavior.self, for: PageGetContactBehaviorModel.self)
|
||||||
try? ModelRegistry.register(handler: PagePlayAudioBehavior.self, for: PagePlayAudioBehaviorModel.self)
|
try? ModelRegistry.register(handler: PagePlayAudioBehavior.self, for: PagePlayAudioBehaviorModel.self)
|
||||||
|
try? ModelRegistry.register(handler: SelectAllBoxesBehavior.self, for: SelectAllBoxesBehaviorModel.self)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func registerActions() {
|
open override class func registerActions() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user