|
| 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 | +``` |
0 commit comments