mattermost-mobile-upstream/app/constants
Guillermo Vayá 62c694adeb feat(drafts): Phase 5 — WebSocket + lifecycle triggers make sync live
Wires the DraftSyncManager's reconcile/WS entry points (previously defined
but never called in production) into the app's WebSocket and lifecycle flow.
Design choice: WS draft events are treated as CHANGE SIGNALS that trigger an
authoritative GET reconcile of the current team, not applied directly — this
reuses Phase 4's matrix/scope/absence/observation-fence, and the server's
silent empty-upsert delete (no event) forces GET-reconciliation regardless.
The current-team GET also returns the user's DM/GM drafts, so it converges
them too; other teams' channel drafts converge on team switch.

Triggers:
- draft_created / draft_deleted WS events -> enqueue -> reconcile current team
  (constants + app/actions/websocket/draft.ts handler + event dispatch cases).
- Reconnect/first-connect: requestReconcile in doReconnect after entry batches.
- Team switch: requestReconcile in handleTeamChange (before the tablet early
  return, so both paths fire).
- Foreground: WebsocketManager forwards app-active to DraftSyncManager.onForeground
  (covers a socket that stayed open, so no reconnect fired). No second AppState
  listener is added.
- Capability change: handleCapabilityChange after config (AllowSyncedDrafts) and
  after sync_drafts preference create/update/delete batches.

Also adds a central empty-team guard in requestReconcile (the GET is per-team).

Deferred (noted for a follow-up): Global Drafts stale-on-open reconcile (touches
a screen, needs on-device verification); direct-apply of buffered WS events (the
buffer is retained, reserved for that future optimization).

tsc + eslint clean; new/updated unit tests across manager, ws handler, event
dispatch, reconnect, team switch, config/preference capability. All affected
suites green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-15 16:50:19 +02:00
..
about_links.ts [MM-67869] Update mobile feedback flow (#9668) 2026-04-08 10:41:02 -04:00
action_type.ts Feature schedule posts (#8509) 2025-04-14 22:08:59 +05:30
apps.ts Add date/datetime field support with timezone features for Apps Forms (#9521) 2026-07-16 08:09:47 -06:00
autocomplete.test.ts [MM-49540] Message Priority Phase 3 (#7142) 2023-04-27 11:22:03 +00:00
autocomplete.ts Fix cannot search user when pressing space (#7486) 2023-08-09 11:38:06 +02:00
calls.ts Remove long deprecated Calls code (#8747) 2025-05-15 18:20:45 +02:00
categories.ts [MM-68255] Enable mobile support for Managed Categories (#9683) 2026-04-16 10:01:51 -04:00
channel.ts Add BoardView, PropertyField, PropertyValue WatermelonDB tables (#9708) 2026-06-01 12:46:40 +02:00
classification.ts MM-68208 Implementing global and channel-level banners on mobile (#9752) 2026-07-08 12:47:01 +03:00
config.ts [Gekidou MM-41093] CRT - WS Events, Actions, Queries, Thread Follow, Post Query (#6075) 2022-04-04 19:55:13 +05:30
custom_status.ts Remove tand prevent double tap (#9078) 2025-08-25 12:03:01 +02:00
database.ts feat(drafts): Phase 1 synchronized-drafts storage foundation 2026-07-23 16:18:48 +02:00
datetime.ts Gekidou CRT - Global threads screen (#6140) 2022-04-28 09:01:36 -04:00
deep_linking.ts Easy Login (#9261) 2025-11-20 12:38:06 +01:00
device.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
draft.ts feat(drafts): Phase 3.4 — DraftSyncManager shell (no draining) 2026-07-27 14:49:31 +02:00
emoji.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
events.ts [MM-68315] Add autorecovery for database corruptions (#9900) 2026-07-13 18:02:35 +02:00
files.ts Ability to show quick action and add files to edit post (#8926) 2025-06-25 16:04:08 +05:30
gallery.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
general.ts Add BoardView, PropertyField, PropertyValue WatermelonDB tables (#9708) 2026-06-01 12:46:40 +02:00
image.ts fix: fixed image overflow in message attachments (#8361) 2024-12-06 08:27:42 +02:00
index.ts [MM-60405] Crossteam search (#8411) 2025-02-05 13:46:38 -07:00
integrations.ts Add AppsForm and Interactive Dialogs (#6142) 2022-04-28 18:26:21 +02:00
launch.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
license.ts MM-68200 About modal updates to show correct SKU and align with web (#9662) 2026-04-16 09:10:41 -04:00
list.ts [Gekidou] Sidebar Categories FlatList Optimisations (#6031) 2022-03-08 18:16:58 -03:00
members.ts [Gekidou - MM-47653] Implement Manage Members Screen (#6771) 2023-02-03 10:42:12 +02:00
navigation.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
network.ts Mm 68326 file cleanup v2 (#9756) 2026-05-22 19:48:29 +02:00
notification_level.ts Add GM as DM feature support (#7515) 2023-09-26 18:35:40 +02:00
permissions.ts [MM-67923] Add channel settings for shared channels (#9591) 2026-04-14 11:43:44 +02:00
post_draft.ts Extra keyboard (#8348) 2024-11-29 11:58:13 +08:00
post.ts [MM-68273] Add support for shared/unshared system messages (#9700) 2026-05-11 12:22:10 +02:00
preferences.ts feat(drafts): Phase 2 — draft sync API DTOs, REST client, normalization, capability 2026-07-24 11:49:47 +02:00
profile.ts MM-40364 [Gekidou] - Image Picker for Edit Profile (#5901) 2022-01-28 16:06:50 +04:00
push_notification.ts Fix MM 56723 (#7883) 2024-04-24 17:12:56 +02:00
push_proxy.ts [Gekidou] [MM-41837] Add verification for push proxy and related interface (#6192) 2022-05-09 11:41:16 +02:00
reaction_picker.ts BottomSheet migration to react-native-bottom-sheet (#6907) 2023-01-05 09:51:51 +02:00
report_a_problem.ts Report a problem not redirect to default email application (#9703) 2026-05-14 09:10:39 -04:00
screens.ts Mattermost Blocks (#9764) 2026-06-29 18:42:16 +02:00
server_errors.ts Displayed channel related error with name field 2023-11-16 17:06:39 +05:30
snack_bar.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
sso.ts Update the value for login type (#9329) 2025-12-12 16:26:22 +01:00
supported_server.ts Update MIN_REQUIRED_VERSION (#9825) 2026-06-11 08:57:20 +08:00
team.ts [MM-60405] Crossteam search (#8411) 2025-02-05 13:46:38 -07:00
tooltip.ts Fix scheduled messages tooltip entering an infinite resize loop (#8877) 2025-05-23 13:05:31 +02:00
tutorial.ts Feature schedule posts (#8509) 2025-04-14 22:08:59 +05:30
versions.ts copy channel purpose text implemented (#7586) 2023-10-09 18:36:56 +02:00
view.ts MM-68208 Implementing global and channel-level banners on mobile (#9752) 2026-07-08 12:47:01 +03:00
websocket.ts feat(drafts): Phase 5 — WebSocket + lifecycle triggers make sync live 2026-08-15 16:50:19 +02:00