Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{ cancelable: false }
)
}
if (!isIntegrationMode) {
// eslint-disable-next-line
if (!__DEV__) {
console.error = error => exceptionHandler(error, false)
}
if (Platform.OS === 'ios' || Platform.OS === 'android') {
const allowInDevMode = false
const forceAppQuit = false
const executeDefaultHandler = false
setJSExceptionHandler(exceptionHandler, allowInDevMode)
setNativeExceptionHandler(() => {}, forceAppQuit, executeDefaultHandler)
}
}
import { withTheme, DarkTheme, DefaultTheme } from 'react-native-paper';
import { Menu, Settings, About, Setup, Consumable, CommanderSkill,
BasicDetail, Achievement, Map as GameMap, Collection, Warship, WarshipDetail,
WarshipFilter, WarshipModule, Loading, Statistics, ClanInfo, PlayerAchievement,
Rating, Search, Graph, SimilarGraph, License, RS, SupportMe, ProVersion } from './page';
import { LOCAL, getFirstLaunch, getCurrServer, APP } from './value/data';
import { DataLoader, Downloader } from './core';
import { GREY, BLUE } from 'react-native-material-color';
import { TintColour } from './value/colour';
import { lang } from './value/lang';
import { PlayerShip } from './page/player/PlayerShip';
import { Detailed } from './page/player/Detailed';
import { Rank } from './page/player/Rank';
import { setJSExceptionHandler, setNativeExceptionHandler } from 'react-native-exception-handler';
setJSExceptionHandler((e, fatal) => {
if (fatal) {
showAlert(`${e.name}\n${e.message}`, 'JS');
} else {
console.log(`JSException\n${e}`);
}
}, true);
setNativeExceptionHandler((e) => {
showAlert(e, 'NATIVE');
console.log(`NativeException\n${e}`);
});
// Ask user to email me the log
function showAlert(msg, mode) {
Alert.alert(`FATAL ${mode} ERROR`, `${msg}\n\nPlease contact developer`,
[{
{ cancelable: false }
)
}
if (process.env['ENVIRONMENT'] !== 'integration_test') {
// eslint-disable-next-line
if (!__DEV__) {
console.error = error => exceptionHandler(error, false)
}
if (Platform.OS === 'ios' || Platform.OS === 'android') {
const allowInDevMode = false
const forceAppQuit = false
const executeDefaultHandler = false
setJSExceptionHandler(exceptionHandler, allowInDevMode)
setNativeExceptionHandler(() => {}, forceAppQuit, executeDefaultHandler)
}
}
!isFatal && { text: I18n.t('cancel') },
],
{ cancelable: false }
)
}
if (!isIntegrationMode && Platform.OS !== 'web') {
if (!__DEV__) {
console.error = error => exceptionHandler(error, false)
}
const allowInDevMode = false
const forceAppQuit = false
const executeDefaultHandler = true
setJSExceptionHandler(exceptionHandler, allowInDevMode)
setNativeExceptionHandler(
() =>
Notifier.system({
title: I18n.t('restart'),
body: I18n.t('unexpected-error'),
}),
forceAppQuit,
executeDefaultHandler
)
}
import { persistStore, autoRehydrate } from 'redux-persist';
import AsyncStorage from '@react-native-community/async-storage';
import FilesystemStorage from 'redux-persist-filesystem-storage';
import createCompressor from 'redux-persist-transform-compress';
import createFilter from 'redux-persist-transform-filter';
import moment from 'moment';
import drawerReducer from 'redux/reducers/drawer';
import settingsReducer from 'redux/reducers/settings';
import thunk from 'redux-thunk';
const globalExceptionHandler = (error, isFatal) => {
if (error && NativeModules.Firebase) {
NativeModules.Firebase.logException(isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
}
};
setJSExceptionHandler(globalExceptionHandler, true);
function isFunction(object) {
return typeof object === 'function';
}
function isNotFunction(object) {
return !isFunction(object);
}
function createBulkThunkMiddleware() {
return ({ dispatch, getState }) => next => action => {
if (action.type === 'BATCH_ACTIONS') {
action.actions.filter(isFunction).map(actionFn => actionFn(dispatch, getState));
}
return next(action);
};
finishLoading = () => {
this.setState({ isLoading: false })
const errorHandler = (e, isFatal) => {
if (isFatal) {
gracefulFatalReset(new Error('Crash: ' + e.name + ': ' + e.message + ': ' + e.stack))
}
}
setJSExceptionHandler(errorHandler, true)
}
initializeErrorHandling = (store) => {
this.store = store;
initializeSentry();
setJSExceptionHandler(this.errorHandler, false);
setNativeExceptionHandler(this.nativeErrorHandler, false);
}
const finishLoading = () => {
const errorHandler = (e, isFatal) => {
if (isFatal) {
gracefulFatalReset(new Error('Crash: ' + e.name + ': ' + e.message + ': ' + e.stack))
}
}
setJSExceptionHandler(errorHandler, true)
}
React.useEffect(() => {
setJSExceptionHandler(errorHandler)
setNativeExceptionHandler(errorHandler)
}, [])
constructor(props) {
super(props);
}
componentDidMount() {
}
render() {
return (
)
}
}
setJSExceptionHandler(errorHandler);
export default IndexApp;