Skip to content

Commit ef57813

Browse files
release
1 parent b2ab99d commit ef57813

File tree

9 files changed

+176
-75
lines changed

9 files changed

+176
-75
lines changed

CHANGELOG.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
# Changelog of `@reason-react-native/__template__`
1+
# Changelog of `@reason-react-native/permissions`
22

3-
## X.Y.Z - 20YY-MM-DD
3+
## 2.0.0 - 2019-11-14
44

5-
Short & concise description
6-
7-
### 💥 Breaking changes
8-
9-
- Something, in [1234567](<link to commit on github>) by @<usename>
10-
11-
### 🐛 Fixes
12-
13-
- Something else, in [1234567](<link to commit on github>) by @<usename>
14-
15-
### Internal changes
16-
17-
(If worth mentioning)
5+
Initial release

README.md

Lines changed: 35 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,32 @@
1-
**How to use this template**
2-
3-
- Put your bindings in `src/ReactNativeSomething` & rename accordingly or use
4-
`bsconfig.json` `"namespace"` field (more on this below),
5-
- Update all occurences of
6-
7-
- `@reason-react-native/__template__`
8-
- `https://github.com/reason-react-native/__template__`
9-
- `__template__`
10-
- `@react-native-community/something`
11-
- `https://github.com/react-native-community/something`
12-
- `ReactNativeSomething`. If you have more than a file exposed, you should
13-
consider using BuckleScript custom namespace by adjusting `bsconfig.json`
14-
and adding a `"namespace": "react-native-something"` (note that it will be
15-
converted to `ReactNativeSomething`)
16-
17-
- Add your `@react-native-community/something` (adjusted) in `peerDependencies`
18-
& `devDependencies` section
19-
- Adjust the changelog (and/or clean it)
20-
- Remove this part ⬆ & keep everything below ⬇
1+
# `@reason-react-native/permissions`
212

