feat: file-based import/export for Quicks config#557
Open
mvanhorn wants to merge 1 commit into
Open
Conversation
Add Storage Access Framework export/import for the whole Quicks (quick_commands + options) configuration so shortcuts survive an app reinstall, building on the existing clipboard export/import. Adds exportAllToYaml/importAllFromYaml to QuicksViewModel, two SAF launchers and toolbar buttons in QuicksFragment, layout buttons in both variants, and the new strings. Closes Cateners#537
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds file-based export and import for the whole Quicks configuration so users can save their shortcut commands and options to a file and restore them after uninstalling and reinstalling the app.
Why this matters
Issue #537 asks to import/export the Quicks (快捷指令) config so shortcuts do not have to be rebuilt by hand after a reinstall. The app already exports/imports selected nodes through the clipboard (
QuicksViewModel.exportSelected/importFromClipboard), but the clipboard only holds the current selection and does not survive a reinstall. This adds durable whole-config export to a file and import back from a file.What changed
QuicksViewModel:exportAllToYaml()serializes thequick_commandsandoptionssubtrees to YAML via the existing SnakeYAML path, andimportAllFromYaml()parses a file, validates each node through the existingvalidateNodepath, merges the valid nodes, and callssave(). The pure serialization step lives in aexportConfigToYamlcompanion helper.QuicksFragment: two Storage Access Framework launchers (CreateDocumentfor export,OpenDocumentfor import) read and write throughcontentResolver, with the same Snackbar success/partial/error reporting used by the clipboard import.tc4_fragment_quicks.xmllayout variants (default andlayout-w600dp) and new strings in the default andzh-rCNresources.Testing
Added
QuicksImportExportTestcovering the export serialization (subtree selection, YAML round-trip, omission of absent subtrees). Imports and SAF flows depend on Android resources and were checked by reading through the clipboard import path they reuse. Note: a full Gradle build needs the Android SDK, which was not available in this environment.Fixes #537