Files
mattermost-mobile/index.ts
Daniel Espino García 9f84ab79ce Only call app entry on websocket reconnect (#7065)
* Only call app entry on websocket reconnect

* Handle notification on its own entry and run app entry on websocket initialization

* Fix notification entry issues

* Fix login entry and add retry on entry failure

* feedback review

* Put back handleEntryAfterLoadNavigation before the batching

---------

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2023-02-23 10:11:34 +01:00

62 lines
2.0 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import TurboLogger from '@mattermost/react-native-turbo-log';
import {LogBox, Platform} from 'react-native';
import ViewReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';
import {RUNNING_E2E} from 'react-native-dotenv';
import 'react-native-gesture-handler';
import {Navigation} from 'react-native-navigation';
import {initialize, start} from './app/init/app';
import setFontFamily from './app/utils/font_family';
import {logInfo} from './app/utils/log';
declare const global: { HermesInternal: null | {} };
// Add scaleY back to work around its removal in React Native 0.70.
ViewReactNativeStyleAttributes.scaleY = true;
TurboLogger.configure({
dailyRolling: false,
logToFile: !__DEV__,
maximumFileSize: 1024 * 1024,
maximumNumberOfFiles: 2,
});
if (__DEV__) {
LogBox.ignoreLogs([
'new NativeEventEmitter',
]);
// Ignore all notifications if running e2e
const isRunningE2e = RUNNING_E2E === 'true';
logInfo(`RUNNING_E2E: ${RUNNING_E2E}, isRunningE2e: ${isRunningE2e}`);
if (isRunningE2e) {
LogBox.ignoreAllLogs(true);
}
}
setFontFamily();
if (global.HermesInternal) {
// Polyfills required to use Intl with Hermes engine
require('@formatjs/intl-getcanonicallocales/polyfill');
require('@formatjs/intl-locale/polyfill');
require('@formatjs/intl-pluralrules/polyfill');
require('@formatjs/intl-numberformat/polyfill');
require('@formatjs/intl-datetimeformat/polyfill');
require('@formatjs/intl-datetimeformat/add-golden-tz');
}
if (Platform.OS === 'android') {
const ShareExtension = require('share_extension/index.tsx').default;
const AppRegistry = require('react-native/Libraries/ReactNative/AppRegistry');
AppRegistry.registerComponent('MattermostShare', () => ShareExtension);
}
Navigation.events().registerAppLaunchedListener(async () => {
await initialize();
start();
});