22-
---
23-
24-
# `@reason-react-native/__template__`
25-
26-
[![Build Status](https://github.com/reason-react-native/__template__/workflows/Build/badge.svg)](https://github.com/reason-react-native/__template__/actions)
27-
[![Version](https://img.shields.io/npm/v/@reason-react-native/__template__.svg)](https://www.npmjs.com/@reason-react-native/__template__)
3+
[![Build Status](https://github.com/reason-react-native/permissions/workflows/Build/badge.svg)](https://github.com/reason-react-native/permissions/actions)
4+
[![Version](https://img.shields.io/npm/v/@reason-react-native/permissions.svg)](https://www.npmjs.com/@reason-react-native/permissions)
285
[![Chat](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://reasonml-community.github.io/reason-react-native/discord/)
296

307
[ReasonML](https://reasonml.github.io) /
318
[BuckleScript](https://bucklescript.github.io) bindings for
329
[`@react-native-community/something`](https://github.com/react-native-community/something).
3310

34-
Exposed as `ReactNativeSomething` module.
11+
Exposed as `ReactNativePermissions` module.
3512

36-
`@reason-react-native/__template__` X.y._ means it's compatible with
37-
`@react-native-community/something` X.y._
13+
`@reason-react-native/permissions` X.y._ means it's compatible with
14+
`react-native-permissions` X.y._
3815

3916
## Installation
4017

4118
When
42-
[`@react-native-community/something`](`https://github.com/react-native-community/something`)
19+
[`react-native-permissions`](`https://github.com/react-native-community/react-native-permissions`)
4320
is properly installed & configured by following their installation instructions,
4421
you can install the bindings:
4522

4623
```console
47-
npm install @reason-react-native/__template__
24+
npm install @reason-react-native/permissions
4825
# or
49-
yarn add @reason-react-native/__template__
26+
yarn add @reason-react-native/permissions
5027
```
5128

52-
`@reason-react-native/__template__` should be added to `bs-dependencies` in your
29+
`@reason-react-native/permissions` should be added to `bs-dependencies` in your
5330
`bsconfig.json`. Something like
5431

5532
```diff
@@ -59,25 +36,33 @@ yarn add @reason-react-native/__template__
5936
"reason-react",
6037
"reason-react-native",
6138
// ...
62-
+ "@reason-react-native/__template__"
39+
+ "@reason-react-native/permissions"
6340
],
6441
//...
6542
}
6643
```
6744

6845
## Usage
6946

70-
### Types
71-
72-
#### `ReactNativeSomething.t`
73-
74-
...
75-
76-
### Methods
77-
78-
#### `ReactNativeSomething.method`
79-
80-
...
47+
```reason
48+
open ReactNative;
49+
open ReactNativePermissions;
50+
51+
let requestCamera = () => {
52+
Permissions.request(
53+
switch (Platform.os) {
54+
| os when os === "ios" => Permissions.Constants.IOS.camera
55+
| _ => Permissions.Constants.Android.camera
56+
},
57+
)
58+
|> Js.Promise.then_(permissionStatus =>
59+
switch (permissionStatus) {
60+
| status when status === Results.granted => Js.Promise.resolve()
61+
| _ => Js.Promise.reject(Js.Exn.raiseError("permission error"))
62+
}
63+
);
64+
};
65+
```
8166

8267
---
8368

@@ -90,10 +75,12 @@ releases.
9075

9176
## Contribute
9277

93-
Read the [contribution guidelines](https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md) before contributing.
78+
Read the
79+
[contribution guidelines](https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md)
80+
before contributing.
9481

9582
## Code of Conduct
9683

9784
We want this community to be friendly and respectful to each other. Please read
98-
[our full code of conduct](https://github.com/reason-react-native/.github/blob/master/CODE_OF_CONDUCT.md) so that you can understand what
99-
actions will and will not be tolerated.
85+
[our full code of conduct](https://github.com/reason-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
86+
so that you can understand what actions will and will not be tolerated.

bsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@reason-react-native/__template__",
2+
"name": "@reason-react-native/permissions",
33
"refmt": 3,
44
"reason": {
55
"react-jsx": 3
@@ -16,5 +16,5 @@
1616
}
1717
],
1818
"bsc-flags": ["-bs-no-version-header", "-warn-error @a"],
19-
"bs-dependencies": []
19+
"bs-dependencies": ["reason-react"]
2020
}

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
2-
"name": "@reason-react-native/__template__",
3-
"version": "0.0.0",
2+
"name": "@reason-react-native/permissions",
3+
"version": "2.0.3",
44
"publishConfig": {
55
"access": "public"
66
},
77
"peerDependencies": {
8+
"react-native-permissions": "2.0.3"
89
},
9-
"repository": "https://github.com/reason-react-native/__template__.git",
10+
"repository": "https://github.com/reason-react-native/permissions.git",
1011
"license": "MIT",
1112
"keywords": [
1213
"reason",
@@ -37,7 +38,8 @@
3738
"bs-platform": "^5.2.0",
3839
"husky": "^1.3.0",
3940
"lint-staged": "^8.1.0",
40-
"prettier": "^1.18.0"
41+
"prettier": "^1.18.0",
42+
"reason-react": "^0.7.0"
4143
},
4244
"prettier": {
4345
"trailingComma": "all",

src/ReactNativePermissions.bs.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
4+
var IOS = { };
5+
6+
var Android = { };
7+
8+
var Constants = {
9+
IOS: IOS,
10+
Android: Android
11+
};
12+
13+
var Results = { };
14+
15+
var $$Permissions = {
16+
Constants: Constants,
17+
Results: Results
18+
};
19+
20+
exports.$$Permissions = $$Permissions;
21+
/* No side effect */

src/ReactNativePermissions.re

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
module Permissions = {
2+
module Constants = {
3+
type t;
4+
5+
module IOS = {
6+
[@bs.module "react-native-permissions"]
7+
[@bs.scope ("default", "PERMISSIONS", "IOS")]
8+
external camera: t = "CAMERA";
9+
10+
[@bs.module "react-native-permissions"]
11+
[@bs.scope ("default", "PERMISSIONS", "IOS")]
12+
external locationAlways: t = "LOCATION_ALWAYS";
13+
};
14+
15+
module Android = {
16+
[@bs.module "react-native-permissions"]
17+
[@bs.scope ("default", "PERMISSIONS", "ANDROID")]
18+
external camera: t = "CAMERA";
19+
20+
[@bs.module "react-native-permissions"]
21+
[@bs.scope ("default", "PERMISSIONS", "ANDROID")]
22+
external accessCoarseLocation: t = "ACCESS_COARSE_LOCATION";
23+
24+
[@bs.module "react-native-permissions"]
25+
[@bs.scope ("default", "PERMISSIONS", "ANDROID")]
26+
external accessFineLocation: t = "ACCESS_FINE_LOCATION";
27+
};
28+
};
29+
30+
module Results = {
31+
type t;
32+
[@bs.module "react-native-permissions"] [@bs.scope ("default", "RESULTS")]
33+
external unavailable: t = "UNAVAILABLE";
34+
[@bs.module "react-native-permissions"] [@bs.scope ("default", "RESULTS")]
35+
external denied: t = "DENIED";
36+
[@bs.module "react-native-permissions"] [@bs.scope ("default", "RESULTS")]
37+
external granted: t = "GRANTED";
38+
[@bs.module "react-native-permissions"] [@bs.scope ("default", "RESULTS")]
39+
external blocked: t = "BLOCKED";
40+
};
41+
42+
[@bs.module "react-native-permissions"] [@bs.scope "default"]
43+
external openSettings: unit => Js.Promise.t(unit) = "openSettings";
44+
45+
[@bs.module "react-native-permissions"] [@bs.scope "default"]
46+
external request: Constants.t => Js.Promise.t(Results.t) = "request";
47+
};

src/ReactNativeSomething.bs.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/ReactNativeSomething.re

Lines changed: 0 additions & 4 deletions
This file was deleted.

yarn.lock

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,11 @@ isobject@^3.0.0, isobject@^3.0.1:
842842
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
843843
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
844844

845+
"js-tokens@^3.0.0 || ^4.0.0":
846+
version "4.0.0"
847+
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
848+
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
849+
845850
js-yaml@^3.13.1:
846851
version "3.13.1"
847852
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
@@ -989,6 +994,13 @@ log-update@^2.3.0:
989994
cli-cursor "^2.0.0"
990995
wrap-ansi "^3.0.1"
991996

997+
loose-envify@^1.1.0, loose-envify@^1.4.0:
998+
version "1.4.0"
999+
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
1000+
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
1001+
dependencies:
1002+
js-tokens "^3.0.0 || ^4.0.0"
1003+
9921004
map-cache@^0.2.2:
9931005
version "0.2.2"
9941006
resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf"
@@ -1117,7 +1129,7 @@ number-is-nan@^1.0.0:
11171129
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
11181130
integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=
11191131

1120-
object-assign@^4.0.1, object-assign@^4.1.0:
1132+
object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
11211133
version "4.1.1"
11221134
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
11231135
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
@@ -1277,6 +1289,15 @@ prettier@^1.18.0:
12771289
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
12781290
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
12791291

1292+
prop-types@^15.6.2:
1293+
version "15.7.2"
1294+
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
1295+
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
1296+
dependencies:
1297+
loose-envify "^1.4.0"
1298+
object-assign "^4.1.1"
1299+
react-is "^16.8.1"
1300+
12801301
property-expr@^1.5.0:
12811302
version "1.5.1"
12821303
resolved "https://registry.yarnpkg.com/property-expr/-/property-expr-1.5.1.tgz#22e8706894a0c8e28d58735804f6ba3a3673314f"
@@ -1290,6 +1311,30 @@ pump@^3.0.0:
12901311
end-of-stream "^1.1.0"
12911312
once "^1.3.1"
12921313

1314+
react-dom@>=16.8.1:
1315+
version "16.11.0"
1316+
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.11.0.tgz#7e7c4a5a85a569d565c2462f5d345da2dd849af5"
1317+
integrity sha512-nrRyIUE1e7j8PaXSPtyRKtz+2y9ubW/ghNgqKFHHAHaeP0fpF5uXR+sq8IMRHC+ZUxw7W9NyCDTBtwWxvkb0iA==
1318+
dependencies:
1319+
loose-envify "^1.1.0"
1320+
object-assign "^4.1.1"
1321+
prop-types "^15.6.2"
1322+
scheduler "^0.17.0"
1323+
1324+
react-is@^16.8.1:
1325+
version "16.11.0"
1326+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa"
1327+
integrity sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw==
1328+
1329+
react@>=16.8.1:
1330+
version "16.11.0"
1331+
resolved "https://registry.yarnpkg.com/react/-/react-16.11.0.tgz#d294545fe62299ccee83363599bf904e4a07fdbb"
1332+
integrity sha512-M5Y8yITaLmU0ynd0r1Yvfq98Rmll6q8AxaEe88c8e7LxO8fZ2cNgmFt0aGAS9wzf1Ao32NKXtCl+/tVVtkxq6g==
1333+
dependencies:
1334+
loose-envify "^1.1.0"
1335+
object-assign "^4.1.1"
1336+
prop-types "^15.6.2"
1337+
12931338
read-pkg@^4.0.1:
12941339
version "4.0.1"
12951340
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237"
@@ -1299,6 +1344,14 @@ read-pkg@^4.0.1:
12991344
parse-json "^4.0.0"
13001345
pify "^3.0.0"
13011346

1347+
reason-react@^0.7.0:
1348+
version "0.7.0"
1349+
resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.7.0.tgz#46a975c321e81cd51310d7b1a02418ca7667b0d6"
1350+
integrity sha512-czR/f0lY5iyLCki9gwftOFF5Zs40l7ZSFmpGK/Z6hx2jBVeFDmIiXB8bAQW/cO6IvtuEt97OmsYueiuOYG9XjQ==
1351+
dependencies:
1352+
react ">=16.8.1"
1353+
react-dom ">=16.8.1"
1354+
13021355
regenerator-runtime@^0.13.2:
13031356
version "0.13.3"
13041357
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5"
@@ -1378,6 +1431,14 @@ safe-regex@^1.1.0:
13781431
dependencies:
13791432
ret "~0.1.10"
13801433

1434+
scheduler@^0.17.0:
1435+
version "0.17.0"
1436+
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.17.0.tgz#7c9c673e4ec781fac853927916d1c426b6f3ddfe"
1437+
integrity sha512-7rro8Io3tnCPuY4la/NuI5F2yfESpnfZyT6TtkXnSWVkcu0BCDJ+8gk5ozUaFaxpIyNuWAPXrH0yFcSi28fnDA==
1438+
dependencies:
1439+
loose-envify "^1.1.0"
1440+
object-assign "^4.1.1"
1441+
13811442
semver-compare@^1.0.0:
13821443
version "1.0.0"
13831444
resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"

0 commit comments

Comments
 (0)