Kaynağa Gözat

Add flowcharts

Mathieu Acthernoene 5 yıl önce
ebeveyn
işleme
df0b484a93
No account linked to committer's email address
1 değiştirilmiş dosya ile 106 ekleme ve 1 silme
  1. 106
    1
      README.md

+ 106
- 1
README.md Dosyayı Görüntüle

@@ -66,7 +66,7 @@ Because this package targets React Native 0.60+, you will probably don't need to
66 66
 <details>
67 67
   <summary>👀 See manual linking instructions</summary>
68 68
 
69
-#### iOS
69
+### iOS
70 70
 
71 71
 Add this line to your `ios/Podfile` file, then run `pod install`.
72 72
 
@@ -116,8 +116,113 @@ public class MainApplication extends Application implements ReactApplication {
116 116
   // …
117 117
 }
118 118
 ```
119
+
119 120
 </details>
120 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
+
121 226
 ## API
122 227
 
123 228
 ### Permissions statuses