Skip to content

Conversation

@roberi
Copy link
Collaborator

@roberi roberi commented Sep 18, 2025

Previously, database exports were saved to app-private storage, making it difficult (if not impossible) for users to access the database file outside of RunnerUp. This PR refactors the database import and export functionality from using app-private storage to using the Storage Access Framework (SAF). This framework allows users to interact with a system picker to select files from shared storage, not requiring any system permissions. For RunnerUp, users may now choose where their database backups are saved and accessed from.

Fixes #1083. Fixes #1153.

TODOs (separate PRs):

  1. Add confirmation prompt before overwriting existing DB when importing (Feature Request: Confirmation prompt before importing #1089).
  2. Backup the current DB before overwriting.
  3. Enable direct DB file opening from file managers via AndroidManifest intent filter.
  4. Handle existing DB export in app-private storage (move to shared storage).

This commit transitions database import/export to use the Storage Access Framework (SAF). This allows users to choose export locations outside of app-private storage.

Key Changes:
- SettingsMaintenanceFragment now uses ActivityResultLauncher with Intent.ACTION_CREATE_DOCUMENT for export and Intent.ACTION_OPEN_DOCUMENT for import, allowing users to select file locations using the system file picker.
- DBHelper.importDatabase and DBHelper.exportDatabase now accept Uri parameters (Uri is returned from system file picker).
- DBHelper.getDbUri method added to retrieve the RunnerUp database file as a Uri.
- FileUtil.copyFile is overloaded to support copying content between Uris using ContentResolver.
- Added new string resources for import/export cancellation messages.
This commit introduces a validation step to ensure that the selected Uri for database import is a valid RunnerUp SQLite database.
This commit introduces an error dialog that is displayed to the user when they attempt to import an invalid RunnerUp database file. A new string resource import_error_invalid_database was added for the dialog message.
@roberi
Copy link
Collaborator Author

roberi commented Sep 18, 2025

The string resource Maintenance_explanation_summary needs to be updated. Current value:

RunnerUp saves workouts into a SQL-database.\nFor maintenance, the file runnerup.db.export can be imported and exported from/to\n%1$s

Since it's already translated into all languages, how do I update the text? @gerhardol?

@gerhardol
Copy link
Collaborator

Since it's already translated into all languages, how do I update the text? @gerhardol?

You update the code, all translatable text in the preferences.
The translations is in Transifex, somehow described.
sources are pushed to Transifex, translators should be notified and update gaps. This project pulls the translations.

Around releases I usually do that loop a couple of times, see some of my commits.
Can do that here too.

@roberi
Copy link
Collaborator Author

roberi commented Sep 20, 2025

Can do that here too.

Thanks!

see some of my commits.

I still don´t understand. =(

The string resource I need to update is common.R.string.Maintenance_explanation_summary. It is already translated into 8 other languages. After I update the English text, do I delete these 8 other translations?

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.

export saves the file in an inaccessible location [BUG] importing Backup

2 participants