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:
parent
be797aaee2
commit
10c63a52b9
@ -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")
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user