mattermost-mobile/app
Amit Uttam 1d7149a26d
[MM-23490] Save state to file via async middleware vs store subscription (#4059)
MM-23490 Save state to file via async middleware vs store subscription

Currently for iOS, a subset of store state is saved to an on-device file, so that the Share Extension can have access to information it needs (teams and channels) to function.

This file saving would happen via a store subscription which triggers a file save for every dispatched action. By moving this logic to a middleware function, when this function gets invoked is now limited to a configurable set of action dispatches. (e.g. `LOGIN`, `CONNECTION_CHANGED`, `WEBSOCKET_SUCCESS`), etc.

MM-23493 Move app cache purge from store subscription to middleware (#4069)

* MM-23493 Move app cache purge from store subscription to middleware

This commit exposes persistence configuration as a static reference, so that cache purging can be invoked on demand anywhere else in the codebase.
While middleware still may not be the best spot for this singular "action", existing functionality (reacting to `OFFLINE_STORE_PURGE`) is maintained.

The change also removes the need for `state.views.root.purge` to exist in the state tree.

* PR feedback: Inject config dependency for purging app cache

Previously, `middleware` imported the config back from `store` (i.e. cyclic import).

* PR feedback: No need to export config, now that it's passed as argument

* Fix tests after refactoring middleware call from array -> function

* PR feedback: Let parent continue to pass down initial store state
2020-04-17 20:37:13 -03:00
..
actions Fix post in channel batching order (#4089) 2020-03-30 15:02:35 -03:00
components Automated cherry pick of #4125 (#4170) 2020-04-17 15:59:32 -07:00
constants Fix Message attachment actions colors on dark themes (#4065) 2020-03-23 22:20:22 -03:00
i18n MM-21961 Fix Incorrect Timestamp on Android Mobile App (#3861) 2020-01-27 12:57:22 -07:00
init Automated cherry pick of #4165 (#4166) 2020-04-16 19:28:14 -07:00
mattermost_bucket iOS Native Share Extension (Swift) (#2575) 2019-02-26 14:31:57 -03:00
mattermost_managed Re-enable ram-bundles (#3907) 2020-02-10 11:20:45 -07:00
notification_preferences Deps update (#3806) 2020-01-20 13:20:03 -03:00
push_notifications Don't subtract from badge count (#4136) 2020-04-09 11:23:28 -07:00
reducers [MM-23490] Save state to file via async middleware vs store subscription (#4059) 2020-04-17 20:37:13 -03:00
screens Automated cherry pick of #4067 (#4071) 2020-03-24 13:43:12 -03:00
selectors MM-21723 Handle deep link errors to inaccessible teams, channels & permalinks (#3815) 2020-01-21 14:43:24 -03:00
store [MM-23490] Save state to file via async middleware vs store subscription (#4059) 2020-04-17 20:37:13 -03:00
styles MM-19696 Added font color for GlobalStyle Input (#3536) 2019-11-15 17:25:25 +08:00
telemetry [MM-17560] Await dismissAllModals and popToRoot prior to calling showSearchModal (#3298) 2019-09-25 15:23:45 -07:00
utils MM-24202 Add ability to invalidate specific versions (#4158) 2020-04-16 08:53:20 -04:00
initial_state.js [MM-23490] Save state to file via async middleware vs store subscription (#4059) 2020-04-17 20:37:13 -03:00
mattermost.js MM-24202 Add ability to invalidate specific versions (#4158) 2020-04-16 08:53:20 -04:00