From 99f5ec3580a7915c4c566a6d47beb4b158f65f59 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Thu, 25 Oct 2018 00:32:36 +0100 Subject: [PATCH] ADD: security alert --- BlueApp.js | 2 ++ security-alert.js | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 security-alert.js diff --git a/BlueApp.js b/BlueApp.js index 72bc4d61f..37fd40206 100644 --- a/BlueApp.js +++ b/BlueApp.js @@ -24,6 +24,8 @@ async function startAndDecrypt(retry) { console.log('loaded from disk'); EV(EV.enum.WALLETS_COUNT_CHANGED); EV(EV.enum.TRANSACTIONS_COUNT_CHANGED); + let securityAlert = require('./security-alert'); + await securityAlert.start(); // now, lets try to fetch balance and txs for first wallet if it is time for it let hadToRefresh = false; let noErr = true; diff --git a/security-alert.js b/security-alert.js new file mode 100644 index 000000000..76ae7ef0c --- /dev/null +++ b/security-alert.js @@ -0,0 +1,24 @@ +import { AsyncStorage, Alert } from 'react-native'; + +async function start() { + const key = 'security_alert_num_times'; + let times = await AsyncStorage.getItem(key); + times = times || 0; + + console.log({ times }); + + if (times < 3) { + Alert.alert( + 'Security alert', + 'If you used BlueWallet prior to version 3.1.0 you are advised to re-create wallets ' + + 'and transfer all funds from old wallets to new ones, as older versions might have security issues', + [ + { text: 'Remind me later', onPress: () => AsyncStorage.setItem(key, '0') }, + { text: 'Ok', onPress: () => AsyncStorage.setItem(key, parseInt(times) + 1 + '') }, + ], + { cancelable: false }, + ); + } +} + +module.exports.start = start;