* Revert "feat(MM-65625): low connectivity feature toggle in advance settings (#9191)" This reverts commitc872e2e2b1. * Revert "feat(MM-65145): Network connectivity/performance observer (#9173)" This reverts commit597e03d7d8. * Revert "feat(MM-65625): floating banner (#9162)" This reverts commit5887c3ab46. * Revert "feat(MM-65625): enhance navigation overlay management (#9165)" This reverts commitf1554f0341. * revert advanced.test.tsx changes
71 lines
2.3 KiB
TypeScript
71 lines
2.3 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {CallsManager} from '@calls/calls_manager';
|
|
import DatabaseManager from '@database/manager';
|
|
import {getAllServerCredentials} from '@init/credentials';
|
|
import {initialLaunch} from '@init/launch';
|
|
import ManagedApp from '@init/managed_app';
|
|
import PushNotifications from '@init/push_notifications';
|
|
import GlobalEventHandler from '@managers/global_event_handler';
|
|
import NetworkManager from '@managers/network_manager';
|
|
import SessionManager from '@managers/session_manager';
|
|
import WebsocketManager from '@managers/websocket_manager';
|
|
import {registerScreens} from '@screens/index';
|
|
import {registerNavigationListeners} from '@screens/navigation';
|
|
import EphemeralStore from '@store/ephemeral_store';
|
|
import NavigationStore from '@store/navigation_store';
|
|
|
|
// Controls whether the main initialization (database, etc...) is done, either on app launch
|
|
// or on the Share Extension, for example.
|
|
let baseAppInitialized = false;
|
|
|
|
let serverCredentials: ServerCredential[];
|
|
|
|
// Fallback Polyfill for Promise.allSettle
|
|
Promise.allSettled = Promise.allSettled || (<T>(promises: Array<Promise<T>>) => Promise.all(
|
|
promises.map((p) => p.
|
|
then((value) => ({
|
|
status: 'fulfilled',
|
|
value,
|
|
})).
|
|
catch((reason) => ({
|
|
status: 'rejected',
|
|
reason,
|
|
})),
|
|
),
|
|
));
|
|
|
|
export async function initialize() {
|
|
if (!baseAppInitialized) {
|
|
baseAppInitialized = true;
|
|
serverCredentials = await getAllServerCredentials();
|
|
const serverUrls = serverCredentials.map((credential) => credential.serverUrl);
|
|
|
|
await DatabaseManager.init(serverUrls);
|
|
await NetworkManager.init(serverCredentials);
|
|
|
|
GlobalEventHandler.init();
|
|
ManagedApp.init();
|
|
SessionManager.init();
|
|
CallsManager.initialize();
|
|
}
|
|
}
|
|
|
|
export async function start() {
|
|
// Clean relevant information on ephemeral stores
|
|
NavigationStore.reset();
|
|
EphemeralStore.setCurrentThreadId('');
|
|
EphemeralStore.setProcessingNotification('');
|
|
|
|
await initialize();
|
|
|
|
PushNotifications.init(serverCredentials.length > 0);
|
|
|
|
registerNavigationListeners();
|
|
registerScreens();
|
|
|
|
await WebsocketManager.init(serverCredentials);
|
|
|
|
initialLaunch();
|
|
}
|