Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dispatch(Actions.imageAdded(photo, multipartData.payloadPath))
UploadTask.uploadFile(multipartData.payloadPath, 'https://ipfs.textile.io/api/v0/add?wrap-with-directory=true', 'POST', multipartData.boundary)
// PushNotificationIOS.presentLocalNotification({
// alertBody: 'uploading photo ' + multipartData.payloadPath,
// userInfo: {}
// })
}
// PushNotificationIOS.presentLocalNotification({
// alertBody: 'photos task done',
// userInfo: {}
// })
console.log('photos task done')
BackgroundTimer.stop() // This alerts the OS that we're done with our background task
}
break cancelSequence
}
await this.api.checkCafeMessages()
await delay(ms / 2)
if (cancelled) { // cancelled by event, so abort sequence
foregroundEvent.remove() // remove our event listener
break cancelSequence
}
// enter stopping sequence
foregroundEvent.remove() // remove our event listener
TextileEvents.stopNodeAfterDelayFinishing()
await this.stopNode() // stop the node
cancelled = true // be sure to exit the loop
}
await BackgroundTimer.stop()
await BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA)
}
}
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);
}
};
if (cancelled) { // cancelled by event, so abort sequence
foregroundEvent.remove() // remove our event listener
break
}
// enter stopping sequence
foregroundEvent.remove() // remove our event listener
TextileEvents.stopNodeAfterDelayFinishing()
await this.stopNode() // stop the node
TextileEvents.stopNodeAfterDelayComplete()
cancelled = true // be sure to exit the loop
}
} finally {
// TODO: this might be better in a client provided callback
await BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA)
// Tells iOS that we are done with our background task so it's okay to suspend us
await BackgroundTimer.stop()
}
}
}
export const stopSessionTimer = (isStillAuthed: boolean = true) => {
BackgroundTimer.clearInterval(timeout)
BackgroundTimer.stop()
authenticated = isStillAuthed
}
function stopTimer() {
if (Platform.OS === 'android') {
BackgroundTimer.clearTimeout(this.intervalId);
} else {
BackgroundTimer.stop();
}
}
/**