|
@@ -2,7 +2,7 @@
|
2
|
2
|
Check user permissions (iOS only)
|
3
|
3
|
|
4
|
4
|
##What
|
5
|
|
-Some iOS features require the user grant permission before you can access them.
|
|
5
|
+Some iOS features require the user to grant permission before you can access them.
|
6
|
6
|
|
7
|
7
|
This library lets you check the current status of those permissions. (Note: it _doesn't_ prompt the user, just silently checks the permission status)
|
8
|
8
|
|
|
@@ -13,7 +13,7 @@ The current supported permissions are:
|
13
|
13
|
- Photos
|
14
|
14
|
- Contacts
|
15
|
15
|
- Event
|
16
|
|
-- Bluetooth
|
|
16
|
+- Bluetooth (Peripheral role. Don't use for Central only)
|
17
|
17
|
- RemoteNotifications (Push Notifications)
|
18
|
18
|
|
19
|
19
|
####Example
|
|
@@ -25,13 +25,13 @@ const Permissions = require('react-native-permissions');
|
25
|
25
|
Permissions.locationPermissionStatus()
|
26
|
26
|
.then(response => {
|
27
|
27
|
if (response == Permissions.StatusUndetermined) {
|
28
|
|
- alert("Undetermined");
|
|
28
|
+ console.log("Undetermined");
|
29
|
29
|
} else if (response == Permissions.StatusDenied) {
|
30
|
|
- alert("Denied");
|
|
30
|
+ console.log("Denied");
|
31
|
31
|
} else if (response == Permissions.StatusAuthorized) {
|
32
|
|
- alert("Authorized");
|
|
32
|
+ console.log("Authorized");
|
33
|
33
|
} else if (response == Permissions.StatusRestricted) {
|
34
|
|
- alert("Restricted");
|
|
34
|
+ console.log("Restricted");
|
35
|
35
|
}
|
36
|
36
|
});
|
37
|
37
|
}
|
|
@@ -53,9 +53,9 @@ As shown in the example, methods return a promise with the authorization status
|
53
|
53
|
|
54
|
54
|
`contactsPermissionStatus()` - checks for access to the user's address book
|
55
|
55
|
|
56
|
|
-`eventPermissionStatus(eventType)` - requires param `eventType`; either `reminder` or `event`. Checks for access to the users calendar events and reminders
|
|
56
|
+`eventPermissionStatus(eventType)` - requires param `eventType`; either `reminder` or `event`. Checks for access to the user's calendar events and reminders
|
57
|
57
|
|
58
|
|
-`bluetoothPermissionStatus()` - checks the authorization status of the `CBPeripheralManager` (for sharing data while backgrounded)
|
|
58
|
+`bluetoothPermissionStatus()` - checks the authorization status of the `CBPeripheralManager` (for sharing data while backgrounded). Note: _Don't_ use this if you're only using `CBCentralManager`
|
59
|
59
|
|
60
|
60
|
`notificationPermissionStatus()` - checks if the user has authorized remote push notifications. Note: Apple only tells us if notifications are authorized or not, not the exact status. So this promise only returns `StatusUndetermined` or `StatusAuthorized`. You can determine if `StatusUndetermined` is actually `StatusRejected` by keeping track of whether or not you've already asked the user for permission.
|
61
|
61
|
|
|
@@ -68,4 +68,4 @@ npm install --save react-native-permissions
|
68
|
68
|
###iOS
|
69
|
69
|
* Run open node_modules/react-native-permissions
|
70
|
70
|
* Drag ReactNativePermissions.xcodeproj into the Libraries group of your app's Xcode project
|
71
|
|
-* Add libReactNativePermissions.a to `Build Phases -> Link Binary With Libraries.
|
|
71
|
+* Add libReactNativePermissions.a to `Build Phases -> Link Binary With Libraries.
|