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 6 additions and 0 deletions
Showing only changes of commit 8448766e48 - Show all commits

3
dist/bundle.js vendored
View file

@ -3629,6 +3629,7 @@ function doUpdateBalance() {
_lbry2.default.account_balance().then(function (balanceAsString) {
var balance = parseFloat(balanceAsString);
console.log('balance=' + balance);
if (balanceInStore !== balance) {
dispatch({
@ -3650,10 +3651,12 @@ function doUpdateTotalBalance() {
_lbry2.default.account_list().then(function (accountList) {
var accounts = accountList.lbc_mainnet;
console.log(accountList);
var totalSatoshis = accounts.length === 1 ? accounts[0].satoshis : accounts.reduce(function (a, b) {
return a.satoshis + b.satoshis;
});
var totalBalance = (Number.isNaN(totalSatoshis) ? 0 : totalSatoshis) / Math.pow(10, 8);
console.log(totalBalance);
if (totalBalanceInStore !== totalBalance) {
dispatch({
type: ACTIONS.UPDATE_TOTAL_BALANCE,

View file

@ -11,6 +11,7 @@ export function doUpdateBalance() {
} = getState();
Lbry.account_balance().then(balanceAsString => {
const balance = parseFloat(balanceAsString);
console.log(`balance=${balance}`);
if (balanceInStore !== balance) {
dispatch({
@ -31,11 +32,13 @@ export function doUpdateTotalBalance() {
} = getState();
Lbry.account_list().then(accountList => {
const { lbc_mainnet: accounts } = accountList;
console.log(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;
console.log(totalBalance);
if (totalBalanceInStore !== totalBalance) {
dispatch({
type: ACTIONS.UPDATE_TOTAL_BALANCE,