Skip to content

Commit

Permalink
Try to fix sync start when online state resumes
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomas2 committed Jan 11, 2025
1 parent 45eb0a7 commit 842701e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,6 @@ class MainBibleActivity : CustomTitlebarActivityBase() {
windowRepository.saveIntoDb(false)
if (force || (now - max(lastSynchronized, lastTouched) > syncInterval && CloudSync.hasChanges())) {
Log.i(TAG, "Performing periodic sync")
CommonUtils.settings.setLong("globalLastSynchronized", now)
if(!CloudSync.signedIn) {
CloudSync.signIn(this@MainBibleActivity)
}
Expand All @@ -1418,6 +1417,12 @@ class MainBibleActivity : CustomTitlebarActivityBase() {
}
}

fun onEvent(event: CloudSyncEvent) {
if (!event.running) {
CommonUtils.settings.setLong("globalLastSynchronized", now)
}
}

private fun stopPeriodicSync() {
syncJob?.cancel()
syncJob = null
Expand Down

0 comments on commit 842701e

Please sign in to comment.