Skip to content

feat: enable auto-sync for file access via Storage Access Framework (SAF).#89

Open
edo-bari-ikutsu wants to merge 1 commit intoopencloud-eu:mainfrom
edo-bari-ikutsu:improvement/document_storage_provider
Open

feat: enable auto-sync for file access via Storage Access Framework (SAF).#89
edo-bari-ikutsu wants to merge 1 commit intoopencloud-eu:mainfrom
edo-bari-ikutsu:improvement/document_storage_provider

Conversation

@edo-bari-ikutsu
Copy link

Summary

This PR implements automatic synchronization when files are accessed via the Storage Access Framework (SAF) by other applications.

Changes

Previously, if a newer version of a file existed on the server, it wouldn't be downloaded automatically when opened via SAF—users had to manually open the OpenCloud app first to trigger a sync. This PR ensures that users always receive the latest version of a file when accessing it through SAF.

Testing

  • Verified that the latest file is automatically downloaded when opened by external apps.
  • Tested the following scenarios:
    • Local file does not exist (initial download).
    • Local file is already up to date.

@guruz guruz self-requested a review January 26, 2026 08:52
@streaminganger
Copy link

i am not able to test the fix but i think I can create this scenario with more detailed steps.

  1. open web app and create a new text file test.txt with the content v1
  2. on android, force stop the opencloud app
  3. go to any app like telegram with native SAF file picker upload
  4. upload the test.txt and verified that the uploaded content is v1
  5. in the web app, update the text file content to v2.
  6. upload test.txt again, the uploaded content is v1. it should be v2. instead.

@guruz
Copy link
Contributor

guruz commented Mar 11, 2026

@streaminganger Thank you for spotting. I had actually created a follow up PR for this but was unsure if it was needed (because it's more complex). My PR shoud fix what you're seeing. It's on top of @edo-bari-ikutsu 's commit -> #108

@guruz
Copy link
Contributor

guruz commented Mar 11, 2026

i am not able to test the fix but i think I can create this scenario with more detailed steps.

I think I might have misread this first. You are talking about UPLOADING from Android to server? This PR and #108 does not touch that path, it's only about downloading from server to device

@streaminganger
Copy link

i am not able to test the fix but i think I can create this scenario with more detailed steps.

I think I might have misread this first. You are talking about UPLOADING from Android to server? This PR and #108 does not touch that path, it's only about downloading from server to device

Indeed I am uploading from the SAF, which also needs the file synced(downloaded) before uploading. But I also just realised that I could skip that uploading step and access the files directly from SAF to test.

@guruz
Copy link
Contributor

guruz commented Mar 11, 2026

(just wait for my new build for doing more tests...but testing in different ways is good)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants