-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements Backup Improvements for 3.4 #776
Implements Backup Improvements for 3.4 #776
Conversation
After merging other PRs, there are now little merge conflicts |
d6e8e18
to
38bd08c
Compare
Should be good to go now. Also added a commit to remove some of the now unused code... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed the PR.
It no longer gives an error when trying to save on Android 10, so that's a big improvement already!
I tested saving and restoring the application database and modules to/from phone storage which all worked fine on Android 10.
I ran into one problem, backup to phone storage does not overwrite an existing file.
So I end up with andBibleDatabase.db
, andBibleDatabase.db (1)
and andBibleDatabase.db (2)
.
That issue has to be resolved before merging, IMO.
@@ -220,20 +218,12 @@ constructor(private val callingActivity: MainBibleActivity, | |||
.setTitle(callingActivity.getString(R.string.backup_backup_title)) | |||
.setMessage(callingActivity.getString(R.string.backup_backup_message)) | |||
.setNegativeButton(callingActivity.getString(R.string.backup_phone_storage)) { dialog, which -> | |||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is removed, I think this needs testing on those android versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would indeed be good to roughly go through different android versions with emulator (from lollipop (5) to the latest models).
@@ -259,29 +249,9 @@ constructor(private val callingActivity: MainBibleActivity, | |||
requestCode = IntentHelper.UPDATE_SUGGESTED_DOCUMENTS_ON_FINISH | |||
} | |||
R.id.restore_app_database -> { | |||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is removed, I think this needs testing on those android versions.
Regarding the multiple file names, this is an android file level problem as the intent automatically creates a new file if one with the same name already exists. Possible options are to show another screen when choosing backup when user clicks phone storage as described below Current:When a user selects the phone storage option:
Possible Change:When a user selects the phone storage option
|
I like the simplicity of your current solution. I think this is a problem that should be solved by Android indeed. So, considering that the issue is not easily resolved at the moment, and the current status is an improvement with respect to the previous version, this PR can be merged IMO (After some testing on older android versions). |
was doing some testing on older versions and i discovered this error in general..
Does anyone know how to fix? |
I great to see this stuff being tested thoroughly. :) This issue is because the dialog is trying to start on a background thread, but it must be started on the main thread. In GlobalScope.launch(Dispatchers.IO) {
val inputStream = contentResolver.openInputStream(data!!.data!!)
if (backupControl.restoreDatabaseViaIntent(inputStream!!)) {
windowControl.windowSync.setResyncRequired()
withContext(Dispatchers.Main) {
documentViewManager.clearBibleViewFactory()
currentWorkspaceId = 0
}
}
}
|
@mattschlosser can you either merge or rebase develop into your PR so that CI can pass? There was a CI issue that has been fixed. |
Users on all Android versions are now asked where they want to save the file when picking the phone storage option from the backup system When backing up modules, users now have an option to choose phone storage WHen a backup is completed, the location no longer shows Removed unnecessary WRITE_EXTERNAL_STORAGE permissions since it is no longer being used to directly write to external storage. Closes AndBible#756
a58c9ad
to
4fbc76e
Compare
I just tested the new version, it works fine for me. |
@@ -481,7 +481,8 @@ | |||
<string name="restore_confirmation">Overwrite My Notes, Bookmarks, Reading Plans and Workspaces?</string> | |||
<string name="restore_success">My Notes, Bookmarks, Reading Plans and Workspaces restored successfully</string> | |||
<string name="loading_backup">Loading database from backup…</string> | |||
<string name="backup_success">My Notes, Bookmarks, Reading Plans and Workspaces backed up successfully to %s.</string> | |||
<string name="backup_success">My Notes, Bookmarks, Reading Plans and Workspaces backed up successfully.</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of translations, we should not make such changes to strings that change parameters. Otherwise users with translations that have not been updated will have crashes.
When parameters need to be changed, like here, we need to introduce a new string (with new key, for example backup_success2), use it, and remove old string.
Looks okay. I will do the fix related to my own comment in develop branch. Let's continue testing there. |
Closes #756
Describe the pull request content
A clear and concise description of what the pull request is about.
What are the benefits of this new code addition?
Possible negative side effects?
Screenshots
If applicable, add screenshots to help explain your pull request.