Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_handleAppStateChange = nextAppState => {
// app going to background
if (nextAppState === 'background') {
this.setState({
suspendTime: new Date()
})
}
// app coming from background
if (this.state.appState === 'background' && nextAppState === 'active') {
const secondsFromSuspend = (new Date() - this.state.suspendTime) / 1000
if (secondsFromSuspend > RESTART_SUSPEND_TIME) {
console.debug('Restart called')
RNRestart.Restart()
}
}
this.setState({ appState: nextAppState })
}
_confirmServer() {
if(this.state.curselect.id == 3 && this.state.curselect.value == "") {
ToastUtil.showWithMessage("請輸入服務器地址");
return;
}
// debugStorage.removeAll();
debugStorage.setData(this.state.curselect);
ToastUtil.showWithMessage("设置成功");
RNRestart.Restart();
}
.then(() => {
console.log(
"[DatabaseSynchronizer] DB download success! Reloading app."
);
RNRestart.Restart();
})
.catch(reason => {
onPress: () => RNRestart.Restart(),
},
onPress: () => RNRestart.Restart(),
},
onPress: () => RNRestart.Restart(),
},
setTimeout(() => {
RNRestart.Restart();
}, 300);
}
return async () => {
audioActor().unloadAudio();
if (locale) {
const { setLocale, setRTL } = locale;
await setLocaleAndRTLForReset({
locale: setLocale,
isRTL: setRTL,
showWelcomeScreen: true,
});
} else {
await setDefaultLocaleAndRTL();
}
RNRestart.Restart();
};
}