Skip to content

feat: file-based import/export for Quicks config#557

Open
mvanhorn wants to merge 1 commit into
Cateners:mainfrom
mvanhorn:feat/537-quicks-file-import-export
Open

feat: file-based import/export for Quicks config#557
mvanhorn wants to merge 1 commit into
Cateners:mainfrom
mvanhorn:feat/537-quicks-file-import-export

Conversation

@mvanhorn

Copy link
Copy Markdown

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 the quick_commands and options subtrees to YAML via the existing SnakeYAML path, and importAllFromYaml() parses a file, validates each node through the existing validateNode path, merges the valid nodes, and calls save(). The pure serialization step lives in a exportConfigToYaml companion helper.
  • QuicksFragment: two Storage Access Framework launchers (CreateDocument for export, OpenDocument for import) read and write through contentResolver, with the same Snackbar success/partial/error reporting used by the clipboard import.
  • Two toolbar icon buttons added to both tc4_fragment_quicks.xml layout variants (default and layout-w600dp) and new strings in the default and zh-rCN resources.

Testing

Added QuicksImportExportTest covering 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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

导入或导出快捷指令配置

1 participant