Skip to content

Commit

Permalink
fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Oct 22, 2023
1 parent 4a394a2 commit c0b9e72
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,19 @@ object PermissionHelper {
* @param neededPermissions The permissions needed.
* @return The permissions not present in AndroidManifest.xml
*/
fun getUndefinedPermissions(context: Context, neededPermissions: Array<String>): Array<String?> {
val undefinedPermissions = ArrayList<String?>()
fun getUndefinedPermissions(context: Context, neededPermissions: Array<String>): Array<String> {
val undefinedPermissions = ArrayList<String>()
val requestedPermissions = getManifestPermissions(context)
if (requestedPermissions != null && requestedPermissions.isNotEmpty()) {
if (!requestedPermissions.isNullOrEmpty()) {
val requestedPermissionsList = listOf(*requestedPermissions)
val requestedPermissionsArrayList = ArrayList(requestedPermissionsList)
for (permission in neededPermissions) {
if (!requestedPermissionsArrayList.contains(permission)) {
undefinedPermissions.add(permission)
}
}
var undefinedPermissionArray = arrayOfNulls<String>(undefinedPermissions.size)
undefinedPermissionArray = undefinedPermissions.toArray(undefinedPermissionArray)
return undefinedPermissionArray
return undefinedPermissions.toTypedArray()
}
return neededPermissions as Array<String?>
return neededPermissions
}
}

0 comments on commit c0b9e72

Please sign in to comment.