Request WRITE_EXTERNAL_STORAGE for external password repository (#698)
* PasswordStore: request WRITE_EXTERNAL_STORAGE permission instead We wish to be able to write to our password store directory as well. Fixes #697 Fixes #365 Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Reword changelog entry Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
f21b6426af
commit
4f20c49abb
2 changed files with 6 additions and 5 deletions
|
@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Text input box theming
|
- Text input box theming
|
||||||
|
- Password repository held in non-hidden storage no longer fails
|
||||||
|
|
||||||
## [1.6.0] - 2020-03-20
|
## [1.6.0] - 2020-03-20
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ class PasswordStore : AppCompatActivity() {
|
||||||
var savedInstance = savedInstanceState
|
var savedInstance = savedInstanceState
|
||||||
if (savedInstanceState != null && (!settings.getBoolean("git_external", false) ||
|
if (savedInstanceState != null && (!settings.getBoolean("git_external", false) ||
|
||||||
ContextCompat.checkSelfPermission(
|
ContextCompat.checkSelfPermission(
|
||||||
activity, Manifest.permission.READ_EXTERNAL_STORAGE)
|
activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||||
!= PackageManager.PERMISSION_GRANTED)) {
|
!= PackageManager.PERMISSION_GRANTED)) {
|
||||||
savedInstance = null
|
savedInstance = null
|
||||||
}
|
}
|
||||||
|
@ -129,9 +129,9 @@ class PasswordStore : AppCompatActivity() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
// do not attempt to checkLocalRepository() if no storage permission: immediate crash
|
// do not attempt to checkLocalRepository() if no storage permission: immediate crash
|
||||||
if (settings.getBoolean("git_external", false)) {
|
if (settings.getBoolean("git_external", false)) {
|
||||||
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE)
|
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
if (ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
if (ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||||
val snack = Snackbar.make(
|
val snack = Snackbar.make(
|
||||||
findViewById(R.id.main_layout),
|
findViewById(R.id.main_layout),
|
||||||
getString(R.string.access_sdcard_text),
|
getString(R.string.access_sdcard_text),
|
||||||
|
@ -139,7 +139,7 @@ class PasswordStore : AppCompatActivity() {
|
||||||
.setAction(R.string.dialog_ok) {
|
.setAction(R.string.dialog_ok) {
|
||||||
ActivityCompat.requestPermissions(
|
ActivityCompat.requestPermissions(
|
||||||
activity,
|
activity,
|
||||||
arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE),
|
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
|
||||||
REQUEST_EXTERNAL_STORAGE)
|
REQUEST_EXTERNAL_STORAGE)
|
||||||
}
|
}
|
||||||
snack.show()
|
snack.show()
|
||||||
|
@ -151,7 +151,7 @@ class PasswordStore : AppCompatActivity() {
|
||||||
// No explanation needed, we can request the permission.
|
// No explanation needed, we can request the permission.
|
||||||
ActivityCompat.requestPermissions(
|
ActivityCompat.requestPermissions(
|
||||||
activity,
|
activity,
|
||||||
arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE),
|
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
|
||||||
REQUEST_EXTERNAL_STORAGE)
|
REQUEST_EXTERNAL_STORAGE)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue