diff --git a/native/utils/android-permissions.js b/native/utils/android-permissions.js --- a/native/utils/android-permissions.js +++ b/native/utils/android-permissions.js @@ -10,18 +10,19 @@ type PermissionsResult = { +[permission: string]: boolean }; +const emptyObj: PermissionsResult = {}; + async function getAndroidPermissions( permissions: Array, checkOrRequest: CheckOrRequest, throwExceptions?: ThrowExceptions, ): Promise { - const result = {}; - if (permissions.length === 0) { - return result; + return emptyObj; } if (checkOrRequest === 'check') { + const result: { [string]: Promise } = {}; for (const permission of permissions) { result[permission] = (async () => { try { @@ -47,6 +48,8 @@ throw e; } } + + const result: { [string]: boolean } = {}; for (const permission of permissions) { result[permission] = requestResult[permission] === PermissionsAndroid.RESULTS.GRANTED;