Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3553683
D10032.id33915.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10032.id33915.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D10032: [Flow202][native][skip-ci] [48/x] Get rid of granted array in android-permissions.js
Attached
Detach File
Event Timeline
Log In to Comment