Skip to content

Commit ec5e1fd

Browse files
fhammerschmidtcknitt
authored andcommitted
bs-react-native-next: PermissionsAndroid (#401)
1 parent 777f22a commit ec5e1fd

4 files changed

Lines changed: 339 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
4+
var Permission = /* module */[];
5+
6+
exports.Permission = Permission;
7+
/* No side effect */
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
id: apis/PermissionsAndroid
3+
title: PermissionsAndroid
4+
wip: true
5+
---
6+
7+
```reason
8+
module Permission: {
9+
type t;
10+
11+
[@bs.inline "READ_CALENDAR"]
12+
let readCalendar: t;
13+
14+
[@bs.inline "WRITE_CALENDAR"]
15+
let writeCalendar: t;
16+
17+
[@bs.inline "CAMERA"]
18+
let camera: t;
19+
20+
[@bs.inline "READ_CONTACTS"]
21+
let readContacts: t;
22+
23+
[@bs.inline "WRITE_CONTACTS"]
24+
let writeContacts: t;
25+
26+
[@bs.inline "GET_ACCOUNTS"]
27+
let getAccounts: t;
28+
29+
[@bs.inline "ACCESS_FINE_LOCATION"]
30+
let accessFineLocation: t;
31+
32+
[@bs.inline "ACCESS_COARSE_LOCATION"]
33+
let accessCoarseLocation: t;
34+
35+
[@bs.inline "RECORD_AUDIO"]
36+
let recordAudio: t;
37+
38+
[@bs.inline "READ_PHONE_STATE"]
39+
let readPhoneState: t;
40+
41+
[@bs.inline "CALL_PHONE"]
42+
let callPhone: t;
43+
44+
[@bs.inline "READ_CALL_LOG"]
45+
let readCallLog: t;
46+
47+
[@bs.inline "WRITE_CALL_LOG"]
48+
let writeCallLog: t;
49+
50+
[@bs.inline "ADD_VOICEMAIL"]
51+
let addVoicemail: t;
52+
53+
[@bs.inline "USE_SIP"]
54+
let useSip: t;
55+
56+
[@bs.inline "PROCESS_OUTGOING_CALLS"]
57+
let processOutgoingCalls: t;
58+
59+
[@bs.inline "BODY_SENSORS"]
60+
let bodySensors: t;
61+
62+
[@bs.inline "SEND_SMS"]
63+
let sendSms: t;
64+
65+
[@bs.inline "RECEIVE_SMS"]
66+
let receiveSms: t;
67+
68+
[@bs.inline "READ_SMS"]
69+
let readSms: t;
70+
71+
[@bs.inline "RECEIVE_WAP_PUSH"]
72+
let receiveWapPush: t;
73+
74+
[@bs.inline "RECEIVE_MMS"]
75+
let receiveMms: t;
76+
77+
[@bs.inline "READ_EXTERNAL_STORAGE"]
78+
let readExternalStorage: t;
79+
80+
[@bs.inline "WRITE_EXTERNAL_STORAGE"]
81+
let writeExternalStorage: t;
82+
83+
external toString: t => string = "%identity";
84+
};
85+
86+
type rationale;
87+
[@bs.obj]
88+
external rationale:
89+
(
90+
~title: string,
91+
~message: string,
92+
~buttonPositive: string,
93+
~buttonNegative: string=?,
94+
~buttonNeutral: string=?,
95+
unit
96+
) =>
97+
rationale =
98+
"";
99+
100+
[@bs.module "react-native"] [@bs.scope "PermissionsAndroid"]
101+
external check: Permission.t => Js.Promise.t(Js.Null.t(bool)) = "check";
102+
103+
[@bs.module "react-native"] [@bs.scope "PermissionsAndroid"]
104+
external request: Permission.t => Js.Promise.t(Js.Null.t(string)) =
105+
"request";
106+
107+
[@bs.module "react-native"] [@bs.scope "PermissionsAndroid"]
108+
external requestWithRationale:
109+
(Permission.t, rationale) => Js.Promise.t(Js.Null.t(string)) =
110+
"request";
111+
112+
[@bs.module "react-native"] [@bs.scope "PermissionsAndroid"]
113+
external requestMultiple:
114+
array(Permission.t) => Js.Promise.t(Js.Dict.t(string)) =
115+
"request";
116+
```
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
module Permission = {
2+
type t = string;
3+
4+
[@bs.inline]
5+
let readCalendar = "READ_CALENDAR";
6+
7+
[@bs.inline]
8+
let writeCalendar = "WRITE_CALENDAR";
9+
10+
[@bs.inline]
11+
let camera = "CAMERA";
12+
13+
[@bs.inline]
14+
let readContacts = "READ_CONTACTS";
15+
16+
[@bs.inline]
17+
let writeContacts = "WRITE_CONTACTS";
18+
19+
[@bs.inline]
20+
let getAccounts = "GET_ACCOUNTS";
21+
22+
[@bs.inline]
23+
let accessFineLocation = "ACCESS_FINE_LOCATION";
24+
25+
[@bs.inline]
26+
let accessCoarseLocation = "ACCESS_COARSE_LOCATION";
27+
28+
[@bs.inline]
29+
let recordAudio = "RECORD_AUDIO";
30+
31+
[@bs.inline]
32+
let readPhoneState = "READ_PHONE_STATE";
33+
34+
[@bs.inline]
35+
let callPhone = "CALL_PHONE";
36+
37+
[@bs.inline]
38+
let readCallLog = "READ_CALL_LOG";
39+
40+
[@bs.inline]
41+
let writeCallLog = "WRITE_CALL_LOG";
42+
43+
[@bs.inline]
44+
let addVoicemail = "ADD_VOICEMAIL";
45+
46+
[@bs.inline]
47+
let useSip = "USE_SIP";
48+
49+
[@bs.inline]
50+
let processOutgoingCalls = "PROCESS_OUTGOING_CALLS";
51+
52+
[@bs.inline]
53+
let bodySensors = "BODY_SENSORS";
54+
55+
[@bs.inline]
56+
let sendSms = "SEND_SMS";
57+
58+
[@bs.inline]
59+
let receiveSms = "RECEIVE_SMS";
60+
61+
[@bs.inline]
62+
let readSms = "READ_SMS";
63+
64+
[@bs.inline]
65+
let receiveWapPush = "RECEIVE_WAP_PUSH";
66+
67+
[@bs.inline]
68+
let receiveMms = "RECEIVE_MMS";
69+
70+
[@bs.inline]
71+
let readExternalStorage = "READ_EXTERNAL_STORAGE";
72+
73+
[@bs.inline]
74+
let writeExternalStorage = "WRITE_EXTERNAL_STORAGE";
75+
76+
external toString: t => string = "%identity";
77+
};
78+
79+
type rationale;
80+
[@bs.obj]
81+
external rationale:
82+
(
83+
~title: string,
84+
~message: string,
85+
~buttonPositive: string,
86+
~buttonNegative: string=?,
87+
~buttonNeutral: string=?,
88+
unit
89+
) =>
90+
rationale =
91+
"";
92+
93+
[@bs.scope "PermissionsAndroid"] [@bs.module "react-native"]
94+
external check: Permission.t => Js.Promise.t(Js.Null.t(bool)) = "check";
95+
96+
[@bs.scope "PermissionsAndroid"] [@bs.module "react-native"]
97+
external request: Permission.t => Js.Promise.t(Js.Null.t(string)) =
98+
"request";
99+
100+
[@bs.scope "PermissionsAndroid"] [@bs.module "react-native"]
101+
external requestWithRationale:
102+
(Permission.t, rationale) => Js.Promise.t(Js.Null.t(string)) =
103+
"request";
104+
105+
[@bs.scope "PermissionsAndroid"] [@bs.module "react-native"]
106+
external requestMultiple:
107+
array(Permission.t) => Js.Promise.t(Js.Dict.t(string)) =
108+
"request";
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
module Permission: {
2+
type t;
3+
4+
[@bs.inline "READ_CALENDAR"]
5+
let readCalendar: t;
6+
7+
[@bs.inline "WRITE_CALENDAR"]
8+
let writeCalendar: t;
9+
10+
[@bs.inline "CAMERA"]
11+
let camera: t;
12+
13+
[@bs.inline "READ_CONTACTS"]
14+
let readContacts: t;
15+
16+
[@bs.inline "WRITE_CONTACTS"]
17+
let writeContacts: t;
18+
19+
[@bs.inline "GET_ACCOUNTS"]
20+
let getAccounts: t;
21+
22+
[@bs.inline "ACCESS_FINE_LOCATION"]
23+
let accessFineLocation: t;
24+
25+
[@bs.inline "ACCESS_COARSE_LOCATION"]
26+
let accessCoarseLocation: t;
27+
28+
[@bs.inline "RECORD_AUDIO"]
29+
let recordAudio: t;
30+
31+
[@bs.inline "READ_PHONE_STATE"]
32+
let readPhoneState: t;
33+
34+
[@bs.inline "CALL_PHONE"]
35+
let callPhone: t;
36+
37+
[@bs.inline "READ_CALL_LOG"]
38+
let readCallLog: t;
39+
40+
[@bs.inline "WRITE_CALL_LOG"]
41+
let writeCallLog: t;
42+
43+
[@bs.inline "ADD_VOICEMAIL"]
44+
let addVoicemail: t;
45+
46+
[@bs.inline "USE_SIP"]
47+
let useSip: t;
48+
49+
[@bs.inline "PROCESS_OUTGOING_CALLS"]
50+
let processOutgoingCalls: t;
51+
52+
[@bs.inline "BODY_SENSORS"]
53+
let bodySensors: t;
54+
55+
[@bs.inline "SEND_SMS"]
56+
let sendSms: t;
57+
58+
[@bs.inline "RECEIVE_SMS"]
59+
let receiveSms: t;
60+
61+
[@bs.inline "READ_SMS"]
62+
let readSms: t;
63+
64+
[@bs.inline "RECEIVE_WAP_PUSH"]
65+
let receiveWapPush: t;
66+
67+
[@bs.inline "RECEIVE_MMS"]
68+
let receiveMms: t;
69+
70+
[@bs.inline "READ_EXTERNAL_STORAGE"]
71+
let readExternalStorage: t;
72+
73+
[@bs.inline "WRITE_EXTERNAL_STORAGE"]
74+
let writeExternalStorage: t;
75+
76+
external toString: t => string = "%identity";
77+
};
78+
79+
type rationale;
80+
[@bs.obj]
81+
external rationale:
82+
(
83+
~title: string,
84+
~message: string,
85+
~buttonPositive: string,
86+
~buttonNegative: string=?,
87+
~buttonNeutral: string=?,
88+
unit
89+
) =>
90+
rationale =
91+
"";
92+
93+
[@bs.module "react-native"] [@bs.scope "PermissionsAndroid"]
94+
external check: Permission.t => Js.Promise.t(Js.Null.t(bool)) = "check";
95+
96+
[@bs.module "react-native"] [@bs.scope "PermissionsAndroid"]
97+
external request: Permission.t => Js.Promise.t(Js.Null.t(string)) =
98+
"request";
99+
100+
[@bs.module "react-native"] [@bs.scope "PermissionsAndroid"]
101+
external requestWithRationale:
102+
(Permission.t, rationale) => Js.Promise.t(Js.Null.t(string)) =
103+
"request";
104+
105+
[@bs.module "react-native"] [@bs.scope "PermissionsAndroid"]
106+
external requestMultiple:
107+
array(Permission.t) => Js.Promise.t(Js.Dict.t(string)) =
108+
"request";

0 commit comments

Comments
 (0)