Pārlūkot izejas kodu

Merge branch '2.0.0' of github.com:react-native-community/react-native-permissions into 2.0.0

Mathieu Acthernoene 4 gadus atpakaļ
vecāks
revīzija
b4887cbea6
1 mainītis faili ar 104 papildinājumiem un 104 dzēšanām
  1. 104
    104
      README.md

+ 104
- 104
README.md Parādīt failu

@@ -119,110 +119,6 @@ public class MainApplication extends Application implements ReactApplication {
119 119
 
120 120
 </details>
121 121
 
122
-## Permission lifecycles
123
-
124
-Permission are not handled in the same way on iOS and Android. This library provides an abstraction over the platforms behaviors. To understand it a little better, have a look to these two flowcharts:
125
-
126
-### iOS
127
-
128
-```
129
-   ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
130
-   ┃ check(PERMISSIONS.IOS.CAMERA) ┃
131
-   ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
132
-                   │
133
-       Is the feature available
134
-           on this device ?
135
-                   │           ╔════╗
136
-                   ├───────────║ NO ║──────────────┐
137
-                   │           ╚════╝              │
138
-                ╔═════╗                            ▼
139
-                ║ YES ║                 ┌─────────────────────┐
140
-                ╚═════╝                 │ RESULTS.UNAVAILABLE │
141
-                   │                    └─────────────────────┘
142
-           Is the permission
143
-             requestable ?
144
-                   │           ╔════╗
145
-                   ├───────────║ NO ║──────────────┐
146
-                   │           ╚════╝              │
147
-                ╔═════╗                            ▼
148
-                ║ YES ║                  ┌───────────────────┐
149
-                ╚═════╝                  │ RESULTS.BLOCKED / │
150
-                   │                     │  RESULTS.GRANTED  │
151
-                   ▼                     └───────────────────┘
152
-          ┌────────────────┐
153
-          │ RESULTS.DENIED │
154
-          └────────────────┘
155
-                   │
156
-                   ▼
157
-  ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
158
-  ┃ request(PERMISSIONS.IOS.CAMERA) ┃
159
-  ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
160
-                   │
161
-        Does the user accepted
162
-            the request ?
163
-                   │           ╔════╗
164
-                   ├───────────║ NO ║──────────────┐
165
-                   │           ╚════╝              │
166
-                ╔═════╗                            ▼
167
-                ║ YES ║                   ┌─────────────────┐
168
-                ╚═════╝                   │ RESULTS.BLOCKED │
169
-                   │                      └─────────────────┘
170
-                   ▼
171
-          ┌─────────────────┐
172
-          │ RESULTS.GRANTED │
173
-          └─────────────────┘
174
-```
175
-
176
-### Android
177
-
178
-```
179
- ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
180
- ┃ check(PERMISSIONS.ANDROID.CAMERA) ┃
181
- ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
182
-                   │
183
-       Is the feature available
184
-           on this device ?
185
-                   │           ╔════╗
186
-                   ├───────────║ NO ║──────────────┐
187
-                   │           ╚════╝              │
188
-                ╔═════╗                            ▼
189
-                ║ YES ║                 ┌─────────────────────┐
190
-                ╚═════╝                 │ RESULTS.UNAVAILABLE │
191
-                   │                    └─────────────────────┘
192
-           Is the permission
193
-             requestable ?
194
-                   │           ╔════╗
195
-                   ├───────────║ NO ║──────────────┐
196
-                   │           ╚════╝              │
197
-                ╔═════╗                            ▼
198
-                ║ YES ║                  ┌───────────────────┐
199
-                ╚═════╝                  │ RESULTS.BLOCKED / │
200
-                   │                     │  RESULTS.GRANTED  │
201
-                   ▼                     └───────────────────┘
202
-          ┌────────────────┐
203
-          │ RESULTS.DENIED │◀──────────────────────┐
204
-          └────────────────┘                       │
205
-                   │                               │
206
-                   ▼                               │
207
-┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓         ╔════╗
208
-┃ request(PERMISSIONS.ANDROID.CAMERA) ┃         ║ NO ║
209
-┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛         ╚════╝
210
-                   │                               │
211
-        Does the user accepted                     │
212
-            the request ?                          │
213
-                   │           ╔════╗    Does the user checked
214
-                   ├───────────║ NO ║─────"Never ask again" ?
215
-                   │           ╚════╝              │
216
-                ╔═════╗                         ╔═════╗
217
-                ║ YES ║                         ║ YES ║
218
-                ╚═════╝                         ╚═════╝
219
-                   │                               │
220
-                   ▼                               ▼
221
-          ┌─────────────────┐             ┌─────────────────┐
222
-          │ RESULTS.GRANTED │             │ RESULTS.BLOCKED │
223
-          └─────────────────┘             └─────────────────┘
224
-```
225
-
226 122
 ## API
227 123
 
228 124
 ### Permissions statuses
@@ -454,3 +350,107 @@ import {openSettings} from 'react-native-permissions';
454 350
 
455 351
 openSettings().catch(() => console.warn('cannot open settings'));
456 352
 ```
353
+
354
+## Understanding lifecycle
355
+
356
+As permissions are not handled in the same way on iOS and Android, this library provides an abstraction over the two platforms behaviors. To understand it a little better, have a look to these two flowcharts:
357
+
358
+### iOS
359
+
360
+```
361
+   ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
362
+   ┃ check(PERMISSIONS.IOS.CAMERA) ┃
363
+   ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
364
+                   │
365
+       Is the feature available
366
+           on this device ?
367
+                   │           ╔════╗
368
+                   ├───────────║ NO ║──────────────┐
369
+                   │           ╚════╝              │
370
+                ╔═════╗                            ▼
371
+                ║ YES ║                 ┌─────────────────────┐
372
+                ╚═════╝                 │ RESULTS.UNAVAILABLE │
373
+                   │                    └─────────────────────┘
374
+           Is the permission
375
+             requestable ?
376
+                   │           ╔════╗
377
+                   ├───────────║ NO ║──────────────┐
378
+                   │           ╚════╝              │
379
+                ╔═════╗                            ▼
380
+                ║ YES ║                  ┌───────────────────┐
381
+                ╚═════╝                  │ RESULTS.BLOCKED / │
382
+                   │                     │  RESULTS.GRANTED  │
383
+                   ▼                     └───────────────────┘
384
+          ┌────────────────┐
385
+          │ RESULTS.DENIED │
386
+          └────────────────┘
387
+                   │
388
+                   ▼
389
+  ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
390
+  ┃ request(PERMISSIONS.IOS.CAMERA) ┃
391
+  ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
392
+                   │
393
+        Does the user accepted
394
+            the request ?
395
+                   │           ╔════╗
396
+                   ├───────────║ NO ║──────────────┐
397
+                   │           ╚════╝              │
398
+                ╔═════╗                            ▼
399
+                ║ YES ║                   ┌─────────────────┐
400
+                ╚═════╝                   │ RESULTS.BLOCKED │
401
+                   │                      └─────────────────┘
402
+                   ▼
403
+          ┌─────────────────┐
404
+          │ RESULTS.GRANTED │
405
+          └─────────────────┘
406
+```
407
+
408
+### Android
409
+
410
+```
411
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
412
+ ┃ check(PERMISSIONS.ANDROID.CAMERA) ┃
413
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
414
+                   │
415
+       Is the feature available
416
+           on this device ?
417
+                   │           ╔════╗
418
+                   ├───────────║ NO ║──────────────┐
419
+                   │           ╚════╝              │
420
+                ╔═════╗                            ▼
421
+                ║ YES ║                 ┌─────────────────────┐
422
+                ╚═════╝                 │ RESULTS.UNAVAILABLE │
423
+                   │                    └─────────────────────┘
424
+           Is the permission
425
+             requestable ?
426
+                   │           ╔════╗
427
+                   ├───────────║ NO ║──────────────┐
428
+                   │           ╚════╝              │
429
+                ╔═════╗                            ▼
430
+                ║ YES ║                  ┌───────────────────┐
431
+                ╚═════╝                  │ RESULTS.BLOCKED / │
432
+                   │                     │  RESULTS.GRANTED  │
433
+                   ▼                     └───────────────────┘
434
+          ┌────────────────┐
435
+          │ RESULTS.DENIED │◀──────────────────────┐
436
+          └────────────────┘                       │
437
+                   │                               │
438
+                   ▼                               │
439
+┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓         ╔════╗
440
+┃ request(PERMISSIONS.ANDROID.CAMERA) ┃         ║ NO ║
441
+┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛         ╚════╝
442
+                   │                               │
443
+        Does the user accepted                     │
444
+            the request ?                          │
445
+                   │           ╔════╗    Does the user checked
446
+                   ├───────────║ NO ║─────"Never ask again" ?
447
+                   │           ╚════╝              │
448
+                ╔═════╗                         ╔═════╗
449
+                ║ YES ║                         ║ YES ║
450
+                ╚═════╝                         ╚═════╝
451
+                   │                               │
452
+                   ▼                               ▼
453
+          ┌─────────────────┐             ┌─────────────────┐
454
+          │ RESULTS.GRANTED │             │ RESULTS.BLOCKED │
455
+          └─────────────────┘             └─────────────────┘
456
+```