davx5-ose icon indicating copy to clipboard operation
davx5-ose copied to clipboard

Update sync progress bar when pending in SAF

Open sunkup opened this issue 5 months ago • 3 comments

Purpose

After editing an event, task or contact in a local collection / content provider, their entries are marked as dirty and the sync framework can inform us about the pending sync status. We should listen for changes and show the state in DAVx5.

Short description

  • SyncFrameworkIntegration: Create isSyncPending flow which emits sync pending state for given account and authorities
  • AccountProgressUseCase: Collect the flow and show sync pending status in caldav/carddav collection view
  • AccountsModel: Collect the flow and show sync pending status in accounts view
  • Cancel any pending SAF syncs on sync request from SAF before enqueueing workmanager sync. This will reset the (wrongly saved) always pending sync flag in Android 14 and 15 and has no consequences for the functionionality on A13 and below.

Note

~For testing, note that sometimes pending syncs get stuck forever if (any?) tasks app is installed and synchronized. Try testing on a clean emulator without tasks apps installed and it should work.~ Fixed

Note 2

Changes in any calendar will show the calendar authority of all accounts as pending for sync, regardless of which is checked. This does not seem to be the case with contacts. Since it's SAF internal again, I am not sure whether/how this can be avoided.

Checklist

  • [X] The PR has a proper title, description and label.
  • [X] I have self-reviewed the PR.
  • [X] I have added documentation to complex functions and functions that can be used by other modules.
  • [X] I have added reasonable tests or consciously decided to not add tests.

sunkup avatar May 06 '25 13:05 sunkup