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;
}
}
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));
}

33
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);
}
});
}

4
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;

Loading…
Cancel
Save