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)
}
}
)
}
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)
}
}
)
}
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 { AppRegistry } from 'react-native';
import App from './src/index';
import {setJSExceptionHandler, getJSExceptionHandler,setNativeExceptionHandler} from 'react-native-exception-handler';
const customErrorHandler = (error, isFatal) => {
// Logic for reporting to devs
// Example : Log issues to github issues using github apis.
console.log(error, isFatal); // example
};
const previousErrorHandler = getJSExceptionHandler(); // by default u will get the red screen error handler here
const errorHandler = (e, isFatal) => {
customErrorHandler(e, isFatal);
previousErrorHandler(e, isFatal);
};
// We will still see the error screen, but our customErrorHandler() function will be called
setJSExceptionHandler(errorHandler);
setNativeExceptionHandler((exceptionString) => {
// This is your custom global error handler
// You do stuff likehit google analytics to track crashes.
// or hit a custom api to inform the dev team.
//NOTE: alert or showing any UI change via JS
//WILL NOT WORK in case of NATIVE ERRORS.
!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
)
}
],
{ 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)
}