mattermost-mobile-upstream/app/constants/network.ts
Carlos Garcia 3bb8ee76dc
Mm 68326 file cleanup v2 (#9756)
* offline mode detection for Mobile Ephemeral Mode

Adds per-server offline detection gated by the server-pushed
MobileEphemeralMode* config. When the feature is enabled and the
WebSocket stays disconnected in the foreground for longer than
DisconnectionTimeoutSeconds, the server is flagged as offline.

Only foreground-observed disconnections start the timer (WS closes
while backgrounded are ignored). The disconnect timestamp is
persisted in the server DB System table so elapsed time survives
app kill.

* offline timer fire and listen showing temporary alert

When a server has been offline for OfflinePersistenceTimerHours,
fires the purge-due event and shows a temporary Alert dialog

* reconnect helper for ephemeral mode reconnection support after a purge

* Offline data wiped screen offering description and reconnect options

* wipe listener installed and data erased on offline timeout

* fixes reconnection not initializing clients

* error clearing when going to foreground for erased data screen

* merges producer and consumer into offline persistence manager

* leave an empty database after wipe and show server list in data erased screen

* removes not needed purge fired flag and refactors offline manager init

* removes unused code

* users new persistence flag app database property

* fix loading spinner not ending on reconnection after purge

* adapt code to use expo router and fix some issues

* awaits for server database deletion to succeed

* delete files, notifications and cached artifacts during purge

* change async to sync delete files calls

* keep identifier on offline purges

* clear push notifications on server database purge firing

* new copy for data cleared screen

* upgrade jest-stare to 2.5.3 to fix E2E crash on Node 24

* apply coderabbit suggestions

* move Http Unauthorized status code to a common constant

* fires server logout in case of unauthorized during reconnection

* moves reconnect from local to remote actions

* make addServer private

* reuse Servers component to render server list in data erased screen

* changes wrong font size in data erased screen

* improve db system setters for ephemeral mode related values
2026-05-22 19:48:29 +02:00

22 lines
567 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {toMilliseconds} from '@utils/datetime';
import keyMirror from '@utils/key_mirror';
export const CERTIFICATE_ERRORS = keyMirror({
CLIENT_CERTIFICATE_IMPORT_ERROR: null,
CLIENT_CERTIFICATE_MISSING: null,
SERVER_INVALID_CERTIFICATE: null,
});
export const DOWNLOAD_TIMEOUT = toMilliseconds({minutes: 10});
export const HTTP_UNAUTHORIZED = 401;
export default {
CERTIFICATE_ERRORS,
DOWNLOAD_TIMEOUT,
HTTP_UNAUTHORIZED,
};