updates for cross-device sync #130

Merged
akinwale merged 7 commits from sync into master 2019-04-18 09:56:17 +02:00
2 changed files with 12 additions and 12 deletions
Showing only changes of commit 1d9218669b - Show all commits

10
dist/bundle.js vendored
View file

@ -3647,13 +3647,13 @@ function doUpdateTotalBalance() {
var _getState2 = getState(),
totalBalanceInStore = _getState2.wallet.totalBalance;
_lbry2.default.account_list().then(function (accounts) {
var totalSatoshis = accounts.lbc_mainnet.reduce(function (a, b) {
if (!a.satoshis) return b.satoshis;
if (!b.satoshis) return a.satoshis;
_lbry2.default.account_list().then(function (accountList) {
var accounts = accountList.lbc_mainnet;
var totalSatoshis = accounts.length === 1 ? accounts[0].satoshis : accounts.reduce(function (a, b) {
return a.satoshis + b.satoshis;
});
var totalBalance = totalSatoshis / Math.pow(10, 8);
var totalBalance = (Number.isNaN(totalSatoshis) ? 0 : totalSatoshis) / Math.pow(10, 8);
if (totalBalanceInStore !== totalBalance) {
dispatch({
type: ACTIONS.UPDATE_TOTAL_BALANCE,

View file

@ -29,13 +29,13 @@ export function doUpdateTotalBalance() {
const {
wallet: { totalBalance: totalBalanceInStore },
} = getState();
Lbry.account_list().then(accounts => {
const totalSatoshis = accounts.lbc_mainnet.reduce((a, b) => {
if (!a.satoshis) return b.satoshis;
if (!b.satoshis) return a.satoshis;
return a.satoshis + b.satoshis;
});
const totalBalance = totalSatoshis / 10 ** 8;
Lbry.account_list().then(accountList => {
const { lbc_mainnet: accounts } = accountList;
const totalSatoshis =
accounts.length === 1
? accounts[0].satoshis
: accounts.reduce((a, b) => a.satoshis + b.satoshis);
const totalBalance = (Number.isNaN(totalSatoshis) ? 0 : totalSatoshis) / 10 ** 8;
if (totalBalanceInStore !== totalBalance) {
dispatch({
type: ACTIONS.UPDATE_TOTAL_BALANCE,