Browse Source

Run prettier on md and json

Mathieu Acthernoene 7 years ago
parent
commit
1a710e0d66
4 changed files with 216 additions and 141 deletions
  1. 39
    11
      .github/CODE_OF_CONDUCT.md
  2. 150
    96
      README.md
  3. 23
    23
      example/ios/Example/Images.xcassets/AppIcon.appiconset/Contents.json
  4. 4
    11
      package.json

+ 39
- 11
.github/CODE_OF_CONDUCT.md View File

2
 
2
 
3
 ## Our Pledge
3
 ## Our Pledge
4
 
4
 
5
-In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
5
+In the interest of fostering an open and welcoming environment, we as
6
+contributors and maintainers pledge to making participation in our project and
7
+our community a harassment-free experience for everyone, regardless of age, body
8
+size, disability, ethnicity, gender identity and expression, level of
9
+experience, nationality, personal appearance, race, religion, or sexual identity
10
+and orientation.
6
 
11
 
7
 ## Our Standards
12
 ## Our Standards
8
 
13
 
9
-Examples of behavior that contributes to creating a positive environment include:
14
+Examples of behavior that contributes to creating a positive environment
15
+include:
10
 
16
 
11
 * Using welcoming and inclusive language
17
 * Using welcoming and inclusive language
12
 * Being respectful of differing viewpoints and experiences
18
 * Being respectful of differing viewpoints and experiences
16
 
22
 
17
 Examples of unacceptable behavior by participants include:
23
 Examples of unacceptable behavior by participants include:
18
 
24
 
19
-* The use of sexualized language or imagery and unwelcome sexual attention or advances
25
+* The use of sexualized language or imagery and unwelcome sexual attention or
26
+  advances
20
 * Trolling, insulting/derogatory comments, and personal or political attacks
27
 * Trolling, insulting/derogatory comments, and personal or political attacks
21
 * Public or private harassment
28
 * Public or private harassment
22
-* Publishing others' private information, such as a physical or electronic address, without explicit permission
23
-* Other conduct which could reasonably be considered inappropriate in a professional setting
29
+* Publishing others' private information, such as a physical or electronic
30
+  address, without explicit permission
31
+* Other conduct which could reasonably be considered inappropriate in a
32
+  professional setting
24
 
33
 
25
 ## Our Responsibilities
34
 ## Our Responsibilities
26
 
35
 
27
-Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
36
+Project maintainers are responsible for clarifying the standards of acceptable
37
+behavior and are expected to take appropriate and fair corrective action in
38
+response to any instances of unacceptable behavior.
28
 
39
 
29
-Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
40
+Project maintainers have the right and responsibility to remove, edit, or reject
41
+comments, commits, code, wiki edits, issues, and other contributions that are
42
+not aligned to this Code of Conduct, or to ban temporarily or permanently any
43
+contributor for other behaviors that they deem inappropriate, threatening,
44
+offensive, or harmful.
30
 
45
 
31
 ## Scope
46
 ## Scope
32
 
47
 
33
-This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
48
+This Code of Conduct applies both within project spaces and in public spaces
49
+when an individual is representing the project or its community. Examples of
50
+representing a project or community include using an official project e-mail
51
+address, posting via an official social media account, or acting as an appointed
52
+representative at an online or offline event. Representation of a project may be
53
+further defined and clarified by project maintainers.
34
 
54
 
35
 ## Enforcement
55
 ## Enforcement
36
 
56
 
37
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at yonaforst@hotmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
57
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+reported by contacting the project team at yonaforst@hotmail.com. The project
59
+team will review and investigate all complaints, and will respond in a way that
60
+it deems appropriate to the circumstances. The project team is obligated to
61
+maintain confidentiality with regard to the reporter of an incident. Further
62
+details of specific enforcement policies may be posted separately.
38
 
63
 
39
-Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
64
+Project maintainers who do not follow or enforce the Code of Conduct in good
65
+faith may face temporary or permanent repercussions as determined by other
66
+members of the project's leadership.
40
 
67
 
41
 ## Attribution
68
 ## Attribution
42
 
69
 
43
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
70
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
71
+version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
 
72
 
45
 [homepage]: http://contributor-covenant.org
73
 [homepage]: http://contributor-covenant.org
