Skip to content

Commit

Permalink
Stop notifying data change after every book sync
Browse files Browse the repository at this point in the history
  • Loading branch information
nevenz committed Sep 1, 2022
1 parent a88e502 commit 4bb880c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/src/main/java/com/orgzly/android/sync/SyncService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -324,24 +324,25 @@ class SyncService : Service() {
BookAction.forNow(BookAction.Type.ERROR, e.message ?: ""))
}

// TODO: Call only if book was loaded, move to usecase
RemindersScheduler.notifyDataSetChanged(App.getAppContext())
ListWidgetProvider.notifyDataSetChanged(App.getAppContext())
SharingShortcutsManager().replaceDynamicShortcuts(App.getAppContext())

syncStatus.set(SyncStatus.Type.BOOK_ENDED, namesake.name, curr + 1, namesakes.size)
announceActiveSyncStatus()
}

curr++
}

for (repo in repos) {
if (repo is TwoWaySyncRepo) {
repo.tryPushIfHeadDiffersFromRemote()
if (!isCancelled) {
for (repo in repos) {
if (repo is TwoWaySyncRepo) {
repo.tryPushIfHeadDiffersFromRemote()
}
}
}

RemindersScheduler.notifyDataSetChanged(App.getAppContext())
ListWidgetProvider.notifyDataSetChanged(App.getAppContext())
SharingShortcutsManager().replaceDynamicShortcuts(App.getAppContext())

syncStatus.set(SyncStatus.Type.FINISHED, null, 0, 0)
announceActiveSyncStatus()

Expand Down

0 comments on commit 4bb880c

Please sign in to comment.