Browse Source

Merge branch 'todayext' into experimental

experimental
Marcos Rodriguez 5 years ago
parent
commit
8306685010
  1. 1
      App.js
  2. 4
      class/app-storage.js
  3. 33
      class/quickActions.js
  4. 4
      currency.js
  5. 31
      screen/wallets/transactions.js

1
App.js

@ -12,7 +12,6 @@ import { AppStorage, LightningCustodianWallet } from './class';
import { Chain } from './models/bitcoinUnits';
import QuickActions from 'react-native-quick-actions';
import * as Sentry from '@sentry/react-native';
import WalletGradient from './class/walletGradient';
import OnAppLaunch from './class/onAppLaunch';
if (process.env.NODE_ENV !== 'development') {

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;

31
screen/wallets/transactions.js

@ -355,31 +355,28 @@ export default class WalletTransactions extends Component {
};
onWalletSelect = async wallet => {
NavigationService.navigate('WalletTransactions', {
key: `WalletTransactions-${wallet.getID()}`,
});
/** @type {LightningCustodianWallet} */
let toAddress = false;
if (this.state.wallet.refill_addressess.length > 0) {
toAddress = this.state.wallet.refill_addressess[0];
} else {
try {
await this.state.wallet.fetchBtcAddress();
if (wallet) {
NavigationService.navigate('WalletTransactions', {
key: `WalletTransactions-${wallet.getID()}`,
});
/** @type {LightningCustodianWallet} */
let toAddress = false;
if (this.state.wallet.refill_addressess.length > 0) {
toAddress = this.state.wallet.refill_addressess[0];
} catch (Err) {
return alert(Err.message);
} else {
try {
await this.state.wallet.fetchBtcAddress();
toAddress = this.state.wallet.refill_addressess[0];
} catch (Err) {
return alert(Err.message);
}
}
}
if (wallet) {
this.props.navigation.navigate('SendDetails', {
memo: loc.lnd.refill_lnd_balance,
fromSecret: wallet.getSecret(),
address: toAddress,
fromWallet: wallet,
});
} else {
return alert('Internal error');
}
};

Loading…
Cancel
Save