Digital PCT265 defect DE307-687: Slightly better logging clarity, making sure the base page is logged before the module counterparts.

This commit is contained in:
Hedden, Kyle Matthew 2024-06-17 19:43:47 -04:00
parent be797aaee2
commit 10c63a52b9

View File

@ -30,7 +30,7 @@ public class ReplaceableMoleculeBehavior: PageMoleculeTransformationBehavior, Pa
String(describing: Self.self)
}
var hasPreviouslyBeenShown = false
var isPageShowing = false
var previouslyReplacedIds = Set<String>()
var moleculeIds: [String]
public var modulesToListenFor: [String]
@ -120,21 +120,22 @@ public class ReplaceableMoleculeBehavior: PageMoleculeTransformationBehavior, Pa
return
}
previouslyReplacedIds.insert(moleculeId)
guard isPageShowing else { return } // Page has not been made visible yet. (Pulled and replaced from cache on load or background update.) Hold reporting until onPageShown.
MVMCoreUILoggingHandler.shared()?.defaultLogPageUpdate(forController: viewController, from: module)
}
public func onPageShown(_ delegateObject: MVMCoreUIDelegateObject?) {
guard hasPreviouslyBeenShown else {
// Skip first replacement build handled in onPageNew. (Pulled and reported from cache.)
hasPreviouslyBeenShown = true
return
}
debugLog("Page reshown. Resend replaced molecule analytics for: \(previouslyReplacedIds)")
isPageShowing = true
debugLog("Page shown. Send molecule analytics for: \(previouslyReplacedIds)")
previouslyReplacedIds.forEach { id in
logUpdated(moleculeId: id)
}
}
public func onPageHidden(_ delegateObject: MVMCoreUIDelegateObject?) {
isPageShowing = false
}
deinit {
debugLog("deinit")
}