mattermost-mobile/app
Amit Uttam 725992941c
[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-03-31 20:01:13 -07:00
..
actions [MM-22671] [MM-22935] Fetch posts for unread channels on loadChannelsForTeam (#4078) 2020-03-31 18:41:11 -03:00
client Port WebSocket from mm-redux and batch actions (#4060) 2020-03-26 21:23:50 -03:00
components [MM-23708] Send HW key pressed event only when a HW keyboard is connected (#4100) 2020-03-31 21:43:18 -03:00
constants [MM-23520] Port mattermost-redux (#4088) 2020-03-31 11:09:26 -07:00
i18n MM-21961 Fix Incorrect Timestamp on Android Mobile App (#3861) 2020-01-27 12:57:22 -07:00
init [MM-23520] Port mattermost-redux (#4088) 2020-03-31 11:09:26 -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
mm-redux [MM-22671] [MM-22935] Fetch posts for unread channels on loadChannelsForTeam (#4078) 2020-03-31 18:41:11 -03:00
notification_preferences Deps update (#3806) 2020-01-20 13:20:03 -03:00
push_notifications Fix app hanging when switching to a team after opening push notification (#4013) 2020-03-05 09:52:56 -07:00
reducers [MM-23490] Save state to file via async middleware vs store subscription (#4059) 2020-03-31 20:01:13 -07:00
screens [MM-23520] Port mattermost-redux (#4088) 2020-03-31 11:09:26 -07:00
selectors [MM-23520] Port mattermost-redux (#4088) 2020-03-31 11:09:26 -07:00
store [MM-23490] Save state to file via async middleware vs store subscription (#4059) 2020-03-31 20:01:13 -07: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-22671] [MM-22935] Fetch posts for unread channels on loadChannelsForTeam (#4078) 2020-03-31 18:41:11 -03:00
initial_state.js [MM-23490] Save state to file via async middleware vs store subscription (#4059) 2020-03-31 20:01:13 -07:00
mattermost.js [MM-23520] Port mattermost-redux (#4088) 2020-03-31 11:09:26 -07:00