From 7e5aa638ddca2a4d15fda0c805935c072f57a01c Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Feb 2021 15:17:14 -0500 Subject: [PATCH] active fix --- MVMCoreUI/Atomic/Atoms/Views/VideoModel.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/VideoModel.swift b/MVMCoreUI/Atomic/Atoms/Views/VideoModel.swift index 68ec423a..ac97eba0 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/VideoModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/VideoModel.swift @@ -161,14 +161,14 @@ open class VideoModel: MoleculeModelProtocol { open func addActiveListener(for view: Video, delegateObject: MVMCoreUIDelegateObject?) { removeActiveListener() - guard let containingView = (delegateObject?.moleculeDelegate as? UIViewController)?.view else { return } resignActiveListener = NotificationCenter.default.addObserver(forName: UIApplication.willResignActiveNotification, object: nil, queue: OperationQueue.main) { [weak self] (notification) in self?.halted = true } activeListener = NotificationCenter.default.addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: OperationQueue.main) { [weak self] (notification) in - if MVMCoreUIUtility.isView(view, visibleIn: containingView) { - self?.halted = false - } + guard let self = self, + let view = self.view, + view.isVisibleInDelegate() else { return } + self.halted = false } }