46
 [version]: http://contributor-covenant.org/version/1/4/
74
 [version]: http://contributor-covenant.org/version/1/4/

+ 150
- 96
README.md View File

1
 # ☝🏼 React Native Permissions
1
 # ☝🏼 React Native Permissions
2
 
2
 
3
+[![npm version](https://badge.fury.io/js/react-native-permissions.svg)](https://badge.fury.io/js/react-native-permissions)
4
+[![npm](https://img.shields.io/npm/dt/react-native-permissions.svg)](https://www.npmjs.org/package/react-native-permissions)
5
+![Platform - Android and iOS](https://img.shields.io/badge/platform-Android%20%7C%20iOS-yellow.svg)
6
+![MIT](https://img.shields.io/dub/l/vibe-d.svg)
7
+[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
8
+
3
 Request user permissions from React Native, iOS + Android
9
 Request user permissions from React Native, iOS + Android
4
 
10
 
5
 | Version | React Native Support |
11
 | Version | React Native Support |
6
-|---|---|
7
-| 1.0.1 | 0.40.0 - 0.48.4 |
8
-| 0.2.5 | 0.33.0 - 0.39.0 |
9
-*Complies with [react-native-version-support-table](https://github.com/dangnelson/react-native-version-support-table)*
12
+| ------- | -------------------- |
13
+| 1.0.1   | 0.40.0 - 0.48.4      |
14
+| 0.2.5   | 0.33.0 - 0.39.0      |
15
+
16
+_Complies with
17
+[react-native-version-support-table](https://github.com/dangnelson/react-native-version-support-table)_
10
 
18
 
11
 ## ⚠️ Breaking changes in version 1.0.0
19
 ## ⚠️ Breaking changes in version 1.0.0
12
-- Now using React Native's own JS `PermissionsAndroid` module on Android, which is great because we no longer have to do any additional linking on Android
13
-- Updated API to be closer to React Native's `PermissionsAndroid`
14
-- Removed `openSettings()` support on Android (to stay linking-free). There are several NPM modules available for this
15
-- `restricted` status now supported on Android, although it means something different than iOS
20
+
21
+* Now using React Native's own JS `PermissionsAndroid` module on Android, which
22
+  is great because we no longer have to do any additional linking on Android
23
+* Updated API to be closer to React Native's `PermissionsAndroid`
24
+* Removed `openSettings()` support on Android (to stay linking-free). There are
25
+  several NPM modules available for this
26
+* `restricted` status now supported on Android, although it means something
27
+  different than iOS
16
 
28
 
17
 ## Setup
29
 ## Setup
18
 
30
 
22
 yarn add react-native-permissions
34
 yarn add react-native-permissions
23
 ```
35
 ```
24
 
36
 
25
-*📌  Don't forget to add permissions to `AndroidManifest.xml` for android and `Info.plist` for iOS (Xcode >= 8). See notes below for more details.*
37
+_📌 Don't forget to add permissions to `AndroidManifest.xml` for android and
38
+`Info.plist` for iOS (Xcode >= 8). See notes below for more details._
26
 
39
 
27
 ### Additional iOS setup
40
 ### Additional iOS setup
28
 
41
 
29
 #### Using cocoaPods
42
 #### Using cocoaPods
30
 
43
 
31
-Update the following line with your path to `node_modules/` and add it to your podfile:
44
+Update the following line with your path to `node_modules/` and add it to your
45
+podfile:
32
 
46
 
33
 ```ruby
47
 ```ruby
34
 pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
48
 pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
42
 
56
 
43
 #### Using manual linking
57
 #### Using manual linking
44
 
58
 
45
-1. In the XCode's "Project navigator", right click on your project's Libraries folder ➜ `Add Files to <...>`
46
-2. Go to `node_modules` ➜ `react-native-permissions` ➜ select `ReactNativePermissions.xcodeproj`
47
-3. Add `libReactNativePermissions.a` to `Build Phases` -> `Link Binary With Libraries`
59
+1. In the XCode's "Project navigator", right click on your project's Libraries
60
+   folder ➜ `Add Files to <...>`
61
+2. Go to `node_modules` ➜ `react-native-permissions` ➜ select
62
+   `ReactNativePermissions.xcodeproj`
63
+3. Add `libReactNativePermissions.a` to `Build Phases` -> `Link Binary With
64
+   Libraries`
48
 
65
 
49
 ```js
66
 ```js
50
-import Permissions from "react-native-permissions";
67
+import Permissions from 'react-native-permissions'
51
 
68
 
52
 //...
69
 //...
53
 
70
 
56
 
73
 
57
   // Check the status of a single permission
74
   // Check the status of a single permission
58
   componentDidMount() {
75
   componentDidMount() {
59
-    Permissions.check("photo").then(response => {
76
+    Permissions.check('photo').then(response => {
60
       // Response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
77
       // Response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
61
-      this.setState({ photoPermission: response });
62
-    });
78
+      this.setState({ photoPermission: response })
79
+    })
63
   }
80
   }
64
 
81
 
65
   // Request permission to access photos
82
   // Request permission to access photos
66
   _requestPermission = () => {
83
   _requestPermission = () => {
67
-    Permissions.request("photo").then(response => {
84
+    Permissions.request('photo').then(response => {
68
       // Returns once the user has chosen to 'allow' or to 'not allow' access
85
       // Returns once the user has chosen to 'allow' or to 'not allow' access
69
       // Response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
86
       // Response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
70
-      this.setState({ photoPermission: response });
71
-    });
72
-  };
87
+      this.setState({ photoPermission: response })
88
+    })
89
+  }
73
 
90
 
74
   // Check the status of multiple permissions
91
   // Check the status of multiple permissions
75
   _checkCameraAndPhotos = () => {
92
   _checkCameraAndPhotos = () => {
76
-    Permissions.checkMultiple(["camera", "photo"]).then(response => {
93
+    Permissions.checkMultiple(['camera', 'photo']).then(response => {
77
       //response is an object mapping type to permission
94
       //response is an object mapping type to permission
78
       this.setState({
95
       this.setState({
79
         cameraPermission: response.camera,
96
         cameraPermission: response.camera,
80
-        photoPermission: response.photo
81
-      });
82
-    });
83
-  };
97
+        photoPermission: response.photo,
98
+      })
99
+    })
100
+  }
84
 
101
 
85
   // This is a common pattern when asking for permissions.
102
   // This is a common pattern when asking for permissions.
86
   // iOS only gives you once chance to show the permission dialog,
103
   // iOS only gives you once chance to show the permission dialog,
90
   // If the user already denied access, we can ask them to enable it from settings.
107
   // If the user already denied access, we can ask them to enable it from settings.
91
   _alertForPhotosPermission() {
108
   _alertForPhotosPermission() {
92
     Alert.alert(
109
     Alert.alert(
93
-      "Can we access your photos?",
94
-      "We need access so you can set your profile pic",
110
+      'Can we access your photos?',
111
+      'We need access so you can set your profile pic',
95
       [
112
       [
96
         {
113
         {
97
-          text: "No way",
98
-          onPress: () => console.log("Permission denied"),
99
-          style: "cancel"
114
+          text: 'No way',
115
+          onPress: () => console.log('Permission denied'),
116
+          style: 'cancel',
100
         },
117
         },
101
-        this.state.photoPermission == "undetermined"
102
-          ? { text: "OK", onPress: this._requestPermission }
103
-          : { text: "Open Settings", onPress: Permissions.openSettings }
104
-      ]
105
-    );
118
+        this.state.photoPermission == 'undetermined'
119
+          ? { text: 'OK', onPress: this._requestPermission }
120
+          : { text: 'Open Settings', onPress: Permissions.openSettings },
121
+      ],
122
+    )
106
   }
123
   }
107
 
124
 
108
   //...
125
   //...
115
 
132
 
116
 Promises resolve into one of these statuses:
133
 Promises resolve into one of these statuses:
117
 
134
 
118
-| Return value | Notes|
119
-|---|---|
120
-|`authorized`| User has authorized this permission |
121
-|`denied`| User has denied this permission at least once. On iOS this means that the user will not be prompted again. Android users can be promted multiple times until they select 'Never ask me again'|
122
-|`restricted`| **iOS only** - this means user is not able to grant this permission, either because it's not supported by the device or because it has been blocked by parental controls. **Android** - this means that the user has selected 'Never ask me again' while denying permission |
123
-|`undetermined`| User has not yet been prompted with a permission dialog |
135
+| Return value   | Notes                                                                                                                                                                                                                                                                  |
136
+| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
137
+| `authorized`   | User has authorized this permission                                                                                                                                                                                                                                    |
138
+| `denied`       | User has denied this permission at least once. On iOS this means that the user will not be prompted again. Android users can be promted multiple times until they select 'Never ask me again'                                                                          |
139
+| `restricted`   | **iOS** - this means user is not able to grant this permission, either because it's not supported by the device or because it has been blocked by parental controls. **Android** - this means that the user has selected 'Never ask me again' while denying permission |
140
+| `undetermined` | User has not yet been prompted with a permission dialog                                                                                                                                                                                                                |
124
 
141
 
125
 ### Supported permissions types
142
 ### Supported permissions types
126
 
143
 
127
 The current supported permissions are:
144
 The current supported permissions are:
128
 
145
 
129
-|  | Type | iOS | Android |
130
-|---|---|---|---|
131
-| Location |`location`| ✔️ | ✔ |
132
-| Camera |`camera`| ✔️ | ✔ |
133
-| Microphone |`microphone`| ✔️ | ✔ |
134
-| Photos |`photo`| ✔️ | ✔ |
135
-| Contacts |`contacts`| ✔️ | ✔ |
136
-| Events |`event`| ✔️ | ✔ |
137
-| Bluetooth |`bluetooth`| ✔️ | ❌ |
138
-| Reminders |`reminder`| ✔️ | ❌ |
139
-| Push Notifications |`notification`| ✔️ | ❌ |
140
-| Background Refresh |`backgroundRefresh`| ✔️ | ❌ |
141
-| Speech Recognition |`speechRecognition`| ✔️ | ❌ |
142
-| Storage |`storage`| ❌️ | ✔ |
143
-| Phone Call |`callPhone`| ❌️ | ✔ |
144
-| Read SMS |`readSms`| ❌️ | ✔ |
145
-| Receive SMS |`receiveSms`| ❌️ | ✔ |
146
-
146
+|                    | Type                | iOS | Android |
147
+| ------------------ | ------------------- | --- | ------- |
148
+| Location           | `location`          | ✔️  | ✔       |
149
+| Camera             | `camera`            | ✔️  | ✔       |
150
+| Microphone         | `microphone`        | ✔️  | ✔       |
151
+| Photos             | `photo`             | ✔️  | ✔       |
152
+| Contacts           | `contacts`          | ✔️  | ✔       |
153
+| Events             | `event`             | ✔️  | ✔       |
154
+| Bluetooth          | `bluetooth`         | ✔️  | ❌      |
155
+| Reminders          | `reminder`          | ✔️  | ❌      |
156
+| Push Notifications | `notification`      | ✔️  | ❌      |
157
+| Background Refresh | `backgroundRefresh` | ✔️  | ❌      |
158
+| Speech Recognition | `speechRecognition` | ✔️  | ❌      |
159
+| Storage            | `storage`           | ❌️ | ✔       |
160
+| Phone Call         | `callPhone`         | ❌️ | ✔       |
161
+| Read SMS           | `readSms`           | ❌️ | ✔       |
162
+| Receive SMS        | `receiveSms`        | ❌️ | ✔       |
147
 
163
 
148
 ### Methods
164
 ### Methods
149
 
165
 
150
-| Method Name | Arguments | Notes
151
-|---|---|---|
152
-| `check()` | `type` | - Returns a promise with the permission status. See iOS Notes for special cases |
153
-| `request()` | `type` | - Accepts any permission type except `backgroundRefresh`. If the current status is `undetermined`, shows the permission dialog and returns a promise with the resulting status. Otherwise, immediately return a promise with the current status. See iOS Notes for special cases|
154
-| `checkMultiple()` | `[types]` | - Accepts an array of permission types and returns a promise with an object mapping permission types to statuses |
155
-| `getTypes()` | *none* | - Returns an array of valid permission types  |
156
-| `openSettings()` | *none* | - *(iOS only - 8.0 and later)* Switches the user to the settings page of your app |
157
-| `canOpenSettings()` | *none* | - *(iOS only)* Returns a boolean indicating if the device supports switching to the settings page |
166
+| Method Name         | Arguments | Notes                                                                                                                                                                                                                                                                            |
167
+| ------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
168
+| `check()`           | `type`    | - Returns a promise with the permission status. See iOS Notes for special cases                                                                                                                                                                                                  |
169
+| `request()`         | `type`    | - Accepts any permission type except `backgroundRefresh`. If the current status is `undetermined`, shows the permission dialog and returns a promise with the resulting status. Otherwise, immediately return a promise with the current status. See iOS Notes for special cases |
170
+| `checkMultiple()`   | `[types]` | - Accepts an array of permission types and returns a promise with an object mapping permission types to statuses                                                                                                                                                                 |
171
+| `getTypes()`        | _none_    | - Returns an array of valid permission types                                                                                                                                                                                                                                     |
172
+| `openSettings()`    | _none_    | - _(iOS only - 8.0 and later)_ Switches the user to the settings page of your app                                                                                                                                                                                                |
173
+| `canOpenSettings()` | _none_    | - _(iOS only)_ Returns a boolean indicating if the device supports switching to the settings page                                                                                                                                                                                |
158
 
174
 
159
 ### iOS Notes
175
 ### iOS Notes
160
 
176
 
161
-- Permission type `bluetooth` represents the status of the `CBPeripheralManager`. Don't use this if only need `CBCentralManager`
162
-- Permission type `location` accepts a second parameter for `request()` and `check()`; 
163
-the second parameter is a string, either `always` or `whenInUse` (default).
164
-- Permission type `notification` accepts a second parameter for `request()`. The second parameter is an array with the desired alert types. Any combination of `alert`, `badge` and `sound` (default requests all three).
177
+* Permission type `bluetooth` represents the status of the
178
+  `CBPeripheralManager`. Don't use this if only need `CBCentralManager`
179
+* Permission type `location` accepts a second parameter for `request()` and
180
+  `check()`; the second parameter is a string, either `always` or `whenInUse`
181
+  (default).
182
+* Permission type `notification` accepts a second parameter for `request()`. The
183
+  second parameter is an array with the desired alert types. Any combination of
184
+  `alert`, `badge` and `sound` (default requests all three).
165
 
185
 
166
 ```js
186
 ```js
167
 // example
187
 // example
168
-Permissions.check("location", "always").then(response => {
169
-  this.setState({ locationPermission: response });
170
-});
188
+Permissions.check('location', 'always').then(response => {
189
+  this.setState({ locationPermission: response })
190
+})
171
 
191
 
172
-Permissions.request("location", "always").then(response => {
173
-  this.setState({ locationPermission: response });
174
-});
192
+Permissions.request('location', 'always').then(response => {
193
+  this.setState({ locationPermission: response })
194
+})
175
 
195
 
176
-Permissions.request("notification", ["alert", "badge"]).then(response => {
177
-  this.setState({ notificationPermission: response });
178
-});
196
+Permissions.request('notification', ['alert', 'badge']).then(response => {
197
+  this.setState({ notificationPermission: response })
198
+})
179
 ```
199
 ```
180
 
200
 
181
-- You cannot request microphone permissions on the simulator.
182
-- With Xcode 8, you now need to add usage descriptions for each permission you will request. Open Xcode ➜ `Info.plist` ➜ Add a key (starting with "Privacy - ...") with your kit specific permission.
201
+* You cannot request microphone permissions on the simulator.
202
+* With Xcode 8, you now need to add usage descriptions for each permission you
203
+  will request. Open Xcode ➜ `Info.plist` ➜ Add a key (starting with "Privacy -
204
+  ...") with your kit specific permission.
183
 
205
 
184
-Example:
185
-If you need Contacts permission you have to add the key `Privacy - Contacts Usage Description`.
206
+Example: If you need Contacts permission you have to add the key `Privacy -
207
+Contacts Usage Description`.
186
 
208
 
187
 <img width="338" alt="3cde3b44-7ffd-11e6-918b-63888e33f983" src="https://cloud.githubusercontent.com/assets/1440796/18713019/271be540-8011-11e6-87fb-c3828c172dfc.png">
209
 <img width="338" alt="3cde3b44-7ffd-11e6-918b-63888e33f983" src="https://cloud.githubusercontent.com/assets/1440796/18713019/271be540-8011-11e6-87fb-c3828c172dfc.png">
188
 
210
 
189
 #### App Store submission disclaimer
211
 #### App Store submission disclaimer
190
 
212
 
191
-If you need to submit you application to the AppStore, you need to add to your `Info.plist` all `*UsageDescription` keys with a string value explaining to the user how the app uses this data. **Even if you don't use them**.
213
+If you need to submit you application to the AppStore, you need to add to your
214
+`Info.plist` all `*UsageDescription` keys with a string value explaining to the
215
+user how the app uses this data. **Even if you don't use them**.
192
 
216
 
193
-So before submitting your app to the App Store, make sure that in your `Info.plist` you have the following keys:
217
+So before submitting your app to the App Store, make sure that in your
218
+`Info.plist` you have the following keys:
194
 
219
 
195
-```
220
+```xml
196
 <key>NSBluetoothPeripheralUsageDescription</key>
221
 <key>NSBluetoothPeripheralUsageDescription</key>
197
 <string>Some description</string>
222
 <string>Some description</string>
198
 <key>NSCalendarsUsageDescription</key>
223
 <key>NSCalendarsUsageDescription</key>
207
 <string>Some description</string>
232
 <string>Some description</string>
208
 ```
233
 ```
209
 
234
 
210
-This is required because during the phase of processing in the App Store submission, the system detects that you app contains code to request the permission `X` but don't have the `UsageDescription` key and then it rejects the build.
235
+This is required because during the phase of processing in the App Store
236
+submission, the system detects that you app contains code to request the
237
+permission `X` but don't have the `UsageDescription` key and then it rejects the
238
+build.
211
 
239
 
212
-> Please note that it will only be shown to the users the usage descriptions of the permissions you really require in your app.
240
+> Please note that it will only be shown to the users the usage descriptions of
241
+> the permissions you really require in your app.
213
 
242
 
214
 You can find more informations about this issue in #46.
243
 You can find more informations about this issue in #46.
215
 
244
 
216
 ### Android Notes
245
 ### Android Notes
217
 
246
 
218
-- Uses React Native's own [`PermissionsAndroid` JS API](http://facebook.github.io/react-native/docs/permissionsandroid.html).
219
-- All required permissions also need to be included in the `AndroidManifest.xml` file before they can be requested. Otherwise `request()` will immediately return `denied`.
220
-- Permissions are automatically accepted for **targetSdkVersion < 23** but you can still use `check()` to check if the user has disabled them from Settings.
221
-- You can request write access to any of these types by also including the appropriate write permission in the `AndroidManifest.xml` file. Read more [here](https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous).
247
+* Uses React Native's own
248
+  [`PermissionsAndroid` JS API](http://facebook.github.io/react-native/docs/permissionsandroid.html).
249
+* All required permissions also need to be included in the `AndroidManifest.xml`
250
+  file before they can be requested. Otherwise `request()` will immediately
251
+  return `denied`.
252
+* You can request write access to any of these types by also including the
253
+  appropriate write permission in the `AndroidManifest.xml` file. Read more
254
+  [here](https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous).
255
+* Permissions are automatically accepted for **targetSdkVersion < 23** but you
256
+  can still use `check()` to check if the user has disabled them from Settings.
257
+
258
+You might need to elevate the **targetSdkVersion** version in your
259
+`build.gradle`:
260
+
261
+```groovy
262
+android {
263
+  compileSdkVersion 23 // ← set at least 23
264
+  buildToolsVersion "23.0.1"  // ← set at least 23.0.0
265
+
266
+  defaultConfig {
267
+    minSdkVersion 16
268
+    targetSdkVersion 23 // ← set at least 23
269
+    // ...
270
+```
222
 
271
 
223
 ## Troubleshooting
272
 ## Troubleshooting
224
 
273
 
225
 #### Q: iOS - App crashes as soon as I request permission
274
 #### Q: iOS - App crashes as soon as I request permission
226
-> A: Starting with Xcode 8, you need to add permission descriptions. See iOS notes for more details. Thanks to [@jesperlndk](https://github.com/jesperlndk) for discovering this.
275
+
276
+> A: Starting with Xcode 8, you need to add permission descriptions. See iOS
277
+> notes for more details. Thanks to [@jesperlndk](https://github.com/jesperlndk)
278
+> for discovering this.
227
 
279
 
228
 #### Q: iOS - App crashes when I change permission from settings
280
 #### Q: iOS - App crashes when I change permission from settings
229
-> A: This is normal. iOS restarts your app when your privacy settings change. Just google "iOS crash permission change"
281
+
282
+> A: This is normal. iOS restarts your app when your privacy settings change.
283
+> Just google "iOS crash permission change"

+ 23
- 23
example/ios/Example/Images.xcassets/AppIcon.appiconset/Contents.json View File

1
 {
1
 {
2
-  "images" : [
2
+  "images": [
3
     {
3
     {
4
-      "idiom" : "iphone",
5
-      "size" : "29x29",
6
-      "scale" : "2x"
4
+      "idiom": "iphone",
5
+      "size": "29x29",
6
+      "scale": "2x"
7
     },
7
     },
8
     {
8
     {
9
-      "idiom" : "iphone",
10
-      "size" : "29x29",
11
-      "scale" : "3x"
9
+      "idiom": "iphone",
10
+      "size": "29x29",
11
+      "scale": "3x"
12
     },
12
     },
13
     {
13
     {
14
-      "idiom" : "iphone",
15
-      "size" : "40x40",
16
-      "scale" : "2x"
14
+      "idiom": "iphone",
15
+      "size": "40x40",
16
+      "scale": "2x"
17
     },
17
     },
18
     {
18
     {
19
-      "idiom" : "iphone",
20
-      "size" : "40x40",
21
-      "scale" : "3x"
19
+      "idiom": "iphone",
20
+      "size": "40x40",
21
+      "scale": "3x"
22
     },
22
     },
23
     {
23
     {
24
-      "idiom" : "iphone",
25
-      "size" : "60x60",
26
-      "scale" : "2x"
24
+      "idiom": "iphone",
25
+      "size": "60x60",
26
+      "scale": "2x"
27
     },
27
     },
28
     {
28
     {
29
-      "idiom" : "iphone",
30
-      "size" : "60x60",
31
-      "scale" : "3x"
29
+      "idiom": "iphone",
30
+      "size": "60x60",
31
+      "scale": "3x"
32
     }
32
     }
33
   ],
33
   ],
34
-  "info" : {
35
-    "version" : 1,
36
-    "author" : "xcode"
34
+  "info": {
35
+    "version": 1,
36
+    "author": "xcode"
37
   }
37
   }
38
-}
38
+}

+ 4
- 11
package.json View File

4
   "description": "Check user permissions in React Native",
4
   "description": "Check user permissions in React Native",
5
   "author": "Yonah Forst <yonaforst@hotmail.com>",
5
   "author": "Yonah Forst <yonaforst@hotmail.com>",
6
   "homepage": "https://github.com/yonahforst/react-native-permissions",
6
   "homepage": "https://github.com/yonahforst/react-native-permissions",
7
-  "main": "index",
7
+  "keywords": ["react-native", "react-permissions", "permissions"],
8
+  "main": "index.js",
8
   "license": "MIT",
9
   "license": "MIT",
9
-  "keywords": [
10
-    "react-native",
11
-    "react-permissions",
12
-    "permissions"
13
-  ],
14
   "repository": {
10
   "repository": {
15
     "type": "git",
11
     "type": "git",
16
     "url": "https://github.com/yonahforst/react-native-permissions.git"
12
     "url": "https://github.com/yonahforst/react-native-permissions.git"
17
   },
13
   },
18
   "scripts": {
14
   "scripts": {
19
     "precommit": "lint-staged",
15
     "precommit": "lint-staged",
20
-    "prettier": "prettier --write '**/*.js'"
16
+    "prettier": "prettier --write '**/*.{js,json,md}'"
21
   },
17
   },
22
   "lint-staged": {
18
   "lint-staged": {
23
-    "**/*.js": [
24
-      "prettier --write",
25
-      "git add"
26
-    ]
19
+    "**/*.{js,json,md}": ["prettier --write", "git add"]
27
   },
20
   },
28
   "devDependencies": {
21
   "devDependencies": {
29
     "husky": "^0.14.3",
22
     "husky": "^0.14.3",