feat: enable auto-sync for file access via Storage Access Framework (SAF). #89 v2#108
feat: enable auto-sync for file access via Storage Access Framework (SAF). #89 v2#108
Conversation
|
@streaminganger Do you want me to create a test build for you and you say if it's good enough? |
No harm. happy to test. |
8d83217 to
3023e60
Compare
The previous SAF (DocumentsStorageProvider) implementation fired SynchronizeFileUseCase asynchronously and polled isAvailableLocally, serving stale local copies when a newer version existed on the server. Rewrite openDocument to handle sync results synchronously: - For already-downloaded files: run PROPFIND, act on the result (wait for download, handle conflicts, etc.) instead of fire-and-forget. - For new files: enqueue download directly, skip unnecessary PROPFIND. Apps like Google Photos call openDocument 4+ times concurrently for the same file. Add two layers of dedup to avoid redundant network requests: - In-flight dedup (ConcurrentHashMap + CompletableFuture): concurrent calls share one PROPFIND or one download instead of each doing their own. - TTL cache: skip re-checking a file that was just synced/downloaded. Fix false "changed locally" detection in DownloadFileWorker by using the file's actual filesystem mtime for lastSyncDateForData instead of System.currentTimeMillis(), which could be slightly earlier than the file's mtime due to second-precision rounding.
|
@streaminganger Sorry for delay. Here is the build: https://github.com/opencloud-eu/android/releases/download/build-tester-apk-5/OpenCloud-qa-8e4bafc-20260316_1921-5.apk @edo-bari-ikutsu Could you have a quick look at the on-top commit? |
i tested the build based on 8e4bafc and seems to have fixed the issue in #89. it works reliably after testing in different scenarios. good job |
FYI @edo-bari-ikutsu
The thing I don't like about my change is that it creates some delays because it does a lot of PROPFINDs (triggered by OS or used app) via openDocument