diff --git a/class/app-storage.js b/class/app-storage.js index 2f56b8b4e6..a5d7afce18 100644 --- a/class/app-storage.js +++ b/class/app-storage.js @@ -246,7 +246,7 @@ export class AppStorage { this.tx_metadata = data.tx_metadata; } } - DeviceQuickActions.setQuickActions(this.wallets); + await DeviceQuickActions.setQuickActions(this.wallets); WatchConnectivity.init(); WatchConnectivity.shared && (await WatchConnectivity.shared.sendWalletsToWatch()); return true; @@ -323,7 +323,7 @@ export class AppStorage { } WatchConnectivity.init(); WatchConnectivity.shared && WatchConnectivity.shared.sendWalletsToWatch(); - DeviceQuickActions.setQuickActions(this.wallets); + await DeviceQuickActions.setQuickActions(this.wallets); return this.setItem('data', JSON.stringify(data)); } diff --git a/class/quickActions.js b/class/quickActions.js index cb5a77ec28..855acee4b3 100644 --- a/class/quickActions.js +++ b/class/quickActions.js @@ -1,3 +1,4 @@ +/* global alert */ import QuickActions from 'react-native-quick-actions'; export default class DeviceQuickActions { @@ -11,21 +12,25 @@ export default class DeviceQuickActions { if (!wallets) { wallets = BlueApp.getWallets(); } - if (supported && error === null) { - let shortcutItems = []; - for (const wallet of wallets) { - shortcutItems.push({ - type: 'Wallets', // Required - title: wallet.getLabel(), // Optional, if empty, `type` will be used instead - subtitle: wallet.hideBalance - ? '' - : `${loc.formatBalance(Number(wallet.getBalance()), wallet.getPreferredBalanceUnit(), true)}`, - userInfo: { - url: `bluewallet://wallet/${wallet.getID()}`, // Provide any custom data like deep linking URL - }, - }); + if (error) { + alert(error); + } else { + if (supported) { + let shortcutItems = []; + for (const wallet of wallets) { + shortcutItems.push({ + type: 'Wallets', // Required + title: wallet.getLabel(), // Optional, if empty, `type` will be used instead + subtitle: wallet.hideBalance + ? '' + : `${loc.formatBalance(Number(wallet.getBalance()), wallet.getPreferredBalanceUnit(), true)}`, + userInfo: { + url: `bluewallet://wallet/${wallet.getID()}`, // Provide any custom data like deep linking URL + }, + }); + } + QuickActions.setShortcutItems(shortcutItems); } - QuickActions.setShortcutItems(shortcutItems); } }); } diff --git a/currency.js b/currency.js index 474ca493a1..e58c78e771 100644 --- a/currency.js +++ b/currency.js @@ -24,7 +24,7 @@ async function setPrefferedCurrency(item) { await DefaultPreference.setName('group.io.bluewallet.bluewallet'); await DefaultPreference.set('preferredCurrency', item.endPointKey); await DefaultPreference.set('preferredCurrencyLocale', item.locale.replace('-', '_')); - DeviceQuickActions.setQuickActions(); + await DeviceQuickActions.setQuickActions(); } async function getPreferredCurrency() { @@ -66,7 +66,7 @@ async function updateExchangeRate() { exchangeRates['BTC_' + preferredFiatCurrency.endPointKey] = json.bpi[preferredFiatCurrency.endPointKey].rate_float * 1; await AsyncStorage.setItem(AppStorage.EXCHANGE_RATES, JSON.stringify(exchangeRates)); await AsyncStorage.setItem(AppStorage.PREFERRED_CURRENCY, JSON.stringify(preferredFiatCurrency)); - DeviceQuickActions.setQuickActions(); + await DeviceQuickActions.setQuickActions(); } let interval = false;