mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 03:52:15 +02:00
refactor: remove unused code
`allGranted` was unused
This commit is contained in:
parent
294af97c94
commit
4f8f2012a9
@ -21,7 +21,6 @@ package com.ichi2.anki.permissions
|
||||
* @param permissions A map, containing an entry for each required permission, associating to it whether it's already granted
|
||||
*/
|
||||
open class PermissionsCheckResult(val permissions: Map<String, Boolean>) {
|
||||
val allGranted = permissions.all { it.value }
|
||||
val requiresPermissionDialog: Boolean = permissions.any { !it.value }
|
||||
|
||||
/**
|
||||
|
@ -50,13 +50,6 @@ class PermissionsRequestResults(permissions: Map<String, PermissionRequestResult
|
||||
val hasTemporarilyDeniedPermissions = permissions.any { it.value == TEMPORARILY_DENIED }
|
||||
|
||||
companion object {
|
||||
fun allGranted(checkResult: PermissionsCheckResult): PermissionsRequestResults {
|
||||
if (!checkResult.allGranted) {
|
||||
throw IllegalStateException("allGranted called when permissions were not all granted")
|
||||
}
|
||||
return PermissionsRequestResults(checkResult.permissions.mapValues { GRANTED })
|
||||
}
|
||||
|
||||
fun from(activity: Activity, rawResults: PermissionsRequestRawResults): PermissionsRequestResults {
|
||||
val permissions = rawResults.mapValues { toPermissionRequestResult(activity, it.key, it.value) }
|
||||
return PermissionsRequestResults(permissions)
|
||||
|
Loading…
Reference in New Issue
Block a user