Conversation
…rate function - added functions to import/export history and star tables to external sqlite3 file
…itNavigationDrawer - lots of code just to add icons to the new import/export buttons :) - new functions for importing/exporting user data to storage using the android file picker and new functionality in DBManager
- success and error messages for import and export
|
The last commit has nothing to do with the import/export feature. I just noticed that www.dharmaseed.org links were not being redirected to the app! This might explain some seemingly inconsistent behavior that we noticed in the past. |
bb4242
left a comment
There was a problem hiding this comment.
This looks great to me! Thanks @intermarc. I've tested the changes locally and everything works as expected. I think this will be a really nice feature both for users and for us while doing development (where I often find myself wiping out my database as I install and uninstall development versions of the app).
| copyStreams(dbIn, dbOut, true); | ||
| } | ||
|
|
||
| private void copyStreams(InputStream src, OutputStream dest, boolean closeAfterCopy) throws IOException { |
There was a problem hiding this comment.
I think all uses of this method call it with closeAfterCopy = true. Would it make sense to just remove this parameter?
There was a problem hiding this comment.
Yes, of course. Good idea!
| ); | ||
| } | ||
|
|
||
| private void addDBIcons(MenuItem item, String baseText) { |
There was a problem hiding this comment.
In an ideal world, I think it would be nice to be able to embed these icons directly inside of the drawer_import/drawer_export resource strings, so we didn't have to write code to join the icons together with the text. However, I'm not aware of any way to do that, so I think this is the next best approach. 🙂
There was a problem hiding this comment.
That would have been nice, yes. I was hoping to find a Unicode "History Clock" character, but no luck. As it is, the amount of code for the menu item is probably about the same as the actual import/export functionality! Oh well.
This branch adds functionality to import and export database tables with user data, which could be useful when migrating to a new device or to just have a backup. In particular, the data exported/imported includes:
Import and export are based on .sqlite3 files and use the android file picker, such that the app does not require additional storage access permissions. The following image illustrates the import process:

Imported tables are merged with existing tables in the app. For the "star" tables, this is a straight forward union. For the history table, conflicts are resolved by retaining the talk playback progress with the most recent access date.