@symbiote-native/engine 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +31 -1
- package/android/build.gradle +4 -1
- package/build/accessibility-info/index.android.js +21 -17
- package/build/accessibility-info/index.ios.js +2 -0
- package/build/accessibility-info/shared.d.ts +1 -1
- package/build/accessibility-props.d.ts +0 -11
- package/build/accessibility-props.js +30 -68
- package/build/alert/shared.d.ts +1 -1
- package/build/alert/shared.js +3 -7
- package/build/animated/graph.js +1 -1
- package/build/animated/leaf-lifecycle.js +2 -2
- package/build/app-state/index.d.ts +1 -1
- package/build/app-state/index.js +35 -27
- package/build/asset-source-resolver.d.ts +2 -0
- package/build/asset-source-resolver.js +13 -0
- package/build/back-handler/index.d.ts +7 -6
- package/build/back-handler/index.js +19 -16
- package/build/debug.js +8 -22
- package/build/dispatch.js +3 -9
- package/build/events/index.js +12 -3
- package/build/fabric-props.js +75 -180
- package/build/fabric.d.ts +2 -8
- package/build/fabric.js +27 -33
- package/build/host-access.d.ts +1 -128
- package/build/host-access.js +96 -205
- package/build/host-behavior.d.ts +1 -100
- package/build/host-behavior.js +125 -311
- package/build/image-loader.d.ts +4 -2
- package/build/image-loader.js +24 -48
- package/build/image-source-resolver.js +3 -7
- package/build/image-source-write.d.ts +1 -12
- package/build/image-source-write.js +28 -36
- package/build/imperative.d.ts +0 -28
- package/build/imperative.js +42 -92
- package/build/index.d.ts +3 -2
- package/build/index.js +30 -43
- package/build/invariant.d.ts +1 -0
- package/build/invariant.js +10 -0
- package/build/keyboard/index.js +11 -32
- package/build/linking/index.android.js +5 -3
- package/build/linking/shared.d.ts +1 -1
- package/build/linking/shared.js +16 -19
- package/build/mutation-buffer.d.ts +0 -177
- package/build/mutation-buffer.js +137 -308
- package/build/native-engine.d.ts +0 -102
- package/build/native-engine.js +38 -98
- package/build/native-events.d.ts +5 -0
- package/build/native-events.js +30 -18
- package/build/native-tree-host.d.ts +0 -21
- package/build/native-tree-host.js +14 -31
- package/build/node.d.ts +0 -212
- package/build/node.js +354 -774
- package/build/permissions-android/index.android.d.ts +59 -0
- package/build/permissions-android/index.android.js +47 -0
- package/build/permissions-android/index.d.ts +1 -115
- package/build/permissions-android/index.ios.d.ts +59 -0
- package/build/permissions-android/index.ios.js +31 -0
- package/build/permissions-android/index.js +3 -184
- package/build/permissions-android/shared.d.ts +63 -0
- package/build/permissions-android/shared.js +66 -0
- package/build/platform/index.android.js +3 -5
- package/build/platform/index.ios.js +3 -3
- package/build/platform/shared.d.ts +4 -0
- package/build/platform/shared.js +9 -0
- package/build/platform-color/index.android.d.ts +4 -0
- package/build/platform-color/index.android.js +7 -0
- package/build/platform-color/index.d.ts +2 -20
- package/build/platform-color/index.js +1 -45
- package/build/platform-color/shared.d.ts +21 -0
- package/build/platform-color/shared.js +41 -0
- package/build/post-commit.js +3 -8
- package/build/process-aspect-ratio.js +3 -7
- package/build/process-background-longhands.js +10 -19
- package/build/process-filter.js +11 -19
- package/build/process-font-variant.js +3 -7
- package/build/registry.d.ts +0 -33
- package/build/registry.js +22 -57
- package/build/report-error.js +4 -18
- package/build/settings/index.android.d.ts +6 -0
- package/build/settings/index.android.js +21 -0
- package/build/settings/index.d.ts +1 -8
- package/build/settings/index.ios.d.ts +8 -0
- package/build/settings/index.ios.js +122 -0
- package/build/settings/index.js +3 -122
- package/build/share/index.android.js +9 -32
- package/build/share/index.ios.js +14 -15
- package/build/share/shared.d.ts +4 -2
- package/build/share/shared.js +7 -10
- package/build/status-bar/index.android.js +1 -1
- package/build/status-bar/index.ios.js +4 -3
- package/build/structured-style.d.ts +0 -9
- package/build/structured-style.js +16 -31
- package/build/styles.js +3 -6
- package/build/surface.d.ts +0 -26
- package/build/surface.js +29 -76
- package/build/text-input-state.js +4 -8
- package/build/toast-android/index.android.d.ts +10 -0
- package/build/toast-android/index.android.js +108 -0
- package/build/toast-android/index.d.ts +1 -10
- package/build/toast-android/index.ios.d.ts +10 -0
- package/build/toast-android/index.ios.js +19 -0
- package/build/toast-android/index.js +3 -108
- package/build/touch-history.js +5 -11
- package/build/tree-host.d.ts +0 -270
- package/build/tree-host.js +63 -153
- package/build/view-config.js +17 -37
- package/cpp/SymbioteFabricProps.cpp +204 -120
- package/cpp/SymbioteFabricProps.h +5 -0
- package/cpp/SymbioteTree.cpp +20 -6
- package/package.json +2 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type IPermission, type IPermissionStatus, type IRationale } from './shared';
|
|
2
|
+
export { PERMISSIONS, RESULTS, type IPermission, type IPermissionStatus, type IRationale, } from './shared';
|
|
3
|
+
export declare const PermissionsAndroid: {
|
|
4
|
+
PERMISSIONS: Readonly<{
|
|
5
|
+
readonly READ_CALENDAR: "android.permission.READ_CALENDAR";
|
|
6
|
+
readonly WRITE_CALENDAR: "android.permission.WRITE_CALENDAR";
|
|
7
|
+
readonly CAMERA: "android.permission.CAMERA";
|
|
8
|
+
readonly READ_CONTACTS: "android.permission.READ_CONTACTS";
|
|
9
|
+
readonly WRITE_CONTACTS: "android.permission.WRITE_CONTACTS";
|
|
10
|
+
readonly GET_ACCOUNTS: "android.permission.GET_ACCOUNTS";
|
|
11
|
+
readonly ACCESS_FINE_LOCATION: "android.permission.ACCESS_FINE_LOCATION";
|
|
12
|
+
readonly ACCESS_COARSE_LOCATION: "android.permission.ACCESS_COARSE_LOCATION";
|
|
13
|
+
readonly ACCESS_BACKGROUND_LOCATION: "android.permission.ACCESS_BACKGROUND_LOCATION";
|
|
14
|
+
readonly RECORD_AUDIO: "android.permission.RECORD_AUDIO";
|
|
15
|
+
readonly READ_PHONE_STATE: "android.permission.READ_PHONE_STATE";
|
|
16
|
+
readonly CALL_PHONE: "android.permission.CALL_PHONE";
|
|
17
|
+
readonly READ_CALL_LOG: "android.permission.READ_CALL_LOG";
|
|
18
|
+
readonly WRITE_CALL_LOG: "android.permission.WRITE_CALL_LOG";
|
|
19
|
+
readonly ADD_VOICEMAIL: "com.android.voicemail.permission.ADD_VOICEMAIL";
|
|
20
|
+
readonly READ_VOICEMAIL: "com.android.voicemail.permission.READ_VOICEMAIL";
|
|
21
|
+
readonly WRITE_VOICEMAIL: "com.android.voicemail.permission.WRITE_VOICEMAIL";
|
|
22
|
+
readonly USE_SIP: "android.permission.USE_SIP";
|
|
23
|
+
readonly PROCESS_OUTGOING_CALLS: "android.permission.PROCESS_OUTGOING_CALLS";
|
|
24
|
+
readonly BODY_SENSORS: "android.permission.BODY_SENSORS";
|
|
25
|
+
readonly BODY_SENSORS_BACKGROUND: "android.permission.BODY_SENSORS_BACKGROUND";
|
|
26
|
+
readonly SEND_SMS: "android.permission.SEND_SMS";
|
|
27
|
+
readonly RECEIVE_SMS: "android.permission.RECEIVE_SMS";
|
|
28
|
+
readonly READ_SMS: "android.permission.READ_SMS";
|
|
29
|
+
readonly RECEIVE_WAP_PUSH: "android.permission.RECEIVE_WAP_PUSH";
|
|
30
|
+
readonly RECEIVE_MMS: "android.permission.RECEIVE_MMS";
|
|
31
|
+
readonly READ_EXTERNAL_STORAGE: "android.permission.READ_EXTERNAL_STORAGE";
|
|
32
|
+
readonly READ_MEDIA_IMAGES: "android.permission.READ_MEDIA_IMAGES";
|
|
33
|
+
readonly READ_MEDIA_VIDEO: "android.permission.READ_MEDIA_VIDEO";
|
|
34
|
+
readonly READ_MEDIA_AUDIO: "android.permission.READ_MEDIA_AUDIO";
|
|
35
|
+
readonly READ_MEDIA_VISUAL_USER_SELECTED: "android.permission.READ_MEDIA_VISUAL_USER_SELECTED";
|
|
36
|
+
readonly WRITE_EXTERNAL_STORAGE: "android.permission.WRITE_EXTERNAL_STORAGE";
|
|
37
|
+
readonly BLUETOOTH_CONNECT: "android.permission.BLUETOOTH_CONNECT";
|
|
38
|
+
readonly BLUETOOTH_SCAN: "android.permission.BLUETOOTH_SCAN";
|
|
39
|
+
readonly BLUETOOTH_ADVERTISE: "android.permission.BLUETOOTH_ADVERTISE";
|
|
40
|
+
readonly ACCESS_MEDIA_LOCATION: "android.permission.ACCESS_MEDIA_LOCATION";
|
|
41
|
+
readonly ACCEPT_HANDOVER: "android.permission.ACCEPT_HANDOVER";
|
|
42
|
+
readonly ACTIVITY_RECOGNITION: "android.permission.ACTIVITY_RECOGNITION";
|
|
43
|
+
readonly ANSWER_PHONE_CALLS: "android.permission.ANSWER_PHONE_CALLS";
|
|
44
|
+
readonly READ_PHONE_NUMBERS: "android.permission.READ_PHONE_NUMBERS";
|
|
45
|
+
readonly UWB_RANGING: "android.permission.UWB_RANGING";
|
|
46
|
+
readonly POST_NOTIFICATIONS: "android.permission.POST_NOTIFICATIONS";
|
|
47
|
+
readonly NEARBY_WIFI_DEVICES: "android.permission.NEARBY_WIFI_DEVICES";
|
|
48
|
+
}>;
|
|
49
|
+
RESULTS: Readonly<{
|
|
50
|
+
readonly GRANTED: "granted";
|
|
51
|
+
readonly DENIED: "denied";
|
|
52
|
+
readonly NEVER_ASK_AGAIN: "never_ask_again";
|
|
53
|
+
}>;
|
|
54
|
+
checkPermission(permission: IPermission): Promise<boolean>;
|
|
55
|
+
check(permission: IPermission): Promise<boolean>;
|
|
56
|
+
requestPermission(permission: IPermission, rationale?: IRationale): Promise<boolean>;
|
|
57
|
+
request(permission: IPermission, rationale?: IRationale): Promise<IPermissionStatus>;
|
|
58
|
+
requestMultiple(permissions: IPermission[]): Promise<Record<string, IPermissionStatus>>;
|
|
59
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// PermissionsAndroid, Android build: RN's PermissionsAndroid.js with `Platform.OS === 'android'`.
|
|
2
|
+
// Every call reaches the native module and returns what it returns; a missing module is RN's
|
|
3
|
+
// invariant. request() shows the rationale through DialogManagerAndroid first when native says to.
|
|
4
|
+
import { dlog } from '../debug.js';
|
|
5
|
+
import { invariant } from '../invariant.js';
|
|
6
|
+
import { getNativeModule } from '../native-modules/index.js';
|
|
7
|
+
import { CHECK_PERMISSION_DEPRECATED, PERMISSIONS, PERMISSIONS_ANDROID_MODULE, REQUEST_PERMISSION_DEPRECATED, RESULTS, } from './shared.js';
|
|
8
|
+
export { PERMISSIONS, RESULTS, } from './shared.js';
|
|
9
|
+
const NOT_INSTALLED = 'PermissionsAndroid is not installed correctly.';
|
|
10
|
+
function requireModule() {
|
|
11
|
+
const module = getNativeModule(PERMISSIONS_ANDROID_MODULE);
|
|
12
|
+
dlog(`PermissionsAndroid: module ${module ? 'resolved' : 'NOT resolved (null)'}`);
|
|
13
|
+
invariant(module !== null, NOT_INSTALLED);
|
|
14
|
+
return module;
|
|
15
|
+
}
|
|
16
|
+
export const PermissionsAndroid = {
|
|
17
|
+
PERMISSIONS,
|
|
18
|
+
RESULTS,
|
|
19
|
+
checkPermission(permission) {
|
|
20
|
+
console.warn(CHECK_PERMISSION_DEPRECATED);
|
|
21
|
+
return requireModule().checkPermission(permission);
|
|
22
|
+
},
|
|
23
|
+
check(permission) {
|
|
24
|
+
return requireModule().checkPermission(permission);
|
|
25
|
+
},
|
|
26
|
+
async requestPermission(permission, rationale) {
|
|
27
|
+
console.warn(REQUEST_PERMISSION_DEPRECATED);
|
|
28
|
+
const response = await PermissionsAndroid.request(permission, rationale);
|
|
29
|
+
return response === RESULTS.GRANTED;
|
|
30
|
+
},
|
|
31
|
+
async request(permission, rationale) {
|
|
32
|
+
const module = requireModule();
|
|
33
|
+
if (rationale) {
|
|
34
|
+
const shouldShowRationale = await module.shouldShowRequestPermissionRationale(permission);
|
|
35
|
+
const dialog = getNativeModule('DialogManagerAndroid');
|
|
36
|
+
if (shouldShowRationale && dialog !== null) {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
dialog.showAlert({ ...rationale }, () => reject(new Error('Error showing rationale')), () => resolve(module.requestPermission(permission)));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return module.requestPermission(permission);
|
|
43
|
+
},
|
|
44
|
+
requestMultiple(permissions) {
|
|
45
|
+
return requireModule().requestMultiplePermissions(permissions);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -1,115 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
readonly GRANTED: "granted";
|
|
3
|
-
readonly DENIED: "denied";
|
|
4
|
-
readonly NEVER_ASK_AGAIN: "never_ask_again";
|
|
5
|
-
}>;
|
|
6
|
-
export type IPermissionStatus = (typeof RESULTS)[keyof typeof RESULTS];
|
|
7
|
-
export declare const PERMISSIONS: Readonly<{
|
|
8
|
-
readonly READ_CALENDAR: "android.permission.READ_CALENDAR";
|
|
9
|
-
readonly WRITE_CALENDAR: "android.permission.WRITE_CALENDAR";
|
|
10
|
-
readonly CAMERA: "android.permission.CAMERA";
|
|
11
|
-
readonly READ_CONTACTS: "android.permission.READ_CONTACTS";
|
|
12
|
-
readonly WRITE_CONTACTS: "android.permission.WRITE_CONTACTS";
|
|
13
|
-
readonly GET_ACCOUNTS: "android.permission.GET_ACCOUNTS";
|
|
14
|
-
readonly ACCESS_FINE_LOCATION: "android.permission.ACCESS_FINE_LOCATION";
|
|
15
|
-
readonly ACCESS_COARSE_LOCATION: "android.permission.ACCESS_COARSE_LOCATION";
|
|
16
|
-
readonly ACCESS_BACKGROUND_LOCATION: "android.permission.ACCESS_BACKGROUND_LOCATION";
|
|
17
|
-
readonly RECORD_AUDIO: "android.permission.RECORD_AUDIO";
|
|
18
|
-
readonly READ_PHONE_STATE: "android.permission.READ_PHONE_STATE";
|
|
19
|
-
readonly CALL_PHONE: "android.permission.CALL_PHONE";
|
|
20
|
-
readonly READ_CALL_LOG: "android.permission.READ_CALL_LOG";
|
|
21
|
-
readonly WRITE_CALL_LOG: "android.permission.WRITE_CALL_LOG";
|
|
22
|
-
readonly ADD_VOICEMAIL: "com.android.voicemail.permission.ADD_VOICEMAIL";
|
|
23
|
-
readonly READ_VOICEMAIL: "com.android.voicemail.permission.READ_VOICEMAIL";
|
|
24
|
-
readonly WRITE_VOICEMAIL: "com.android.voicemail.permission.WRITE_VOICEMAIL";
|
|
25
|
-
readonly USE_SIP: "android.permission.USE_SIP";
|
|
26
|
-
readonly PROCESS_OUTGOING_CALLS: "android.permission.PROCESS_OUTGOING_CALLS";
|
|
27
|
-
readonly BODY_SENSORS: "android.permission.BODY_SENSORS";
|
|
28
|
-
readonly BODY_SENSORS_BACKGROUND: "android.permission.BODY_SENSORS_BACKGROUND";
|
|
29
|
-
readonly SEND_SMS: "android.permission.SEND_SMS";
|
|
30
|
-
readonly RECEIVE_SMS: "android.permission.RECEIVE_SMS";
|
|
31
|
-
readonly READ_SMS: "android.permission.READ_SMS";
|
|
32
|
-
readonly RECEIVE_WAP_PUSH: "android.permission.RECEIVE_WAP_PUSH";
|
|
33
|
-
readonly RECEIVE_MMS: "android.permission.RECEIVE_MMS";
|
|
34
|
-
readonly READ_EXTERNAL_STORAGE: "android.permission.READ_EXTERNAL_STORAGE";
|
|
35
|
-
readonly READ_MEDIA_IMAGES: "android.permission.READ_MEDIA_IMAGES";
|
|
36
|
-
readonly READ_MEDIA_VIDEO: "android.permission.READ_MEDIA_VIDEO";
|
|
37
|
-
readonly READ_MEDIA_AUDIO: "android.permission.READ_MEDIA_AUDIO";
|
|
38
|
-
readonly READ_MEDIA_VISUAL_USER_SELECTED: "android.permission.READ_MEDIA_VISUAL_USER_SELECTED";
|
|
39
|
-
readonly WRITE_EXTERNAL_STORAGE: "android.permission.WRITE_EXTERNAL_STORAGE";
|
|
40
|
-
readonly BLUETOOTH_CONNECT: "android.permission.BLUETOOTH_CONNECT";
|
|
41
|
-
readonly BLUETOOTH_SCAN: "android.permission.BLUETOOTH_SCAN";
|
|
42
|
-
readonly BLUETOOTH_ADVERTISE: "android.permission.BLUETOOTH_ADVERTISE";
|
|
43
|
-
readonly ACCESS_MEDIA_LOCATION: "android.permission.ACCESS_MEDIA_LOCATION";
|
|
44
|
-
readonly ACCEPT_HANDOVER: "android.permission.ACCEPT_HANDOVER";
|
|
45
|
-
readonly ACTIVITY_RECOGNITION: "android.permission.ACTIVITY_RECOGNITION";
|
|
46
|
-
readonly ANSWER_PHONE_CALLS: "android.permission.ANSWER_PHONE_CALLS";
|
|
47
|
-
readonly READ_PHONE_NUMBERS: "android.permission.READ_PHONE_NUMBERS";
|
|
48
|
-
readonly UWB_RANGING: "android.permission.UWB_RANGING";
|
|
49
|
-
readonly POST_NOTIFICATIONS: "android.permission.POST_NOTIFICATIONS";
|
|
50
|
-
readonly NEARBY_WIFI_DEVICES: "android.permission.NEARBY_WIFI_DEVICES";
|
|
51
|
-
}>;
|
|
52
|
-
export type IPermission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
|
|
53
|
-
export type IRationale = {
|
|
54
|
-
title: string;
|
|
55
|
-
message: string;
|
|
56
|
-
buttonPositive?: string;
|
|
57
|
-
buttonNegative?: string;
|
|
58
|
-
buttonNeutral?: string;
|
|
59
|
-
};
|
|
60
|
-
export declare const PermissionsAndroid: {
|
|
61
|
-
PERMISSIONS: Readonly<{
|
|
62
|
-
readonly READ_CALENDAR: "android.permission.READ_CALENDAR";
|
|
63
|
-
readonly WRITE_CALENDAR: "android.permission.WRITE_CALENDAR";
|
|
64
|
-
readonly CAMERA: "android.permission.CAMERA";
|
|
65
|
-
readonly READ_CONTACTS: "android.permission.READ_CONTACTS";
|
|
66
|
-
readonly WRITE_CONTACTS: "android.permission.WRITE_CONTACTS";
|
|
67
|
-
readonly GET_ACCOUNTS: "android.permission.GET_ACCOUNTS";
|
|
68
|
-
readonly ACCESS_FINE_LOCATION: "android.permission.ACCESS_FINE_LOCATION";
|
|
69
|
-
readonly ACCESS_COARSE_LOCATION: "android.permission.ACCESS_COARSE_LOCATION";
|
|
70
|
-
readonly ACCESS_BACKGROUND_LOCATION: "android.permission.ACCESS_BACKGROUND_LOCATION";
|
|
71
|
-
readonly RECORD_AUDIO: "android.permission.RECORD_AUDIO";
|
|
72
|
-
readonly READ_PHONE_STATE: "android.permission.READ_PHONE_STATE";
|
|
73
|
-
readonly CALL_PHONE: "android.permission.CALL_PHONE";
|
|
74
|
-
readonly READ_CALL_LOG: "android.permission.READ_CALL_LOG";
|
|
75
|
-
readonly WRITE_CALL_LOG: "android.permission.WRITE_CALL_LOG";
|
|
76
|
-
readonly ADD_VOICEMAIL: "com.android.voicemail.permission.ADD_VOICEMAIL";
|
|
77
|
-
readonly READ_VOICEMAIL: "com.android.voicemail.permission.READ_VOICEMAIL";
|
|
78
|
-
readonly WRITE_VOICEMAIL: "com.android.voicemail.permission.WRITE_VOICEMAIL";
|
|
79
|
-
readonly USE_SIP: "android.permission.USE_SIP";
|
|
80
|
-
readonly PROCESS_OUTGOING_CALLS: "android.permission.PROCESS_OUTGOING_CALLS";
|
|
81
|
-
readonly BODY_SENSORS: "android.permission.BODY_SENSORS";
|
|
82
|
-
readonly BODY_SENSORS_BACKGROUND: "android.permission.BODY_SENSORS_BACKGROUND";
|
|
83
|
-
readonly SEND_SMS: "android.permission.SEND_SMS";
|
|
84
|
-
readonly RECEIVE_SMS: "android.permission.RECEIVE_SMS";
|
|
85
|
-
readonly READ_SMS: "android.permission.READ_SMS";
|
|
86
|
-
readonly RECEIVE_WAP_PUSH: "android.permission.RECEIVE_WAP_PUSH";
|
|
87
|
-
readonly RECEIVE_MMS: "android.permission.RECEIVE_MMS";
|
|
88
|
-
readonly READ_EXTERNAL_STORAGE: "android.permission.READ_EXTERNAL_STORAGE";
|
|
89
|
-
readonly READ_MEDIA_IMAGES: "android.permission.READ_MEDIA_IMAGES";
|
|
90
|
-
readonly READ_MEDIA_VIDEO: "android.permission.READ_MEDIA_VIDEO";
|
|
91
|
-
readonly READ_MEDIA_AUDIO: "android.permission.READ_MEDIA_AUDIO";
|
|
92
|
-
readonly READ_MEDIA_VISUAL_USER_SELECTED: "android.permission.READ_MEDIA_VISUAL_USER_SELECTED";
|
|
93
|
-
readonly WRITE_EXTERNAL_STORAGE: "android.permission.WRITE_EXTERNAL_STORAGE";
|
|
94
|
-
readonly BLUETOOTH_CONNECT: "android.permission.BLUETOOTH_CONNECT";
|
|
95
|
-
readonly BLUETOOTH_SCAN: "android.permission.BLUETOOTH_SCAN";
|
|
96
|
-
readonly BLUETOOTH_ADVERTISE: "android.permission.BLUETOOTH_ADVERTISE";
|
|
97
|
-
readonly ACCESS_MEDIA_LOCATION: "android.permission.ACCESS_MEDIA_LOCATION";
|
|
98
|
-
readonly ACCEPT_HANDOVER: "android.permission.ACCEPT_HANDOVER";
|
|
99
|
-
readonly ACTIVITY_RECOGNITION: "android.permission.ACTIVITY_RECOGNITION";
|
|
100
|
-
readonly ANSWER_PHONE_CALLS: "android.permission.ANSWER_PHONE_CALLS";
|
|
101
|
-
readonly READ_PHONE_NUMBERS: "android.permission.READ_PHONE_NUMBERS";
|
|
102
|
-
readonly UWB_RANGING: "android.permission.UWB_RANGING";
|
|
103
|
-
readonly POST_NOTIFICATIONS: "android.permission.POST_NOTIFICATIONS";
|
|
104
|
-
readonly NEARBY_WIFI_DEVICES: "android.permission.NEARBY_WIFI_DEVICES";
|
|
105
|
-
}>;
|
|
106
|
-
RESULTS: Readonly<{
|
|
107
|
-
readonly GRANTED: "granted";
|
|
108
|
-
readonly DENIED: "denied";
|
|
109
|
-
readonly NEVER_ASK_AGAIN: "never_ask_again";
|
|
110
|
-
}>;
|
|
111
|
-
check(permission: IPermission): Promise<boolean>;
|
|
112
|
-
request(permission: IPermission, rationale?: IRationale): Promise<IPermissionStatus>;
|
|
113
|
-
requestMultiple(permissions: IPermission[]): Promise<Record<string, IPermissionStatus>>;
|
|
114
|
-
shouldShowRequestPermissionRationale(permission: IPermission): Promise<boolean>;
|
|
115
|
-
};
|
|
1
|
+
export * from './index.ios';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type IPermission, type IPermissionStatus, type IRationale } from './shared';
|
|
2
|
+
export { PERMISSIONS, RESULTS, type IPermission, type IPermissionStatus, type IRationale, } from './shared';
|
|
3
|
+
export declare const PermissionsAndroid: {
|
|
4
|
+
PERMISSIONS: Readonly<{
|
|
5
|
+
readonly READ_CALENDAR: "android.permission.READ_CALENDAR";
|
|
6
|
+
readonly WRITE_CALENDAR: "android.permission.WRITE_CALENDAR";
|
|
7
|
+
readonly CAMERA: "android.permission.CAMERA";
|
|
8
|
+
readonly READ_CONTACTS: "android.permission.READ_CONTACTS";
|
|
9
|
+
readonly WRITE_CONTACTS: "android.permission.WRITE_CONTACTS";
|
|
10
|
+
readonly GET_ACCOUNTS: "android.permission.GET_ACCOUNTS";
|
|
11
|
+
readonly ACCESS_FINE_LOCATION: "android.permission.ACCESS_FINE_LOCATION";
|
|
12
|
+
readonly ACCESS_COARSE_LOCATION: "android.permission.ACCESS_COARSE_LOCATION";
|
|
13
|
+
readonly ACCESS_BACKGROUND_LOCATION: "android.permission.ACCESS_BACKGROUND_LOCATION";
|
|
14
|
+
readonly RECORD_AUDIO: "android.permission.RECORD_AUDIO";
|
|
15
|
+
readonly READ_PHONE_STATE: "android.permission.READ_PHONE_STATE";
|
|
16
|
+
readonly CALL_PHONE: "android.permission.CALL_PHONE";
|
|
17
|
+
readonly READ_CALL_LOG: "android.permission.READ_CALL_LOG";
|
|
18
|
+
readonly WRITE_CALL_LOG: "android.permission.WRITE_CALL_LOG";
|
|
19
|
+
readonly ADD_VOICEMAIL: "com.android.voicemail.permission.ADD_VOICEMAIL";
|
|
20
|
+
readonly READ_VOICEMAIL: "com.android.voicemail.permission.READ_VOICEMAIL";
|
|
21
|
+
readonly WRITE_VOICEMAIL: "com.android.voicemail.permission.WRITE_VOICEMAIL";
|
|
22
|
+
readonly USE_SIP: "android.permission.USE_SIP";
|
|
23
|
+
readonly PROCESS_OUTGOING_CALLS: "android.permission.PROCESS_OUTGOING_CALLS";
|
|
24
|
+
readonly BODY_SENSORS: "android.permission.BODY_SENSORS";
|
|
25
|
+
readonly BODY_SENSORS_BACKGROUND: "android.permission.BODY_SENSORS_BACKGROUND";
|
|
26
|
+
readonly SEND_SMS: "android.permission.SEND_SMS";
|
|
27
|
+
readonly RECEIVE_SMS: "android.permission.RECEIVE_SMS";
|
|
28
|
+
readonly READ_SMS: "android.permission.READ_SMS";
|
|
29
|
+
readonly RECEIVE_WAP_PUSH: "android.permission.RECEIVE_WAP_PUSH";
|
|
30
|
+
readonly RECEIVE_MMS: "android.permission.RECEIVE_MMS";
|
|
31
|
+
readonly READ_EXTERNAL_STORAGE: "android.permission.READ_EXTERNAL_STORAGE";
|
|
32
|
+
readonly READ_MEDIA_IMAGES: "android.permission.READ_MEDIA_IMAGES";
|
|
33
|
+
readonly READ_MEDIA_VIDEO: "android.permission.READ_MEDIA_VIDEO";
|
|
34
|
+
readonly READ_MEDIA_AUDIO: "android.permission.READ_MEDIA_AUDIO";
|
|
35
|
+
readonly READ_MEDIA_VISUAL_USER_SELECTED: "android.permission.READ_MEDIA_VISUAL_USER_SELECTED";
|
|
36
|
+
readonly WRITE_EXTERNAL_STORAGE: "android.permission.WRITE_EXTERNAL_STORAGE";
|
|
37
|
+
readonly BLUETOOTH_CONNECT: "android.permission.BLUETOOTH_CONNECT";
|
|
38
|
+
readonly BLUETOOTH_SCAN: "android.permission.BLUETOOTH_SCAN";
|
|
39
|
+
readonly BLUETOOTH_ADVERTISE: "android.permission.BLUETOOTH_ADVERTISE";
|
|
40
|
+
readonly ACCESS_MEDIA_LOCATION: "android.permission.ACCESS_MEDIA_LOCATION";
|
|
41
|
+
readonly ACCEPT_HANDOVER: "android.permission.ACCEPT_HANDOVER";
|
|
42
|
+
readonly ACTIVITY_RECOGNITION: "android.permission.ACTIVITY_RECOGNITION";
|
|
43
|
+
readonly ANSWER_PHONE_CALLS: "android.permission.ANSWER_PHONE_CALLS";
|
|
44
|
+
readonly READ_PHONE_NUMBERS: "android.permission.READ_PHONE_NUMBERS";
|
|
45
|
+
readonly UWB_RANGING: "android.permission.UWB_RANGING";
|
|
46
|
+
readonly POST_NOTIFICATIONS: "android.permission.POST_NOTIFICATIONS";
|
|
47
|
+
readonly NEARBY_WIFI_DEVICES: "android.permission.NEARBY_WIFI_DEVICES";
|
|
48
|
+
}>;
|
|
49
|
+
RESULTS: Readonly<{
|
|
50
|
+
readonly GRANTED: "granted";
|
|
51
|
+
readonly DENIED: "denied";
|
|
52
|
+
readonly NEVER_ASK_AGAIN: "never_ask_again";
|
|
53
|
+
}>;
|
|
54
|
+
checkPermission(_permission: IPermission): Promise<boolean>;
|
|
55
|
+
check(_permission: IPermission): Promise<boolean>;
|
|
56
|
+
requestPermission(_permission: IPermission, _rationale?: IRationale): Promise<boolean>;
|
|
57
|
+
request(_permission: IPermission, _rationale?: IRationale): Promise<IPermissionStatus>;
|
|
58
|
+
requestMultiple(_permissions: IPermission[]): Promise<Record<string, IPermissionStatus>>;
|
|
59
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// PermissionsAndroid off Android: RN's PermissionsAndroid.js `Platform.OS !== 'android'` branches.
|
|
2
|
+
// Each call warns that the module is Android-only (RN's own user-facing warning) and resolves a
|
|
3
|
+
// fixed answer; nothing reaches native.
|
|
4
|
+
import { ANDROID_ONLY_WARNING, CHECK_PERMISSION_DEPRECATED, PERMISSIONS, REQUEST_PERMISSION_DEPRECATED, RESULTS, } from './shared.js';
|
|
5
|
+
export { PERMISSIONS, RESULTS, } from './shared.js';
|
|
6
|
+
export const PermissionsAndroid = {
|
|
7
|
+
PERMISSIONS,
|
|
8
|
+
RESULTS,
|
|
9
|
+
checkPermission(_permission) {
|
|
10
|
+
console.warn(CHECK_PERMISSION_DEPRECATED);
|
|
11
|
+
console.warn(ANDROID_ONLY_WARNING);
|
|
12
|
+
return Promise.resolve(false);
|
|
13
|
+
},
|
|
14
|
+
check(_permission) {
|
|
15
|
+
console.warn(ANDROID_ONLY_WARNING);
|
|
16
|
+
return Promise.resolve(false);
|
|
17
|
+
},
|
|
18
|
+
requestPermission(_permission, _rationale) {
|
|
19
|
+
console.warn(REQUEST_PERMISSION_DEPRECATED);
|
|
20
|
+
console.warn(ANDROID_ONLY_WARNING);
|
|
21
|
+
return Promise.resolve(false);
|
|
22
|
+
},
|
|
23
|
+
request(_permission, _rationale) {
|
|
24
|
+
console.warn(ANDROID_ONLY_WARNING);
|
|
25
|
+
return Promise.resolve(RESULTS.DENIED);
|
|
26
|
+
},
|
|
27
|
+
requestMultiple(_permissions) {
|
|
28
|
+
console.warn(ANDROID_ONLY_WARNING);
|
|
29
|
+
return Promise.resolve({});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -1,184 +1,3 @@
|
|
|
1
|
-
// PermissionsAndroid
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
// shouldShowRequestPermissionRationale, plus the frozen PERMISSIONS and RESULTS
|
|
5
|
-
// constant maps. Imperative JS->native calls with no Fabric view of their own,
|
|
6
|
-
// like Vibration / Keyboard.
|
|
7
|
-
//
|
|
8
|
-
// symbiote is iOS-first and this module is Android-only, so it MUST degrade
|
|
9
|
-
// gracefully when the native module is absent (on iOS, or headless). RN throws
|
|
10
|
-
// "works only for Android"; we instead resolve a safe default + dlog so a
|
|
11
|
-
// cross-platform smoke never hard-crashes the process. Never reject/throw
|
|
12
|
-
// synchronously on a missing module.
|
|
13
|
-
//
|
|
14
|
-
// The native contract is confirmed from RN's TurboModule spec at
|
|
15
|
-
// specs_DEPRECATED/modules/INativePermissionsAndroid.js (`'PermissionsAndroid'`):
|
|
16
|
-
// checkPermission(permission): Promise<boolean>
|
|
17
|
-
// requestPermission(permission): Promise<string>
|
|
18
|
-
// shouldShowRequestPermissionRationale(permission): Promise<boolean>
|
|
19
|
-
// requestMultiplePermissions(permissions): Promise<{[permission]: string}>
|
|
20
|
-
import { getNativeModule } from '../native-modules/index.js';
|
|
21
|
-
import { dlog } from '../debug.js';
|
|
22
|
-
import { isBoolean } from '../type-guards.js';
|
|
23
|
-
// The native module name RN registers this TurboModule under
|
|
24
|
-
// (`TurboModuleRegistry.get<Spec>('PermissionsAndroid')`). NOTE: a module name is
|
|
25
|
-
// only provable on a real host (a headless fake answers to any name); this name
|
|
26
|
-
// is device-verify-pending.
|
|
27
|
-
const PERMISSIONS_ANDROID_MODULE = 'PermissionsAndroid';
|
|
28
|
-
// The runtime-permission result strings Android can return. Modeled as a frozen
|
|
29
|
-
// `as const` map: the generated-style constant-map exception to "no magic
|
|
30
|
-
// strings".
|
|
31
|
-
export const RESULTS = Object.freeze({
|
|
32
|
-
GRANTED: 'granted',
|
|
33
|
-
DENIED: 'denied',
|
|
34
|
-
NEVER_ASK_AGAIN: 'never_ask_again',
|
|
35
|
-
});
|
|
36
|
-
// The full Android permission-string map, copied verbatim from RN's source.
|
|
37
|
-
// Frozen `as const` constant map (the same string-map exception as RESULTS).
|
|
38
|
-
export const PERMISSIONS = Object.freeze({
|
|
39
|
-
READ_CALENDAR: 'android.permission.READ_CALENDAR',
|
|
40
|
-
WRITE_CALENDAR: 'android.permission.WRITE_CALENDAR',
|
|
41
|
-
CAMERA: 'android.permission.CAMERA',
|
|
42
|
-
READ_CONTACTS: 'android.permission.READ_CONTACTS',
|
|
43
|
-
WRITE_CONTACTS: 'android.permission.WRITE_CONTACTS',
|
|
44
|
-
GET_ACCOUNTS: 'android.permission.GET_ACCOUNTS',
|
|
45
|
-
ACCESS_FINE_LOCATION: 'android.permission.ACCESS_FINE_LOCATION',
|
|
46
|
-
ACCESS_COARSE_LOCATION: 'android.permission.ACCESS_COARSE_LOCATION',
|
|
47
|
-
ACCESS_BACKGROUND_LOCATION: 'android.permission.ACCESS_BACKGROUND_LOCATION',
|
|
48
|
-
RECORD_AUDIO: 'android.permission.RECORD_AUDIO',
|
|
49
|
-
READ_PHONE_STATE: 'android.permission.READ_PHONE_STATE',
|
|
50
|
-
CALL_PHONE: 'android.permission.CALL_PHONE',
|
|
51
|
-
READ_CALL_LOG: 'android.permission.READ_CALL_LOG',
|
|
52
|
-
WRITE_CALL_LOG: 'android.permission.WRITE_CALL_LOG',
|
|
53
|
-
ADD_VOICEMAIL: 'com.android.voicemail.permission.ADD_VOICEMAIL',
|
|
54
|
-
READ_VOICEMAIL: 'com.android.voicemail.permission.READ_VOICEMAIL',
|
|
55
|
-
WRITE_VOICEMAIL: 'com.android.voicemail.permission.WRITE_VOICEMAIL',
|
|
56
|
-
USE_SIP: 'android.permission.USE_SIP',
|
|
57
|
-
PROCESS_OUTGOING_CALLS: 'android.permission.PROCESS_OUTGOING_CALLS',
|
|
58
|
-
BODY_SENSORS: 'android.permission.BODY_SENSORS',
|
|
59
|
-
BODY_SENSORS_BACKGROUND: 'android.permission.BODY_SENSORS_BACKGROUND',
|
|
60
|
-
SEND_SMS: 'android.permission.SEND_SMS',
|
|
61
|
-
RECEIVE_SMS: 'android.permission.RECEIVE_SMS',
|
|
62
|
-
READ_SMS: 'android.permission.READ_SMS',
|
|
63
|
-
RECEIVE_WAP_PUSH: 'android.permission.RECEIVE_WAP_PUSH',
|
|
64
|
-
RECEIVE_MMS: 'android.permission.RECEIVE_MMS',
|
|
65
|
-
READ_EXTERNAL_STORAGE: 'android.permission.READ_EXTERNAL_STORAGE',
|
|
66
|
-
READ_MEDIA_IMAGES: 'android.permission.READ_MEDIA_IMAGES',
|
|
67
|
-
READ_MEDIA_VIDEO: 'android.permission.READ_MEDIA_VIDEO',
|
|
68
|
-
READ_MEDIA_AUDIO: 'android.permission.READ_MEDIA_AUDIO',
|
|
69
|
-
READ_MEDIA_VISUAL_USER_SELECTED: 'android.permission.READ_MEDIA_VISUAL_USER_SELECTED',
|
|
70
|
-
WRITE_EXTERNAL_STORAGE: 'android.permission.WRITE_EXTERNAL_STORAGE',
|
|
71
|
-
BLUETOOTH_CONNECT: 'android.permission.BLUETOOTH_CONNECT',
|
|
72
|
-
BLUETOOTH_SCAN: 'android.permission.BLUETOOTH_SCAN',
|
|
73
|
-
BLUETOOTH_ADVERTISE: 'android.permission.BLUETOOTH_ADVERTISE',
|
|
74
|
-
ACCESS_MEDIA_LOCATION: 'android.permission.ACCESS_MEDIA_LOCATION',
|
|
75
|
-
ACCEPT_HANDOVER: 'android.permission.ACCEPT_HANDOVER',
|
|
76
|
-
ACTIVITY_RECOGNITION: 'android.permission.ACTIVITY_RECOGNITION',
|
|
77
|
-
ANSWER_PHONE_CALLS: 'android.permission.ANSWER_PHONE_CALLS',
|
|
78
|
-
READ_PHONE_NUMBERS: 'android.permission.READ_PHONE_NUMBERS',
|
|
79
|
-
UWB_RANGING: 'android.permission.UWB_RANGING',
|
|
80
|
-
POST_NOTIFICATIONS: 'android.permission.POST_NOTIFICATIONS',
|
|
81
|
-
NEARBY_WIFI_DEVICES: 'android.permission.NEARBY_WIFI_DEVICES',
|
|
82
|
-
});
|
|
83
|
-
// Narrow the native string result into a known RESULTS value. Any unrecognized
|
|
84
|
-
// string is passed through as a IPermissionStatus only when it matches; otherwise
|
|
85
|
-
// we fall back to DENIED: a runtime guard at the trust boundary, not an `as`.
|
|
86
|
-
function toPermissionStatus(value) {
|
|
87
|
-
if (value === RESULTS.GRANTED ||
|
|
88
|
-
value === RESULTS.DENIED ||
|
|
89
|
-
value === RESULTS.NEVER_ASK_AGAIN) {
|
|
90
|
-
return value;
|
|
91
|
-
}
|
|
92
|
-
return RESULTS.DENIED;
|
|
93
|
-
}
|
|
94
|
-
// Narrow the native requestMultiplePermissions() return into a per-permission
|
|
95
|
-
// status map. Each value is run through toPermissionStatus; non-object returns
|
|
96
|
-
// yield an empty map.
|
|
97
|
-
function toStatusMap(value) {
|
|
98
|
-
const result = {};
|
|
99
|
-
if (typeof value !== 'object' || value === null)
|
|
100
|
-
return result;
|
|
101
|
-
for (const key of Object.keys(value)) {
|
|
102
|
-
result[key] = toPermissionStatus(Reflect.get(value, key));
|
|
103
|
-
}
|
|
104
|
-
return result;
|
|
105
|
-
}
|
|
106
|
-
// Resolved FRESH on every call, deliberately NOT memoized at module load. The original
|
|
107
|
-
// self-contained module resolved once at import, but moving it into the engine made it a
|
|
108
|
-
// shared singleton; a cached null would survive a module being linked later (or the headless
|
|
109
|
-
// smoke flipping a fake module on after its first import). getNativeModule is a cheap proxy
|
|
110
|
-
// lookup, so per-call resolution costs nothing and stays correct. Returns null on iOS / headless.
|
|
111
|
-
function getModule() {
|
|
112
|
-
const module = getNativeModule(PERMISSIONS_ANDROID_MODULE);
|
|
113
|
-
dlog(`PermissionsAndroid: module ${module ? 'resolved' : 'NOT resolved (null)'}`);
|
|
114
|
-
return module;
|
|
115
|
-
}
|
|
116
|
-
export const PermissionsAndroid = {
|
|
117
|
-
PERMISSIONS,
|
|
118
|
-
RESULTS,
|
|
119
|
-
// Resolve whether a permission has already been granted. Without a native
|
|
120
|
-
// module (iOS / headless) resolve false. Never throw.
|
|
121
|
-
async check(permission) {
|
|
122
|
-
const permissionsModule = getModule();
|
|
123
|
-
if (permissionsModule === null) {
|
|
124
|
-
dlog('PermissionsAndroid.check -> module unavailable, resolving false');
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
dlog(`PermissionsAndroid.check -> ${permission}`);
|
|
128
|
-
const granted = await permissionsModule.checkPermission(permission);
|
|
129
|
-
return isBoolean(granted) ? granted : false;
|
|
130
|
-
},
|
|
131
|
-
// Prompt the user for a permission, resolving a RESULTS status. If a rationale
|
|
132
|
-
// is supplied and DialogManagerAndroid is present, show it first; otherwise
|
|
133
|
-
// proceed straight to the native request (dlog the skip). Without the
|
|
134
|
-
// PermissionsAndroid module resolve RESULTS.DENIED. Never throw.
|
|
135
|
-
async request(permission, rationale) {
|
|
136
|
-
const permissionsModule = getModule();
|
|
137
|
-
if (permissionsModule === null) {
|
|
138
|
-
dlog('PermissionsAndroid.request -> module unavailable, resolving DENIED');
|
|
139
|
-
return RESULTS.DENIED;
|
|
140
|
-
}
|
|
141
|
-
dlog(`PermissionsAndroid.request -> ${permission}`);
|
|
142
|
-
if (rationale !== undefined) {
|
|
143
|
-
const shouldShow = await permissionsModule.shouldShowRequestPermissionRationale(permission);
|
|
144
|
-
const dialogModule = getNativeModule('DialogManagerAndroid');
|
|
145
|
-
if (isBoolean(shouldShow) && shouldShow && dialogModule !== null) {
|
|
146
|
-
return new Promise((resolve, reject) => {
|
|
147
|
-
dialogModule.showAlert(rationale, () => reject(new Error('Error showing rationale')), () => {
|
|
148
|
-
permissionsModule
|
|
149
|
-
.requestPermission(permission)
|
|
150
|
-
.then(status => resolve(toPermissionStatus(status)))
|
|
151
|
-
.catch(reject);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
dlog('PermissionsAndroid.request -> rationale skipped (DialogManagerAndroid unavailable)');
|
|
156
|
-
}
|
|
157
|
-
const status = await permissionsModule.requestPermission(permission);
|
|
158
|
-
return toPermissionStatus(status);
|
|
159
|
-
},
|
|
160
|
-
// Prompt for several permissions at once, resolving a per-permission status
|
|
161
|
-
// map. Without a native module resolve an empty map. Never throw.
|
|
162
|
-
async requestMultiple(permissions) {
|
|
163
|
-
const permissionsModule = getModule();
|
|
164
|
-
if (permissionsModule === null) {
|
|
165
|
-
dlog('PermissionsAndroid.requestMultiple -> module unavailable, resolving {}');
|
|
166
|
-
return {};
|
|
167
|
-
}
|
|
168
|
-
dlog(`PermissionsAndroid.requestMultiple -> ${permissions.join(', ')}`);
|
|
169
|
-
const statuses = await permissionsModule.requestMultiplePermissions(permissions);
|
|
170
|
-
return toStatusMap(statuses);
|
|
171
|
-
},
|
|
172
|
-
// Whether the OS recommends showing a rationale before re-requesting. Without
|
|
173
|
-
// a native module resolve false. Never throw.
|
|
174
|
-
async shouldShowRequestPermissionRationale(permission) {
|
|
175
|
-
const permissionsModule = getModule();
|
|
176
|
-
if (permissionsModule === null) {
|
|
177
|
-
dlog('PermissionsAndroid.shouldShowRequestPermissionRationale -> module unavailable, resolving false');
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
dlog(`PermissionsAndroid.shouldShowRequestPermissionRationale -> ${permission}`);
|
|
181
|
-
const shouldShow = await permissionsModule.shouldShowRequestPermissionRationale(permission);
|
|
182
|
-
return isBoolean(shouldShow) ? shouldShow : false;
|
|
183
|
-
},
|
|
184
|
-
};
|
|
1
|
+
// PermissionsAndroid: base / headless build. Metro picks index.android.ts / index.ios.ts on a
|
|
2
|
+
// device; off those, RN's non-Android branch is the default.
|
|
3
|
+
export * from './index.ios.js';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const PERMISSIONS_ANDROID_MODULE = "PermissionsAndroid";
|
|
2
|
+
export declare const ANDROID_ONLY_WARNING = "\"PermissionsAndroid\" module works only for Android platform.";
|
|
3
|
+
export declare const CHECK_PERMISSION_DEPRECATED = "\"PermissionsAndroid.checkPermission\" is deprecated. Use \"PermissionsAndroid.check\" instead";
|
|
4
|
+
export declare const REQUEST_PERMISSION_DEPRECATED = "\"PermissionsAndroid.requestPermission\" is deprecated. Use \"PermissionsAndroid.request\" instead";
|
|
5
|
+
export declare const RESULTS: Readonly<{
|
|
6
|
+
readonly GRANTED: "granted";
|
|
7
|
+
readonly DENIED: "denied";
|
|
8
|
+
readonly NEVER_ASK_AGAIN: "never_ask_again";
|
|
9
|
+
}>;
|
|
10
|
+
export type IPermissionStatus = (typeof RESULTS)[keyof typeof RESULTS];
|
|
11
|
+
export declare const PERMISSIONS: Readonly<{
|
|
12
|
+
readonly READ_CALENDAR: "android.permission.READ_CALENDAR";
|
|
13
|
+
readonly WRITE_CALENDAR: "android.permission.WRITE_CALENDAR";
|
|
14
|
+
readonly CAMERA: "android.permission.CAMERA";
|
|
15
|
+
readonly READ_CONTACTS: "android.permission.READ_CONTACTS";
|
|
16
|
+
readonly WRITE_CONTACTS: "android.permission.WRITE_CONTACTS";
|
|
17
|
+
readonly GET_ACCOUNTS: "android.permission.GET_ACCOUNTS";
|
|
18
|
+
readonly ACCESS_FINE_LOCATION: "android.permission.ACCESS_FINE_LOCATION";
|
|
19
|
+
readonly ACCESS_COARSE_LOCATION: "android.permission.ACCESS_COARSE_LOCATION";
|
|
20
|
+
readonly ACCESS_BACKGROUND_LOCATION: "android.permission.ACCESS_BACKGROUND_LOCATION";
|
|
21
|
+
readonly RECORD_AUDIO: "android.permission.RECORD_AUDIO";
|
|
22
|
+
readonly READ_PHONE_STATE: "android.permission.READ_PHONE_STATE";
|
|
23
|
+
readonly CALL_PHONE: "android.permission.CALL_PHONE";
|
|
24
|
+
readonly READ_CALL_LOG: "android.permission.READ_CALL_LOG";
|
|
25
|
+
readonly WRITE_CALL_LOG: "android.permission.WRITE_CALL_LOG";
|
|
26
|
+
readonly ADD_VOICEMAIL: "com.android.voicemail.permission.ADD_VOICEMAIL";
|
|
27
|
+
readonly READ_VOICEMAIL: "com.android.voicemail.permission.READ_VOICEMAIL";
|
|
28
|
+
readonly WRITE_VOICEMAIL: "com.android.voicemail.permission.WRITE_VOICEMAIL";
|
|
29
|
+
readonly USE_SIP: "android.permission.USE_SIP";
|
|
30
|
+
readonly PROCESS_OUTGOING_CALLS: "android.permission.PROCESS_OUTGOING_CALLS";
|
|
31
|
+
readonly BODY_SENSORS: "android.permission.BODY_SENSORS";
|
|
32
|
+
readonly BODY_SENSORS_BACKGROUND: "android.permission.BODY_SENSORS_BACKGROUND";
|
|
33
|
+
readonly SEND_SMS: "android.permission.SEND_SMS";
|
|
34
|
+
readonly RECEIVE_SMS: "android.permission.RECEIVE_SMS";
|
|
35
|
+
readonly READ_SMS: "android.permission.READ_SMS";
|
|
36
|
+
readonly RECEIVE_WAP_PUSH: "android.permission.RECEIVE_WAP_PUSH";
|
|
37
|
+
readonly RECEIVE_MMS: "android.permission.RECEIVE_MMS";
|
|
38
|
+
readonly READ_EXTERNAL_STORAGE: "android.permission.READ_EXTERNAL_STORAGE";
|
|
39
|
+
readonly READ_MEDIA_IMAGES: "android.permission.READ_MEDIA_IMAGES";
|
|
40
|
+
readonly READ_MEDIA_VIDEO: "android.permission.READ_MEDIA_VIDEO";
|
|
41
|
+
readonly READ_MEDIA_AUDIO: "android.permission.READ_MEDIA_AUDIO";
|
|
42
|
+
readonly READ_MEDIA_VISUAL_USER_SELECTED: "android.permission.READ_MEDIA_VISUAL_USER_SELECTED";
|
|
43
|
+
readonly WRITE_EXTERNAL_STORAGE: "android.permission.WRITE_EXTERNAL_STORAGE";
|
|
44
|
+
readonly BLUETOOTH_CONNECT: "android.permission.BLUETOOTH_CONNECT";
|
|
45
|
+
readonly BLUETOOTH_SCAN: "android.permission.BLUETOOTH_SCAN";
|
|
46
|
+
readonly BLUETOOTH_ADVERTISE: "android.permission.BLUETOOTH_ADVERTISE";
|
|
47
|
+
readonly ACCESS_MEDIA_LOCATION: "android.permission.ACCESS_MEDIA_LOCATION";
|
|
48
|
+
readonly ACCEPT_HANDOVER: "android.permission.ACCEPT_HANDOVER";
|
|
49
|
+
readonly ACTIVITY_RECOGNITION: "android.permission.ACTIVITY_RECOGNITION";
|
|
50
|
+
readonly ANSWER_PHONE_CALLS: "android.permission.ANSWER_PHONE_CALLS";
|
|
51
|
+
readonly READ_PHONE_NUMBERS: "android.permission.READ_PHONE_NUMBERS";
|
|
52
|
+
readonly UWB_RANGING: "android.permission.UWB_RANGING";
|
|
53
|
+
readonly POST_NOTIFICATIONS: "android.permission.POST_NOTIFICATIONS";
|
|
54
|
+
readonly NEARBY_WIFI_DEVICES: "android.permission.NEARBY_WIFI_DEVICES";
|
|
55
|
+
}>;
|
|
56
|
+
export type IPermission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
|
|
57
|
+
export type IRationale = {
|
|
58
|
+
title: string;
|
|
59
|
+
message: string;
|
|
60
|
+
buttonPositive?: string;
|
|
61
|
+
buttonNegative?: string;
|
|
62
|
+
buttonNeutral?: string;
|
|
63
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// PermissionsAndroid, platform-neutral half: the frozen PERMISSIONS / RESULTS maps and the public
|
|
2
|
+
// types, copied verbatim from RN's Libraries/PermissionsAndroid/PermissionsAndroid.js. The behavior
|
|
3
|
+
// is per platform, as in RN: index.android.ts talks to the native module, index.ios.ts is RN's
|
|
4
|
+
// `Platform.OS !== 'android'` branch.
|
|
5
|
+
//
|
|
6
|
+
// The native contract, from RN's TurboModule spec (`'PermissionsAndroid'`):
|
|
7
|
+
// checkPermission(permission): Promise<boolean>
|
|
8
|
+
// requestPermission(permission): Promise<string>
|
|
9
|
+
// shouldShowRequestPermissionRationale(permission): Promise<boolean>
|
|
10
|
+
// requestMultiplePermissions(permissions): Promise<{[permission]: string}>
|
|
11
|
+
export const PERMISSIONS_ANDROID_MODULE = 'PermissionsAndroid';
|
|
12
|
+
export const ANDROID_ONLY_WARNING = '"PermissionsAndroid" module works only for Android platform.';
|
|
13
|
+
export const CHECK_PERMISSION_DEPRECATED = '"PermissionsAndroid.checkPermission" is deprecated. Use "PermissionsAndroid.check" instead';
|
|
14
|
+
export const REQUEST_PERMISSION_DEPRECATED = '"PermissionsAndroid.requestPermission" is deprecated. Use "PermissionsAndroid.request" instead';
|
|
15
|
+
// The runtime-permission result strings Android can return.
|
|
16
|
+
export const RESULTS = Object.freeze({
|
|
17
|
+
GRANTED: 'granted',
|
|
18
|
+
DENIED: 'denied',
|
|
19
|
+
NEVER_ASK_AGAIN: 'never_ask_again',
|
|
20
|
+
});
|
|
21
|
+
// The full Android permission-string map, copied verbatim from RN's source.
|
|
22
|
+
export const PERMISSIONS = Object.freeze({
|
|
23
|
+
READ_CALENDAR: 'android.permission.READ_CALENDAR',
|
|
24
|
+
WRITE_CALENDAR: 'android.permission.WRITE_CALENDAR',
|
|
25
|
+
CAMERA: 'android.permission.CAMERA',
|
|
26
|
+
READ_CONTACTS: 'android.permission.READ_CONTACTS',
|
|
27
|
+
WRITE_CONTACTS: 'android.permission.WRITE_CONTACTS',
|
|
28
|
+
GET_ACCOUNTS: 'android.permission.GET_ACCOUNTS',
|
|
29
|
+
ACCESS_FINE_LOCATION: 'android.permission.ACCESS_FINE_LOCATION',
|
|
30
|
+
ACCESS_COARSE_LOCATION: 'android.permission.ACCESS_COARSE_LOCATION',
|
|
31
|
+
ACCESS_BACKGROUND_LOCATION: 'android.permission.ACCESS_BACKGROUND_LOCATION',
|
|
32
|
+
RECORD_AUDIO: 'android.permission.RECORD_AUDIO',
|
|
33
|
+
READ_PHONE_STATE: 'android.permission.READ_PHONE_STATE',
|
|
34
|
+
CALL_PHONE: 'android.permission.CALL_PHONE',
|
|
35
|
+
READ_CALL_LOG: 'android.permission.READ_CALL_LOG',
|
|
36
|
+
WRITE_CALL_LOG: 'android.permission.WRITE_CALL_LOG',
|
|
37
|
+
ADD_VOICEMAIL: 'com.android.voicemail.permission.ADD_VOICEMAIL',
|
|
38
|
+
READ_VOICEMAIL: 'com.android.voicemail.permission.READ_VOICEMAIL',
|
|
39
|
+
WRITE_VOICEMAIL: 'com.android.voicemail.permission.WRITE_VOICEMAIL',
|
|
40
|
+
USE_SIP: 'android.permission.USE_SIP',
|
|
41
|
+
PROCESS_OUTGOING_CALLS: 'android.permission.PROCESS_OUTGOING_CALLS',
|
|
42
|
+
BODY_SENSORS: 'android.permission.BODY_SENSORS',
|
|
43
|
+
BODY_SENSORS_BACKGROUND: 'android.permission.BODY_SENSORS_BACKGROUND',
|
|
44
|
+
SEND_SMS: 'android.permission.SEND_SMS',
|
|
45
|
+
RECEIVE_SMS: 'android.permission.RECEIVE_SMS',
|
|
46
|
+
READ_SMS: 'android.permission.READ_SMS',
|
|
47
|
+
RECEIVE_WAP_PUSH: 'android.permission.RECEIVE_WAP_PUSH',
|
|
48
|
+
RECEIVE_MMS: 'android.permission.RECEIVE_MMS',
|
|
49
|
+
READ_EXTERNAL_STORAGE: 'android.permission.READ_EXTERNAL_STORAGE',
|
|
50
|
+
READ_MEDIA_IMAGES: 'android.permission.READ_MEDIA_IMAGES',
|
|
51
|
+
READ_MEDIA_VIDEO: 'android.permission.READ_MEDIA_VIDEO',
|
|
52
|
+
READ_MEDIA_AUDIO: 'android.permission.READ_MEDIA_AUDIO',
|
|
53
|
+
READ_MEDIA_VISUAL_USER_SELECTED: 'android.permission.READ_MEDIA_VISUAL_USER_SELECTED',
|
|
54
|
+
WRITE_EXTERNAL_STORAGE: 'android.permission.WRITE_EXTERNAL_STORAGE',
|
|
55
|
+
BLUETOOTH_CONNECT: 'android.permission.BLUETOOTH_CONNECT',
|
|
56
|
+
BLUETOOTH_SCAN: 'android.permission.BLUETOOTH_SCAN',
|
|
57
|
+
BLUETOOTH_ADVERTISE: 'android.permission.BLUETOOTH_ADVERTISE',
|
|
58
|
+
ACCESS_MEDIA_LOCATION: 'android.permission.ACCESS_MEDIA_LOCATION',
|
|
59
|
+
ACCEPT_HANDOVER: 'android.permission.ACCEPT_HANDOVER',
|
|
60
|
+
ACTIVITY_RECOGNITION: 'android.permission.ACTIVITY_RECOGNITION',
|
|
61
|
+
ANSWER_PHONE_CALLS: 'android.permission.ANSWER_PHONE_CALLS',
|
|
62
|
+
READ_PHONE_NUMBERS: 'android.permission.READ_PHONE_NUMBERS',
|
|
63
|
+
UWB_RANGING: 'android.permission.UWB_RANGING',
|
|
64
|
+
POST_NOTIFICATIONS: 'android.permission.POST_NOTIFICATIONS',
|
|
65
|
+
NEARBY_WIFI_DEVICES: 'android.permission.NEARBY_WIFI_DEVICES',
|
|
66
|
+
});
|