fix: stop syncing for existing users with balances

This commit is contained in:
Sean Yesmunt 2019-10-02 00:34:59 -04:00
parent ef816608ab
commit feca7fb620
5 changed files with 22 additions and 9 deletions

View file

@ -128,8 +128,8 @@
"husky": "^0.14.3", "husky": "^0.14.3",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git", "lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#04ae0913a444abac200731c7ed53796d763a0bbb", "lbry-redux": "lbryio/lbry-redux#973d28e46290c77f2d9d468304008f80f71fd8cd",
"lbryinc": "lbryio/lbryinc#a44576194e1f5f60e37d328ddfdca40bd6165c2d", "lbryinc": "lbryio/lbryinc#7c94a38683344262fe34773dc50bfbe6d2a9e116",
"lint-staged": "^7.0.2", "lint-staged": "^7.0.2",
"localforage": "^1.7.1", "localforage": "^1.7.1",
"lodash-es": "^4.17.14", "lodash-es": "^4.17.14",

View file

@ -7,6 +7,7 @@ import path from 'path';
import * as ACTIONS from 'constants/action_types'; import * as ACTIONS from 'constants/action_types';
import * as MODALS from 'constants/modal_types'; import * as MODALS from 'constants/modal_types';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
import * as SETTINGS from 'constants/settings';
import { import {
Lbry, Lbry,
doBalanceSubscribe, doBalanceSubscribe,
@ -16,6 +17,7 @@ import {
makeSelectClaimIsMine, makeSelectClaimIsMine,
doPopulateSharedUserState, doPopulateSharedUserState,
doFetchChannelListMine, doFetchChannelListMine,
selectBalance,
} from 'lbry-redux'; } from 'lbry-redux';
import Native from 'native'; import Native from 'native';
import { doFetchDaemonSettings } from 'redux/actions/settings'; import { doFetchDaemonSettings } from 'redux/actions/settings';
@ -31,12 +33,13 @@ import {
selectUpgradeTimer, selectUpgradeTimer,
selectModal, selectModal,
} from 'redux/selectors/app'; } from 'redux/selectors/app';
import { Lbryio, doAuthenticate, doGetSync } from 'lbryinc'; import { Lbryio, doAuthenticate, doGetSync, selectSyncHash } from 'lbryinc';
import { lbrySettings as config, version as appVersion } from 'package.json'; import { lbrySettings as config, version as appVersion } from 'package.json';
import { push } from 'connected-react-router'; import { push } from 'connected-react-router';
import analytics from 'analytics'; import analytics from 'analytics';
import { deleteAuthToken } from 'util/saved-passwords'; import { deleteAuthToken } from 'util/saved-passwords';
import cookie from 'cookie'; import cookie from 'cookie';
import { makeSelectClientSetting } from 'redux/selectors/settings';
// @if TARGET='app' // @if TARGET='app'
const { autoUpdater } = remote.require('electron-updater'); const { autoUpdater } = remote.require('electron-updater');
@ -456,7 +459,15 @@ export function doSignIn() {
// @endif // @endif
// @if TARGET='app' // @if TARGET='app'
dispatch(doGetSync()); const state = getState();
const syncEnabled = makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state);
const syncHash = selectSyncHash(state);
const balance = selectBalance(state);
// For existing users, check if they've synced before, or have 0 balance
if (syncEnabled && (!syncHash || balance === 0)) {
dispatch(doGetSync());
}
// @endif // @endif
Lbryio.call('user_settings', 'get').then(settings => { Lbryio.call('user_settings', 'get').then(settings => {

View file

@ -63,6 +63,7 @@ const whiteListedReducers = [
'search', 'search',
'blocked', 'blocked',
'settings', 'settings',
'sync',
]; ];
const transforms = [ const transforms = [

View file

@ -794,5 +794,6 @@
"channel": "channel", "channel": "channel",
"Create": "Create", "Create": "Create",
"Use this address to receive LBC.": "Use this address to receive LBC.", "Use this address to receive LBC.": "Use this address to receive LBC.",
"Not a valid LBRY address": "Not a valid LBRY address" "Not a valid LBRY address": "Not a valid LBRY address",
"You have no rewards available.": "You have no rewards available."
} }

View file

@ -6850,17 +6850,17 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
yargs "^13.2.2" yargs "^13.2.2"
zstd-codec "^0.1.1" zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#04ae0913a444abac200731c7ed53796d763a0bbb: lbry-redux@lbryio/lbry-redux#973d28e46290c77f2d9d468304008f80f71fd8cd:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/04ae0913a444abac200731c7ed53796d763a0bbb" resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/973d28e46290c77f2d9d468304008f80f71fd8cd"
dependencies: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"
uuid "^3.3.2" uuid "^3.3.2"
lbryinc@lbryio/lbryinc#a44576194e1f5f60e37d328ddfdca40bd6165c2d: lbryinc@lbryio/lbryinc#7c94a38683344262fe34773dc50bfbe6d2a9e116:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/a44576194e1f5f60e37d328ddfdca40bd6165c2d" resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/7c94a38683344262fe34773dc50bfbe6d2a9e116"
dependencies: dependencies:
reselect "^3.0.0" reselect "^3.0.0"