Repository navigation
feat(android): add contextual SAF document and folder pickers - #3009
marvin1099 wants to merge 8 commits into
Conversation
[Medium impact] The PR appears safe to merge, with a non-blocking issue where newly created documents keep the old tab name. Findings
SummaryAdds contextual Android document and folder pickers.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Save or Save As] --> B{Choose destination}
B --> C[Create document on device]
B --> D[Save File browser]
D --> C
D --> E[Choose folder on device]
C --> F[Write editor contents]
F --> G{Write succeeds?}
G -->|No| H[Keep old tab identity]
G -->|Yes| I[Update URI and permission state]
I --> J[Filename update is blocked by single mode]
Reviews (2) · Last reviewed commit: "feat(file-browser): enable device folder..." · Reviewed by Greptile |
71fb3e4 to
60227cc
Compare
| file.SAFMode = "single"; | ||
| file.uri = fileUri; | ||
| targetUri = fileUri; | ||
| file.persistInSession = createdDocument.persistedUriPermission !== false; | ||
| file.filename = filename; |
There was a problem hiding this comment.
When the user creates a document with a different name, saveFile sets SAFMode to "single" before assigning filename. The real EditorFile.filename setter ignores assignments in that mode. The saved tab keeps its old name and does not switch languages if the extension changed.
After the write succeeds, update the name while the setter is unlocked, then set SAFMode to "single". The tests miss this because their file is a plain object.
There was a problem hiding this comment.
Fixed in the Save-dialog commit: after the document write succeeds, Save As unlocks SAF mode, updates the filename, then restores single-document mode. The regression test uses a real EditorFile starting in single mode, changes the extension, and verifies the filename and language mode update.
60227cc to
d6c3746
Compare
Summary
Evidence
EditorFiletest verifies renaming and language switching for a new document.Merge Danger
Door: Two-way; the commits can be reverted independently.
Blast Radius: Medium — Android document save/open and folder-selection flows.
AI was used to make these changes. Feel free to ignore, cherry-pick, or request changes I should make for this PR to be a good fit.