feat(vault): pick a notebook vault folder on first run
Some checks failed
CI / Windows build (push) Has been cancelled

Phase 0 of the file-based storage plan (docs/plans/
2026-06-24-file-based-storage.md). Foundation only — no editor or
DB change yet.

- VaultService (SharedPreferences): stores the vault root path,
  vaultRootValid() = path set AND directory exists.
- VaultSetupScreen: first-run folder picker (file_picker, Windows).
- main.dart gates HomeScreen behind a valid vault, re-prompting if
  the saved folder is gone.
- Settings: a Vault section to change the folder.

Editors still use SQLite; later phases move annotations into
per-file sidecars under the vault. analyze clean, tests green.
This commit is contained in:
2026-06-24 20:45:16 +08:00
parent 875dabcd89
commit 9fcac47ef2
10 changed files with 655 additions and 3 deletions

View File

@@ -99,5 +99,21 @@
"@boardDanglingLink": {
"placeholders": { "target": { "type": "String" } }
},
"close": "Close"
"close": "Close",
"vaultSetupTitle": "Choose your vault",
"vaultSetupHeadline": "Pick a folder for your notebooks",
"vaultSetupBody": "BadNote stores your notebooks inside one folder you choose — like an Obsidian vault. Pick a folder you control (e.g. a synced folder) so your notes travel with their files.",
"vaultChooseFolder": "Choose folder",
"vaultMissingTitle": "Your vault folder is missing",
"vaultMissingBody": "The folder you picked can't be found (it may have been moved, deleted, or on a drive that's unplugged). Relocate it or pick a new one.",
"vaultPickFailed": "Couldn't open the folder picker: {error}",
"@vaultPickFailed": {
"placeholders": { "error": { "type": "String" } }
},
"vaultNotWritable": "That folder isn't writable. Please choose another.",
"vaultSection": "Vault",
"vaultFolderLabel": "Vault folder",
"vaultNoneSelected": "No folder selected",
"vaultChangeFolder": "Change vault folder",
"vaultUpdated": "Vault folder updated"
}