-
Notifications
You must be signed in to change notification settings - Fork 19
Offline workflow
Zachary McCoy edited this page Oct 5, 2019
·
3 revisions
ONLINE | OFFLINE |
---|---|
1. Auto RefreshControl | 1. Auto RefreshControl |
2. API Request: GET List | 2. API Request: GET List (IGNORED) |
3. Render List from State | 3. No state change, no re-render, List remains same |
4. API Response: Update State | |
5. Render List from State (UI event to signify update) |
ONLINE | OFFLINE |
---|---|
1. Update State w/ Contact/Group data AND Temporary ID | 1. Update State w/ Contact/Group data AND Temporary ID |
2. API Request: POST Contact/Group | 2. API Request: POST Contact/Group (Queued for later) |
3. Display Notification to User | 3. Display Notification to User |
4. API Response: Update State (replace Temp. ID) | 4. API Response: Update State (replace Temp. ID) (in future when ONLINE) |
ONLINE | OFFLINE (exists only locally) | OFFLINE (+ exists in remote D.T API) |
---|---|---|
1. Update State w/ Contact/Group data (D.T ID) | 1. Update State w/ Contact/Group data (Temporary ID) | 1. Update State w/ Contact/Group data (D.T ID if exists, else Temporary ID) |
2. API Request: POST Contact/Group data | 2. API Request: POST Contact/Group data (Queued for later) Remove any existing POST Request w/ same Temp. ID in REQUEST Queue UNLESS it is the CREATE Request
|
2. API Request: POST Contact/Group data (Queued for later) Remove any existing POST Request w/ same ID in REQUEST Queue
|
3. Display Notification to User | 3. Display Notification to User | 3. Display Notification to User |
4. API Response: Update State (Not necessary to handle API Response bc we're pushing latest State, but we could for consistency sake) |
4. API Response: Update State (replace Temp. ID, when Create request) (Not necessary to handle API Response bc we're pushing latest State, but we could for consistency sake) |
4. API Response: Update State (Not necessary to handle API Response bc we're pushing latest State, but we could for consistency sake) |
ONLINE | OFFLINE | OFFLINE (never before online) |
---|---|---|
1. Check whether local cache contains active JWT Token | 1. Check whether local cache contains active JWT Token | 1. Check whether local cache contains active JWT Token |
2a. If YES , then Navigate to CONTACTS Screen |
2a. If YES , then Navigate to CONTACTS Screen |
2. Enter PIN #, then Navigate to CONTACTS Screen |
2b. If NO , then Navigate to LOGIN Screen |
2b. If NO , Enter PIN #, then Navigate to HOME Screen |
|
3. API Request: POST JWT-Auth | ||
4. API Response: Update State (local JWT cache) |
- Must be ONLINE at some point to download the App (unless sideloading, but we won't consider this case)
- "Sync" app upon every ONLINE usage (issue behind the scenes GET request to pull all possible options values)
How to handle any sort of whitelabeling (i.e., organizational-specific icons/theme, language-specific icons)?
- same as handling of option values (above)
- TBD
-
Android: No limit, when using: redux-persist-filesystem-storage. Otherwise,
AsyncStorage
has a 6MB default (https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/modules/storage/ReactDatabaseSupplier.java#L47) -
iOS: No limit (https://stackoverflow.com/questions/1897034/max-disk-space-an-iphone-app-can-use/1897383#1897383), bc "on iOS,
AsyncStorage
is backed by native code that stores small values in a serialized dictionary and larger values in separate files" (https://facebook.github.io/react-native/docs/asyncstorage.html)