File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
appnav/src/main/kotlin/io/element/android/appnav Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ import io.element.android.libraries.preferences.api.store.EnableNativeSlidingSyn
8484import io.element.android.services.appnavstate.api.AppNavigationStateService
8585import kotlinx.coroutines.CoroutineScope
8686import kotlinx.coroutines.FlowPreview
87+ import kotlinx.coroutines.flow.collectIndexed
8788import kotlinx.coroutines.flow.combine
8889import kotlinx.coroutines.flow.debounce
8990import kotlinx.coroutines.flow.launchIn
@@ -196,9 +197,9 @@ class LoggedInFlowNode @AssistedInject constructor(
196197 ) { syncState, networkStatus ->
197198 Pair (syncState, networkStatus)
198199 }
199- .collect { (syncState, networkStatus) ->
200- Timber .d(" Sync state: $syncState , network status: $networkStatus " )
201- if (syncState != SyncState .Running && networkStatus == NetworkStatus .Online ) {
200+ .collectIndexed { index, (syncState, networkStatus) ->
201+ Timber .d(" Sync state: $syncState , network status: $networkStatus , index: $index " )
202+ if (syncState != SyncState .Running && (index == 0 || networkStatus == NetworkStatus .Online ) ) {
202203 syncService.startSync()
203204 }
204205 }
You can’t perform that action at this time.
0 commit comments