Browse Source

TST

experimental^2
Marcos Rodriguez 5 years ago
parent
commit
bcdf62e9b2
  1. 4
      class/app-storage.js
  2. 33
      class/quickActions.js
  3. 4
      currency.js

4
class/app-storage.js

@ -246,7 +246,7 @@ export class AppStorage {
this.tx_metadata = data.tx_metadata; this.tx_metadata = data.tx_metadata;
} }
} }
DeviceQuickActions.setQuickActions(this.wallets); await DeviceQuickActions.setQuickActions(this.wallets);
WatchConnectivity.init(); WatchConnectivity.init();
WatchConnectivity.shared && (await WatchConnectivity.shared.sendWalletsToWatch()); WatchConnectivity.shared && (await WatchConnectivity.shared.sendWalletsToWatch());
return true; return true;
@ -323,7 +323,7 @@ export class AppStorage {
} }
WatchConnectivity.init(); WatchConnectivity.init();
WatchConnectivity.shared && WatchConnectivity.shared.sendWalletsToWatch(); WatchConnectivity.shared && WatchConnectivity.shared.sendWalletsToWatch();
DeviceQuickActions.setQuickActions(this.wallets); await DeviceQuickActions.setQuickActions(this.wallets);
return this.setItem('data', JSON.stringify(data)); return this.setItem('data', JSON.stringify(data));
} }

33
class/quickActions.js

@ -1,3 +1,4 @@
/* global alert */
import QuickActions from 'react-native-quick-actions'; import QuickActions from 'react-native-quick-actions';
export default class DeviceQuickActions { export default class DeviceQuickActions {
@ -11,21 +12,25 @@ export default class DeviceQuickActions {
if (!wallets) { if (!wallets) {
wallets = BlueApp.getWallets(); wallets = BlueApp.getWallets();
} }
if (supported && error === null) { if (error) {
let shortcutItems = []; alert(error);
for (const wallet of wallets) { } else {
shortcutItems.push({ if (supported) {
type: 'Wallets', // Required let shortcutItems = [];
title: wallet.getLabel(), // Optional, if empty, `type` will be used instead for (const wallet of wallets) {
subtitle: wallet.hideBalance shortcutItems.push({
? '' type: 'Wallets', // Required
: `${loc.formatBalance(Number(wallet.getBalance()), wallet.getPreferredBalanceUnit(), true)}`, title: wallet.getLabel(), // Optional, if empty, `type` will be used instead
userInfo: { subtitle: wallet.hideBalance
url: `bluewallet://wallet/${wallet.getID()}`, // Provide any custom data like deep linking URL ? ''
}, : `${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);
} }
}); });
} }

4
currency.js

@ -24,7 +24,7 @@ async function setPrefferedCurrency(item) {
await DefaultPreference.setName('group.io.bluewallet.bluewallet'); await DefaultPreference.setName('group.io.bluewallet.bluewallet');
await DefaultPreference.set('preferredCurrency', item.endPointKey); await DefaultPreference.set('preferredCurrency', item.endPointKey);
await DefaultPreference.set('preferredCurrencyLocale', item.locale.replace('-', '_')); await DefaultPreference.set('preferredCurrencyLocale', item.locale.replace('-', '_'));
DeviceQuickActions.setQuickActions(); await DeviceQuickActions.setQuickActions();
} }
async function getPreferredCurrency() { async function getPreferredCurrency() {
@ -66,7 +66,7 @@ async function updateExchangeRate() {
exchangeRates['BTC_' + preferredFiatCurrency.endPointKey] = json.bpi[preferredFiatCurrency.endPointKey].rate_float * 1; exchangeRates['BTC_' + preferredFiatCurrency.endPointKey] = json.bpi[preferredFiatCurrency.endPointKey].rate_float * 1;
await AsyncStorage.setItem(AppStorage.EXCHANGE_RATES, JSON.stringify(exchangeRates)); await AsyncStorage.setItem(AppStorage.EXCHANGE_RATES, JSON.stringify(exchangeRates));
await AsyncStorage.setItem(AppStorage.PREFERRED_CURRENCY, JSON.stringify(preferredFiatCurrency)); await AsyncStorage.setItem(AppStorage.PREFERRED_CURRENCY, JSON.stringify(preferredFiatCurrency));
DeviceQuickActions.setQuickActions(); await DeviceQuickActions.setQuickActions();
} }
let interval = false; let interval = false;

Loading…
Cancel
Save