debug cleanup
This commit is contained in:
parent
7e5aa638dd
commit
b5a00cb33f
@ -9,7 +9,7 @@ import AVKit
|
||||
|
||||
open class Video: View {
|
||||
public let videoViewController = AVPlayerViewController()
|
||||
public var delegateObject: MVMCoreUIDelegateObject?
|
||||
private weak var containingView: UIView?
|
||||
|
||||
/// Used to track the state and respond..
|
||||
private var stateKVOToken: NSKeyValueObservation?
|
||||
@ -24,7 +24,7 @@ open class Video: View {
|
||||
|
||||
/// Checks if the video is visible in the molecule delegate
|
||||
open func isVisibleInDelegate() -> Bool {
|
||||
guard let containingView = (delegateObject?.moleculeDelegate as? UIViewController)?.view else { return true }
|
||||
guard let containingView = containingView else { return true }
|
||||
return isVisible(in: containingView)
|
||||
}
|
||||
|
||||
@ -34,11 +34,12 @@ open class Video: View {
|
||||
}
|
||||
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
self.delegateObject = delegateObject
|
||||
/// Detach the view from it's previous model before setting.
|
||||
(self.model as? VideoModel)?.view = nil
|
||||
containingView = (delegateObject?.moleculeDelegate as? UIViewController)?.view
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let model = model as? VideoModel else { return }
|
||||
|
||||
guard let model = model as? VideoModel else { return }
|
||||
if let controller = delegateObject?.moleculeDelegate as? UIViewController {
|
||||
controller.addChild(videoViewController)
|
||||
videoViewController.didMove(toParent: controller)
|
||||
|
||||
@ -24,9 +24,7 @@ open class VideoModel: MoleculeModelProtocol {
|
||||
videoDataManager.videoState == .loaded else { return }
|
||||
if halted {
|
||||
videoDataManager.player?.pause()
|
||||
printThat(string: "halted")
|
||||
} else {
|
||||
printThat(string: "unhalted")
|
||||
if alwaysReset {
|
||||
// Always start video at the beginning.
|
||||
videoDataManager.player?.seek(to: .zero)
|
||||
@ -83,28 +81,8 @@ open class VideoModel: MoleculeModelProtocol {
|
||||
try container.encode(alwaysReset, forKey: .alwaysReset)
|
||||
}
|
||||
|
||||
func printThat(string: String) {
|
||||
var newString = "sss" + string + " model:\(Unmanaged.passUnretained(self).toOpaque())"
|
||||
if var view: UIView = self.view {
|
||||
newString = newString + " view:\(Unmanaged.passUnretained(view).toOpaque())"
|
||||
while (view as? BGVideoImageMolecule) == nil {
|
||||
if let superView = view.superview {
|
||||
view = superView
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
if let title = (((view as? BGVideoImageMolecule)?.view as? FooterView)?.view as? TwoButtonView)?.primaryButton.title(for: .normal) {
|
||||
newString = newString + " \(title)"
|
||||
}
|
||||
}
|
||||
print(newString)
|
||||
}
|
||||
|
||||
open func addVisibilityHalting(for view: Video, delegateObject: MVMCoreUIDelegateObject?) {
|
||||
printThat(string: "before adding")
|
||||
self.view = view
|
||||
printThat(string: "after adding")
|
||||
halted = false
|
||||
addVisibleBehavior(for: view, delegateObject: delegateObject)
|
||||
addScrollBehavior(for: view, delegateObject: delegateObject)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user