1 package com.android.onboarding.nodes 2 3 /** 4 * An [OnboardingGraphLog.Observer] which logs a single entry each time we "transition" from one 5 * node to another. 6 * 7 * This will only make sense when the flow is serial and there are no nodes executing in parallel. 8 * Once parallel nodes is common this should be removed. 9 * 10 * This is only for use exploring how much of the Onboarding flow is covered by nodes. It should not 11 * be depended upon for any other purpose. 12 */ 13 class OnboardingGraphNodeTransitionObserver(private val observer: OnboardingGraphLog.Observer) : 14 OnboardingGraphLog.Observer { 15 16 private var currentNodeId: Long? = null 17 onEventnull18 override fun onEvent(event: OnboardingEvent) { 19 if (event.nodeId != currentNodeId) { 20 currentNodeId = event.nodeId 21 22 observer.onEvent(event) 23 } 24 } 25 } 26