add location only logic

This commit is contained in:
andrekir 2021-12-15 09:04:44 -03:00
parent bb40672401
commit e21f3fdf93
3 changed files with 27 additions and 4 deletions

View file

@ -40,6 +40,18 @@ fun Context.getCameraPermissions(): List<String> {
/** @return true if the user already has camera permission */
fun Context.hasCameraPermission() = getCameraPermissions().isEmpty()
/**
* Camera permission (or empty if we already have what we need)
*/
fun Context.getLocationPermissions(): List<String> {
val perms = mutableListOf(Manifest.permission.ACCESS_FINE_LOCATION)
return getMissingPermissions(perms)
}
/** @return true if the user already has camera permission */
fun Context.hasLocationPermission() = getLocationPermissions().isEmpty()
/**
* A list of missing background location permissions (or empty if we already have what we need)
*/