diff --git a/electron/createWindow.js b/electron/createWindow.js index 7eabbf8af..f1f0a649c 100644 --- a/electron/createWindow.js +++ b/electron/createWindow.js @@ -178,10 +178,6 @@ export default appState => { window.webContents.send('language-set', language); } }); - - if (isDev) { - window.webContents.openDevTools(); - } }); window.webContents.on('crashed', () => { diff --git a/electron/index.js b/electron/index.js index 9db1816b0..70d86436a 100644 --- a/electron/index.js +++ b/electron/index.js @@ -177,7 +177,6 @@ if (!gotSingleInstanceLock) { if (isDev) { await installDevtools(); } - rendererWindow = createWindow(appState); tray = createTray(rendererWindow); diff --git a/package.json b/package.json index e3fbe894f..a26d0eb5c 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "dotenv-webpack": "^1.8.0", "electron": "9.3.1", "electron-builder": "^22.9.1", - "electron-devtools-installer": "^2.2.4", + "electron-devtools-installer": "^3.1.1", "electron-is-dev": "^0.3.0", "electron-webpack": "^2.8.2", "electron-window-state": "^4.1.1", @@ -140,7 +140,7 @@ "imagesloaded": "^4.1.4", "json-loader": "^0.5.4", "lbry-format": "https://github.com/lbryio/lbry-format.git", - "lbry-redux": "lbryio/lbry-redux#ce9f720bbd978d7574ab072771aa85ff5a83e2fc", + "lbry-redux": "lbryio/lbry-redux#acc54f157f3757b07145e04d325c133c981440c1", "lbryinc": "lbryio/lbryinc#eee2cb730ecec95a1344a755035755b0d4dad5cf", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/static/app-strings.json b/static/app-strings.json index b1044f390..8379e29a6 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1549,5 +1549,9 @@ "This content can be downloaded from lbry.tv, but not displayed. It will display in LBRY Desktop, an app for desktop computers.": "This content can be downloaded from lbry.tv, but not displayed. It will display in LBRY Desktop, an app for desktop computers.", "Repost Here": "Repost Here", "Publish Here": "Publish Here", + "Close sidebar - hide channels you are following.": "Close sidebar - hide channels you are following.", + "Consolidate Now": "Consolidate Now", + "Your wallet has a lot of change lying around. Consolidating will speed up your transactions. This could take some time. %now%%help%": "Your wallet has a lot of change lying around. Consolidating will speed up your transactions. This could take some time. %now%%help%", + "Consolidating": "Consolidating", "--end--": "--end--" } diff --git a/ui/component/walletBalance/index.js b/ui/component/walletBalance/index.js index 2e302b513..edd22e69e 100644 --- a/ui/component/walletBalance/index.js +++ b/ui/component/walletBalance/index.js @@ -1,5 +1,16 @@ import { connect } from 'react-redux'; -import { selectBalance, selectClaimsBalance, selectSupportsBalance, selectTipsBalance } from 'lbry-redux'; +import { + selectBalance, + selectClaimsBalance, + selectSupportsBalance, + selectTipsBalance, + selectIsFetchingUtxoCounts, + selectUtxoCounts, + doFetchUtxoCounts, + doUtxoConsolidate, + selectPendingOtherTransactions, + selectIsConsolidatingUtxos, +} from 'lbry-redux'; import { doOpenModal } from 'redux/actions/app'; import { selectSyncHash } from 'redux/selectors/sync'; import { selectClaimedRewards } from 'redux/selectors/rewards'; @@ -12,8 +23,14 @@ const select = state => ({ tipsBalance: selectTipsBalance(state) || 0, rewards: selectClaimedRewards(state), hasSynced: Boolean(selectSyncHash(state)), + fetchingUtxoCounts: selectIsFetchingUtxoCounts(state), + consolidatingUtxos: selectIsConsolidatingUtxos(state), + utxoCounts: selectUtxoCounts(state), + pendingUtxoConsolidating: selectPendingOtherTransactions(state), }); export default connect(select, { doOpenModal, + doFetchUtxoCounts, + doUtxoConsolidate, })(WalletBalance); diff --git a/ui/component/walletBalance/view.jsx b/ui/component/walletBalance/view.jsx index 35ce6bf59..91e6f31c0 100644 --- a/ui/component/walletBalance/view.jsx +++ b/ui/component/walletBalance/view.jsx @@ -9,6 +9,7 @@ import Icon from 'component/common/icon'; import HelpLink from 'component/common/help-link'; import Card from 'component/common/card'; import LbcSymbol from 'component/common/lbc-symbol'; +import I18nMessage from 'component/i18nMessage'; type Props = { balance: number, @@ -18,35 +19,95 @@ type Props = { tipsBalance: number, doOpenModal: string => void, hasSynced: boolean, + doFetchUtxoCounts: () => void, + doUtxoConsolidate: () => void, + fetchingUtxoCounts: boolean, + consolidatingUtxos: boolean, + utxoCounts: { [string]: number }, + pendingUtxoConsolidating: Array, }; -const WalletBalance = (props: Props) => { - const { balance, claimsBalance, supportsBalance, tipsBalance, doOpenModal, hasSynced } = props; +const WALLET_CONSOLIDATE_UTXOS = 400; +const LARGE_WALLET_BALANCE = 100; +const WalletBalance = (props: Props) => { + const { + balance, + claimsBalance, + supportsBalance, + tipsBalance, + doOpenModal, + hasSynced, + pendingUtxoConsolidating, + doUtxoConsolidate, + doFetchUtxoCounts, + consolidatingUtxos, + utxoCounts, + } = props; + const { other: otherCount = 0 } = utxoCounts || {}; + + React.useEffect(() => { + if (balance > LARGE_WALLET_BALANCE) { + doFetchUtxoCounts(); + } + }, [doFetchUtxoCounts, balance]); return (
- } - subtitle={__('Available Balance')} - actions={ -
-
- } - /> +
+
+ } + subtitle={__('Available Balance')} + actions={ + <> +
+
+
+
+ {(otherCount > WALLET_CONSOLIDATE_UTXOS || pendingUtxoConsolidating.length || consolidatingUtxos) && ( +

+ doUtxoConsolidate()} + disabled={pendingUtxoConsolidating.length || consolidatingUtxos} + label={ + pendingUtxoConsolidating.length || consolidatingUtxos + ? __('Consolidating') + : __('Consolidate Now') + } + /> + ), + help: , + }} + > + Your wallet has a lot of change lying around. Consolidating will speed up your transactions. + This could take some time. %now%%help% + +

+ )} + + } + /> +
+
+
{/* @if TARGET='app' */} diff --git a/yarn.lock b/yarn.lock index 70d01c31b..d24ad076c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4711,6 +4711,15 @@ electron-devtools-installer@^2.2.4: rimraf "^2.5.2" semver "^5.3.0" +electron-devtools-installer@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/electron-devtools-installer/-/electron-devtools-installer-3.1.1.tgz#7b56c8c86475c5e4e10de6917d150c53c9ceb55e" + integrity sha512-g2D4J6APbpsiIcnLkFMyKZ6bOpEJ0Ltcc2m66F7oKUymyGAt628OWeU9nRZoh1cNmUs/a6Cls2UfOmsZtE496Q== + dependencies: + rimraf "^3.0.2" + semver "^7.2.1" + unzip-crx-3 "^0.2.0" + electron-dl@^1.11.0: version "1.14.0" resolved "https://registry.yarnpkg.com/electron-dl/-/electron-dl-1.14.0.tgz#1466f1b945664ca3d784268307c2b935728177bf" @@ -7253,6 +7262,16 @@ jsx-ast-utils@^2.2.1, jsx-ast-utils@^2.2.3: array-includes "^3.0.3" object.assign "^4.1.0" +jszip@^3.1.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.5.0.tgz#b4fd1f368245346658e781fec9675802489e15f6" + integrity sha512-WRtu7TPCmYePR1nazfrtuF216cIVon/3GWOvHS9QR5bIwSbnxtdpma6un3jyGGNhHsKCSzn5Ypk+EkDRvTGiFA== + dependencies: + lie "~3.3.0" + pako "~1.0.2" + readable-stream "~2.3.6" + set-immediate-shim "~1.0.1" + jszip@~2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/jszip/-/jszip-2.5.0.tgz#7444fd8551ddf3e5da7198fea0c91bc8308cc274" @@ -7328,9 +7347,9 @@ lazy-val@^1.0.4: yargs "^13.2.2" zstd-codec "^0.1.1" -lbry-redux@lbryio/lbry-redux#ce9f720bbd978d7574ab072771aa85ff5a83e2fc: +lbry-redux@lbryio/lbry-redux#acc54f157f3757b07145e04d325c133c981440c1: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/ce9f720bbd978d7574ab072771aa85ff5a83e2fc" + resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/acc54f157f3757b07145e04d325c133c981440c1" dependencies: proxy-polyfill "0.1.6" reselect "^3.0.0" @@ -7381,6 +7400,13 @@ lie@3.1.1: dependencies: immediate "~3.0.5" +lie@~3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a" + integrity sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ== + dependencies: + immediate "~3.0.5" + lines-and-columns@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" @@ -8687,7 +8713,7 @@ package-json@^6.3.0: registry-url "^5.0.0" semver "^6.2.0" -pako@^1.0.11, pako@~1.0.5: +pako@^1.0.11, pako@~1.0.2, pako@~1.0.5: version "1.0.11" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" @@ -10231,6 +10257,13 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" @@ -10436,6 +10469,13 @@ semver@^7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.1.3.tgz#e4345ce73071c53f336445cfc19efb1c311df2a6" +semver@^7.2.1: + version "7.3.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" + integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + dependencies: + lru-cache "^6.0.0" + semver@^7.3.2: version "7.3.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" @@ -10507,6 +10547,11 @@ set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" +set-immediate-shim@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" + integrity sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E= + set-value@^2.0.0, set-value@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" @@ -11700,6 +11745,15 @@ unused-filename@^1.0.0: modify-filename "^1.1.0" path-exists "^3.0.0" +unzip-crx-3@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/unzip-crx-3/-/unzip-crx-3-0.2.0.tgz#d5324147b104a8aed9ae8639c95521f6f7cda292" + integrity sha512-0+JiUq/z7faJ6oifVB5nSwt589v1KCduqIJupNVDoWSXZtWDmjDGO3RAEOvwJ07w90aoXoP4enKsR7ecMrJtWQ== + dependencies: + jszip "^3.1.0" + mkdirp "^0.5.1" + yaku "^0.16.6" + unzip-response@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" @@ -12424,6 +12478,11 @@ y18n@^5.0.2: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.3.tgz#978115b82befe2b5c762bf55980b7b01a4a2d5d9" integrity sha512-JeFbcHQ/7hVmMBXW6UB6Tg7apStHd/ztGz1JN78y3pFi/q0Ht1eA6PVkvw56gm7UA8fcJR/ziRlYEDMGoju0yQ== +yaku@^0.16.6: + version "0.16.7" + resolved "https://registry.yarnpkg.com/yaku/-/yaku-0.16.7.tgz#1d195c78aa9b5bf8479c895b9504fd4f0847984e" + integrity sha1-HRlceKqbW/hHnIlblQT9TwhHmE4= + yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"