Skip to content

Commit df0b484

Browse files
authored
Add flowcharts
1 parent fb110e9 commit df0b484

File tree

1 file changed

+106
-1
lines changed

1 file changed

+106
-1
lines changed

README.md

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Because this package targets React Native 0.60+, you will probably don't need to
6666
<details>
6767
<summary>👀 See manual linking instructions</summary>
6868

69-
#### iOS
69+
### iOS
7070

7171
Add this line to your `ios/Podfile` file, then run `pod install`.
7272

@@ -116,8 +116,113 @@ public class MainApplication extends Application implements ReactApplication {
116116
//
117117
}
118118
```
119+
119120
</details>
120121

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+
121226
## API
122227

123228
### Permissions statuses

0 commit comments

Comments
 (0)