-
Notifications
You must be signed in to change notification settings - Fork 578
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
feat: option to choose backup target directory #1354
Conversation
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.
Questions/ThingsToLookAt for the reviewer.
Thanks.
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { | ||
hideKeyboard() | ||
setPreferencesFromResource(R.xml.settings_updates, rootKey) | ||
//val settingsManager = PreferenceManager.getDefaultSharedPreferences(requireContext()) | ||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(requireContext()) |
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.
using this top level declaration instead of in each listener. any reason to use separate calls previously?
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.
There is not, good thinking!
I presume it was like that because using it.context
removed the need for requireContext()
which can crash even when it should not.
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.
Does it? if thats the case we could have a null check usage of it.context
.
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.
No, you misunderstand.
requireContext()
: can crash, but no wet code
it.context
: can't crash, but wet code
In this case requireContext()
should be relatively safe because it is in onCreatePreferences.
|
||
// No access rights after restore data from backup | ||
"download_path_key", | ||
"download_path_pref", |
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.
added download_path_pref
in ignoreForBackup list, check if that is something we left deliberately.
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.
also check this value in strings.xml
, why are we not keeping it translatable=false
?
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.
Looks like a big mistake, download_path_pref is used both as a display string and as a key, it should never be used as both.
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.
correct, I would fix it but would let one of the maintainers comment on this.
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.
Code looks good 👍
@@ -371,7 +351,7 @@ class SettingsGeneral : PreferenceFragmentCompat() { | |||
?: context?.let { ctx -> VideoDownloadManager.getDefaultDir(ctx)?.filePath() } | |||
|
|||
activity?.showBottomDialog( | |||
dirs + listOf("Custom"), | |||
dirs + listOf(getString(R.string.custom)), |
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.
Good!
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { | ||
hideKeyboard() | ||
setPreferencesFromResource(R.xml.settings_updates, rootKey) | ||
//val settingsManager = PreferenceManager.getDefaultSharedPreferences(requireContext()) | ||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(requireContext()) |
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.
There is not, good thinking!
I presume it was like that because using it.context
removed the need for requireContext()
which can crash even when it should not.
|
||
// No access rights after restore data from backup | ||
"download_path_key", | ||
"download_path_pref", |
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.
Looks like a big mistake, download_path_pref is used both as a display string and as a key, it should never be used as both.
fixed conflicts, clean for review again. |
Fixes: #1152 and #1106