sync Events
Observable SmartWalking event state.
Emits SmartWalkingEvent subclasses as the sync lifecycle progresses: SmartWalkingEvent.Idle, SmartWalkingEvent.SyncStarted, SmartWalkingEvent.SyncCompleted, SmartWalkingEvent.SyncFailed, SmartWalkingEvent.AutoSyncEnabled, SmartWalkingEvent.AutoSyncDisabled, and SmartWalkingEvent.BackgroundDeliveryTriggered.
Kotlin
lifecycleScope.launch {
AFCore.smartWalking().syncEvents.collect { event ->
when (event) {
is SmartWalkingEvent.SyncStarted ->
binding.syncIndicator.isVisible = true
is SmartWalkingEvent.SyncCompleted,
is SmartWalkingEvent.SyncFailed,
is SmartWalkingEvent.Idle ->
binding.syncIndicator.isVisible = false
else -> {}
}
}
}Content copied to clipboard