Page MenuHomePhabricator

D10032.id33915.diff
No OneTemporary

D10032.id33915.diff

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
@@ -5,8 +5,6 @@
import { getMessageForException } from 'lib/utils/errors.js';
import { promiseAll } from 'lib/utils/promises.js';
-const granted = new Set();
-
type CheckOrRequest = 'check' | 'request';
type ThrowExceptions = 'throw' | typeof undefined;
@@ -17,22 +15,14 @@
checkOrRequest: CheckOrRequest,
throwExceptions?: ThrowExceptions,
): Promise<PermissionsResult> {
- const result = {},
- missing = [];
+ const result = {};
- for (const permission of permissions) {
- if (granted.has(permission)) {
- result[permission] = true;
- } else {
- missing.push(permission);
- }
- }
- if (missing.length === 0) {
+ if (permissions.length === 0) {
return result;
}
if (checkOrRequest === 'check') {
- for (const permission of missing) {
+ for (const permission of permissions) {
result[permission] = (async () => {
try {
return await PermissionsAndroid.check(permission);
@@ -50,14 +40,14 @@
let requestResult = {};
try {
- requestResult = await PermissionsAndroid.requestMultiple(missing);
+ requestResult = await PermissionsAndroid.requestMultiple(permissions);
} catch (e) {
printException(e, 'PermissionsAndroid.requestMultiple');
if (throwExceptions === 'throw') {
throw e;
}
}
- for (const permission of missing) {
+ for (const permission of permissions) {
result[permission] =
requestResult[permission] === PermissionsAndroid.RESULTS.GRANTED;
}

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 8:56 PM (6 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2713015
Default Alt Text
D10032.id33915.diff (1 KB)

Event Timeline