Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleAppStateChange = appState => {
const newModeIsBackground = appState === 'background';
// If it was in background and it's not anymore
// we need to stop the Background timer
if (this.backgroundMode && !newModeIsBackground) {
BackgroundTimer.stop();
this.pollForIncomingTransactions();
}
this.backgroundMode = newModeIsBackground;
// If the app is now in background, we need to start
// the background timer, which is less intense
if (this.backgroundMode) {
this.setState({ walletConnectReturnModalVisible: false });
BackgroundTimer.runBackgroundTimer(async () => {
await Engine.refreshTransactionHistory();
}, AppConstants.TX_CHECK_BACKGROUND_FREQUENCY);
}
};
const socketSetup = store => {
BackgroundTimer.runBackgroundTimer(() => {
checkBalance(store);
}, 30000);
};