Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const handleNotification = notification => {
if (notification.additionalData.foreground && isIOS()) {
// on iOS the the notification does not appear if the application is in foreground
Alerter.info(notification.title + ' : ' + notification.message)
}
if (flag('debug')) {
// eslint-disable-next-line no-console
console.log('Received notification', notification)
}
if (
!notification.additionalData.foreground &&
notification.additionalData.route
) {
hashHistory.push(notification.additionalData.route)
}
}
handleClick() {
this.clicks.push({ date: Date.now() })
this.clicks = takeLast(this.clicks, 3)
if (this.clicks.length < 3) {
return
}
for (const [prevClick, click] of pairs(this.clicks)) {
const delta = click.date - prevClick.date
if (delta > 1000) {
// Clicks are not close enough
return
}
}
Alerter.info('Debug flag activated')
flag('debug', true)
}
const onStartOrResume = checkToRefreshToken(client, store, () => {
if (flag('debug')) {
Alerter.info('Token refreshed')
}
})
document.addEventListener('deviceready', onStartOrResume)
handleEnteredPin(pinValue) {
if (this.cleaning) {
return
}
const { pinSetting, t } = this.props
const pinDoc = pinSetting.data
if (!pinDoc) {
Alerter.info(t('Pin.no-pin-configured'))
return this.props.onSuccess()
}
this.setState({ pinValue })
if (pinValue === pinDoc.pin) {
this.setState({ success: true })
this.props.onSuccess()
return
}
if (pinValue.length === this.props.maxLength) {
const newAttempt = this.state.attempt + 1
if (newAttempt >= this.props.maxAttempt) {
return this.onMaxAttempt()
}
handleFingerprintError() {
const { t } = this.props.t
Alerter.info(t('Pin.bad-pin'))
}