mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-1045 Editor | Fix | Should dismiss request-permission snackbar when leaving editor screen in order to avoid illegal state (#3016)
This commit is contained in:
parent
1ca1f32ebe
commit
a32f0aa952
1 changed files with 14 additions and 10 deletions
|
@ -156,18 +156,22 @@ interface PickerDelegate : PickiTCallbacks {
|
|||
}
|
||||
|
||||
private fun takeReadStoragePermission() {
|
||||
if (fragment.requireActivity()
|
||||
.shouldShowRequestPermissionRationaleCompat(READ_EXTERNAL_STORAGE)
|
||||
) {
|
||||
fragment.binding.root.showSnackbar(
|
||||
R.string.permission_read_rationale,
|
||||
Snackbar.LENGTH_INDEFINITE,
|
||||
R.string.button_ok
|
||||
try {
|
||||
if (fragment.requireActivity()
|
||||
.shouldShowRequestPermissionRationaleCompat(READ_EXTERNAL_STORAGE)
|
||||
) {
|
||||
snackbar = fragment.binding.root.showSnackbar(
|
||||
R.string.permission_read_rationale,
|
||||
Snackbar.LENGTH_INDEFINITE,
|
||||
R.string.button_ok
|
||||
) {
|
||||
permissionReadStorage.launch(arrayOf(READ_EXTERNAL_STORAGE))
|
||||
}
|
||||
} else {
|
||||
permissionReadStorage.launch(arrayOf(READ_EXTERNAL_STORAGE))
|
||||
}
|
||||
} else {
|
||||
permissionReadStorage.launch(arrayOf(READ_EXTERNAL_STORAGE))
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Error while requesting permission")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,7 +185,7 @@ interface PickerDelegate : PickiTCallbacks {
|
|||
}
|
||||
fragment.startFilePicker(type, requestCode)
|
||||
} else {
|
||||
fragment.binding.root.showSnackbar(
|
||||
snackbar = fragment.binding.root.showSnackbar(
|
||||
R.string.permission_read_denied,
|
||||
Snackbar.LENGTH_SHORT
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue