Skip to content

Commit

Permalink
try-catch sitePermissionRequest.grant call (#4490)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/488551667048375/1207191338636817/f

### Description
try-catch calls to site permissions grant to ensure `Either grant() or deny() has been already called.` exception doesn't crash the app

### Steps to test this PR
QA optional
  • Loading branch information
aitorvs authored May 1, 2024
1 parent db4b9d2 commit 8c2b23c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,12 @@ class SitePermissionsDialogActivityLauncher @Inject constructor(

private fun grantPermissions() {
val permissions = permissionsHandledAutomatically.toTypedArray() + permissionsHandledByUser
sitePermissionRequest.grant(permissions)
try {
sitePermissionRequest.grant(permissions)
} catch (e: IllegalStateException) {
// IllegalStateException is thrown when grant() or deny() have been called already.
Timber.w("IllegalStateException when calling grant() site permissions")
}
}

private fun systemPermissionGranted() {
Expand Down

0 comments on commit 8c2b23c

Please sign in to comment.