Mathieu Acthernoene 5 лет назад
Родитель
Сommit
df0b484a93
No account linked to committer's email address
1 измененных файлов: 106 добавлений и 1 удалений
  1. 106
    1
      README.md

+ 106
- 1
README.md Просмотреть файл

66
 <details>
66
 <details>
67
   <summary>👀 See manual linking instructions</summary>
67
   <summary>👀 See manual linking instructions</summary>
68
 
68
 
69
-#### iOS
69
+### iOS
70
 
70
 
71
 Add this line to your `ios/Podfile` file, then run `pod install`.
71
 Add this line to your `ios/Podfile` file, then run `pod install`.
72
 
72
 
116
   // …
116
   // …
117
 }
117
 }
118
 ```
118
 ```
119
+
119
 </details>
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
 ## API
226
 ## API
122
 
227
 
123
 ### Permissions statuses
228
 ### Permissions statuses