Improve waiting for sync

This commit is contained in:
Jonas Lochmann 2020-09-07 02:00:00 +02:00
parent 5f50845cdb
commit 24cd44db84
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36

View file

@ -163,9 +163,11 @@ class SyncUtil (private val logic: AppLogic) {
suspend fun requestImportantSyncAndWait() {
withContext (Dispatchers.Main) {
val currentLastSync = lastSync.value
importantSyncRequested.value = true
importantSyncRequested.waitUntilValueMatches { it == false }
lastSync.waitUntilValueMatches { it != currentLastSync }
}
}