This differential makes NSE send Darwin Notification to AppDelegate when it receives the notif. AppDelegate reacts by consuming the flat file and sending event to JS to persist message infos.
Details
Build the app. Background it. Send notification. Kill the keyserver (debug)/turn off network connection (release). Foreground the app. App is dosconnected from the keyserver but the message is visible in the app.
Diff Detail
- Repository
- rCOMM Comm
- Branch
- marcin/eng-3363
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
native/ios/Comm/AppDelegate.mm | ||
---|---|---|
320–327 ↗ | (On Diff #24566) | Is it possible that a message will be saved twice to the db? Once in this function, and once when the JS receives it? |
native/ios/Comm/AppDelegate.mm | ||
---|---|---|
320–327 ↗ | (On Diff #24566) | I think it's fine for this to happen... it already happens in several cases in our codebase:
Of course if it's easy to avoid, it doesn't hurt to avoid. In this case, we could potentially pass some sort of flag to the SAVE_MESSAGE_INFOS Redux action that tells it to update Redux without committing the results to SQLite. I'm not sure how much value that has or how complicated it might be. Defer to you and @marcin to discuss tradeoffs. |
native/ios/Comm/AppDelegate.mm | ||
---|---|---|
320–327 ↗ | (On Diff #24566) | Adding a flag to SAVE_MESSAGE_INFOS action should be feasible but I also can't see a strong benefit of doing so. Double write is a common case in our codebase and even with this flag we wouldn't mitigate it entirely. Additionally we already landed immediate message infos persistence on Android where double write occurs as well and we didn't raise any concerns about this. |
I'm not too familiar with this logic, but seems reasonable.
native/ios/Comm/AppDelegate.mm | ||
---|---|---|
320–327 ↗ | (On Diff #24566) | Ok, makes sense, let's keep it. |