From 2dc76d47eafb50a2e73cae6a478b65fa208b1e6a Mon Sep 17 00:00:00 2001
From: "azure-pipelines[bot]"
Date: Mon, 28 Jan 2019 22:49:39 +0000
Subject: [PATCH 01/19] Set up CI with Azure Pipelines
---
azure-pipelines.yml | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 azure-pipelines.yml
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 000000000..002457047
--- /dev/null
+++ b/azure-pipelines.yml
@@ -0,0 +1,21 @@
+# Node.js
+# Build a general Node.js project with npm.
+# Add steps that analyze code, save build artifacts, deploy, and more:
+# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
+
+trigger:
+- release
+
+pool:
+ vmImage: 'vs2017-win2016'
+
+steps:
+- task: NodeTool@0
+ inputs:
+ versionSpec: '9.x'
+ displayName: 'Install Node.js'
+
+- script: |
+ yarn install
+ yarn build --publish onTag
+ displayName: 'yarn install and build'
From 20e2d8c00adfb7bcb8e4820a2500766499c1bac4 Mon Sep 17 00:00:00 2001
From: Sean Yesmunt
Date: Tue, 29 Jan 2019 11:46:56 -0500
Subject: [PATCH 02/19] allow updating search api with env
---
src/renderer/index.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/renderer/index.js b/src/renderer/index.js
index 98f9a40c2..0d6847438 100644
--- a/src/renderer/index.js
+++ b/src/renderer/index.js
@@ -17,7 +17,7 @@ import {
doOpenModal,
doHideModal,
} from 'redux/actions/app';
-import { doToast, doBlackListedOutpointsSubscribe, isURIValid } from 'lbry-redux';
+import { doToast, doBlackListedOutpointsSubscribe, isURIValid, setSearchApi } from 'lbry-redux';
import { doNavigate } from 'redux/actions/navigation';
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
import { doAuthenticate, Lbryio, rewards } from 'lbryinc';
@@ -37,6 +37,10 @@ if (process.env.LBRY_API_URL) {
Lbryio.setLocalApi(process.env.LBRY_API_URL);
}
+if (process.env.SEARCH_API_URL) {
+ setSearchApi(process.env.SEARCH_API_URL);
+}
+
// We need to override Lbryio for getting/setting the authToken
// We interect with ipcRenderer to get the auth key from a users keyring
// We keep a local variable for authToken beacuse `ipcRenderer.send` does not
From ae6254d87016e89a4cac223d0f7951e0e9e98748 Mon Sep 17 00:00:00 2001
From: Sean Yesmunt
Date: Tue, 29 Jan 2019 11:49:03 -0500
Subject: [PATCH 03/19] update lbry-redux
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 99a791adb..54f152200 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,7 @@
"hast-util-sanitize": "^1.1.2",
"keytar": "^4.2.1",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
- "lbry-redux": "lbryio/lbry-redux#2ff9f70a3d765946a1c83c8e7eee7d81c96c1345",
+ "lbry-redux": "lbryio/lbry-redux#973bbd780a774ba48f4e22861b6accb706cf3835",
"lbryinc": "lbryio/lbryinc#83c275da7a44f346ce9e796d06f30126f02b4c63",
"localforage": "^1.7.1",
"mammoth": "^1.4.6",
diff --git a/yarn.lock b/yarn.lock
index aedf44d38..a21e9506b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5723,17 +5723,17 @@ lazy-val@^1.0.3:
tar-stream "^1.6.2"
zstd-codec "^0.1.1"
-lbry-redux@lbryio/lbry-redux#2ff9f70a3d765946a1c83c8e7eee7d81c96c1345:
+lbry-redux@lbryio/lbry-redux#84b7d396934d57a37802aadbef71db91230a9404:
version "0.0.1"
- resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/2ff9f70a3d765946a1c83c8e7eee7d81c96c1345"
+ resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/84b7d396934d57a37802aadbef71db91230a9404"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"
uuid "^3.3.2"
-lbry-redux@lbryio/lbry-redux#84b7d396934d57a37802aadbef71db91230a9404:
+lbry-redux@lbryio/lbry-redux#973bbd780a774ba48f4e22861b6accb706cf3835:
version "0.0.1"
- resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/84b7d396934d57a37802aadbef71db91230a9404"
+ resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/973bbd780a774ba48f4e22861b6accb706cf3835"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"
From d43a40baf04d714949d96353cae46498f1114792 Mon Sep 17 00:00:00 2001
From: Sean Yesmunt
Date: Thu, 24 Jan 2019 16:20:43 -0500
Subject: [PATCH 04/19] fix: limit category list to 10 items
---
src/renderer/component/categoryList/view.jsx | 15 +++++++++--
src/renderer/page/discover/view.jsx | 28 +++++++-------------
2 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/src/renderer/component/categoryList/view.jsx b/src/renderer/component/categoryList/view.jsx
index 1e489e282..035c27697 100644
--- a/src/renderer/component/categoryList/view.jsx
+++ b/src/renderer/component/categoryList/view.jsx
@@ -272,13 +272,24 @@ class CategoryList extends PureComponent {
) : (
+ {/*
+ `names` and `channelClaims` should be combined
+ it's set up to take a list of names (uris) to show as cards
+ or a channel link, which it uses for fetch a list of names
+ having both makes it really confusing
+
+ will come back to this once we determine how we will receive channel links
+ from the homepage uris api call
+ - sean
+ */}
{names &&
- names.length &&
+ !!names.length &&
names.map(name => (
))}
- {channelClaims &&
+ {(!names || !names.length) &&
+ channelClaims &&
channelClaims.length &&
channelClaims
// Only show the first 10 claims, regardless of the amount we have on a channel page
diff --git a/src/renderer/page/discover/view.jsx b/src/renderer/page/discover/view.jsx
index cda386f35..2e1ab0430 100644
--- a/src/renderer/page/discover/view.jsx
+++ b/src/renderer/page/discover/view.jsx
@@ -18,7 +18,7 @@ class DiscoverPage extends React.PureComponent {
this.continousFetch = undefined;
}
- componentWillMount() {
+ componentDidMount() {
const { fetchFeaturedUris, fetchRewardedContent, fetchRewards } = this.props;
fetchFeaturedUris();
fetchRewardedContent();
@@ -59,27 +59,19 @@ class DiscoverPage extends React.PureComponent {
const { featuredUris, fetchingFeaturedUris } = this.props;
const hasContent = typeof featuredUris === 'object' && Object.keys(featuredUris).length;
const failedToLoad = !fetchingFeaturedUris && !hasContent;
+
return (
{hasContent &&
- Object.keys(featuredUris).map(
- category =>
- featuredUris[category].length ? (
-
- ) : (
-
- )
- )}
+ Object.keys(featuredUris).map(category => (
+
+ ))}
{failedToLoad &&
{__('Failed to load landing content.')}
}
);
From b5d7a2b88416e9d0c79635151907544517915331 Mon Sep 17 00:00:00 2001
From: Sean Yesmunt
Date: Fri, 25 Jan 2019 13:10:10 -0500
Subject: [PATCH 05/19] remove unused packages, remove slow getVisibility
tooltip function
---
package.json | 7 +-
src/renderer/component/categoryList/view.jsx | 1 +
src/renderer/component/common/tooltip.jsx | 59 ----------
src/renderer/store.js | 8 --
yarn.lock | 111 +++----------------
5 files changed, 18 insertions(+), 168 deletions(-)
diff --git a/package.json b/package.json
index 54f152200..f409843f1 100644
--- a/package.json
+++ b/package.json
@@ -62,8 +62,8 @@
"node-fetch": "^2.3.0",
"qrcode.react": "^0.8.0",
"rc-progress": "^2.0.6",
- "react": "^16.3.0",
- "react-dom": "^16.3.0",
+ "react": "^16.6.0",
+ "react-dom": "^16.6.0",
"react-feather": "^1.0.8",
"react-modal": "^3.1.7",
"react-paginate": "^5.2.1",
@@ -71,9 +71,7 @@
"react-redux": "^5.0.3",
"react-simplemde-editor": "^3.6.16",
"react-toggle": "^4.0.2",
- "react-transition-group": "1.x",
"redux": "^3.6.0",
- "redux-logger": "^3.0.1",
"redux-persist": "^4.8.0",
"redux-persist-transform-compress": "^4.2.0",
"redux-persist-transform-filter": "0.0.16",
@@ -84,7 +82,6 @@
"render-media": "^3.1.0",
"reselect": "^3.0.0",
"semver": "^5.3.0",
- "shapeshift.io": "^1.3.1",
"source-map-support": "^0.5.4",
"stream-to-blob-url": "^2.1.1",
"three": "^0.93.0",
diff --git a/src/renderer/component/categoryList/view.jsx b/src/renderer/component/categoryList/view.jsx
index 035c27697..b85727ad5 100644
--- a/src/renderer/component/categoryList/view.jsx
+++ b/src/renderer/component/categoryList/view.jsx
@@ -241,6 +241,7 @@ class CategoryList extends PureComponent {
)}
{isCommunityTopBids && (
{
};
}
- componentDidMount() {
- this.handleVisibility();
- }
-
- getVisibility = () => {
- if (!this.tooltip) {
- return;
- }
-
- const node = this.tooltip;
- const rect = node.getBoundingClientRect();
-
- // Get parent-container
- const viewport = document.getElementById('content');
- if (!viewport) {
- throw Error('Document must contain parent div with #content');
- }
-
- const visibility = {
- top: rect.top >= 0,
- left: rect.left >= 0,
- right: rect.right <= viewport.offsetWidth,
- bottom: rect.bottom <= viewport.offsetHeight,
- };
-
- return visibility;
- };
-
- invertDirection = () => {
- // Get current direction
- const { direction } = this.state;
- // Inverted directions
- const directions = {
- top: 'bottom',
- left: 'right',
- right: 'left',
- bottom: 'top',
- };
-
- const inverted = directions[direction];
-
- // Update direction
- if (inverted) {
- this.setState({ direction: inverted });
- }
- };
-
- handleVisibility = () => {
- const { direction } = this.state;
- const visibility = this.getVisibility();
-
- // Invert direction if tooltip is outside viewport bounds
- if (!visibility || !visibility[direction]) {
- this.invertDirection();
- }
- };
-
tooltip: ?HTMLSpanElement;
render() {
@@ -98,8 +41,6 @@ class ToolTip extends React.PureComponent {
return (
=0.10.0"
-
isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
@@ -6375,12 +6335,6 @@ mimic-response@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"
-min-document@^2.19.0:
- version "2.19.0"
- resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"
- dependencies:
- dom-walk "^0.1.0"
-
minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
@@ -6643,7 +6597,7 @@ node-emoji@^1.4.1:
dependencies:
lodash.toarray "^4.4.0"
-node-fetch@^1.0.1, node-fetch@^1.3.3:
+node-fetch@^1.3.3:
version "1.7.3"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef"
dependencies:
@@ -7199,13 +7153,6 @@ parse-glob@^3.0.4:
is-extglob "^1.0.0"
is-glob "^2.0.0"
-parse-headers@^2.0.0:
- version "2.0.1"
- resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.1.tgz#6ae83a7aa25a9d9b700acc28698cd1f1ed7e9536"
- dependencies:
- for-each "^0.3.2"
- trim "0.0.1"
-
parse-json@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9"
@@ -7726,10 +7673,6 @@ process@^0.11.0, process@^0.11.10:
version "0.11.10"
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
-process@~0.5.1:
- version "0.5.2"
- resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf"
-
progress-stream@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/progress-stream/-/progress-stream-1.2.0.tgz#2cd3cfea33ba3a89c9c121ec3347abe9ab125f77"
@@ -7948,14 +7891,14 @@ rc@^1.0.1, rc@^1.1.2, rc@^1.1.6, rc@^1.2.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"
-react-dom@^16.3.0:
- version "16.4.1"
- resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.4.1.tgz#7f8b0223b3a5fbe205116c56deb85de32685dad6"
+react-dom@^16.5.0:
+ version "16.7.0"
+ resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.7.0.tgz#a17b2a7ca89ee7390bc1ed5eb81783c7461748b8"
dependencies:
- fbjs "^0.8.16"
loose-envify "^1.1.0"
object-assign "^4.1.1"
- prop-types "^15.6.0"
+ prop-types "^15.6.2"
+ scheduler "^0.12.0"
react-feather@^1.0.8:
version "1.1.1"
@@ -8042,14 +7985,14 @@ react@^0.14.5:
envify "^3.0.0"
fbjs "^0.6.1"
-react@^16.3.0:
- version "16.6.1"
- resolved "https://registry.yarnpkg.com/react/-/react-16.6.1.tgz#ee2aef4f0a09e494594882029821049772f915fe"
+react@^16.5.0:
+ version "16.7.0"
+ resolved "https://registry.yarnpkg.com/react/-/react-16.7.0.tgz#b674ec396b0a5715873b350446f7ea0802ab6381"
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
- scheduler "^0.11.0"
+ scheduler "^0.12.0"
read-config-file@3.1.0, read-config-file@^3.0.0:
version "3.1.0"
@@ -8415,7 +8358,7 @@ replace-ext@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"
-request@^2.45.0, request@^2.55.0:
+request@^2.45.0:
version "2.87.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.87.0.tgz#32f00235cd08d482b4d0d68db93a829c0ed5756e"
dependencies:
@@ -8640,9 +8583,9 @@ sax@~1.1.1:
version "1.1.6"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.1.6.tgz#5d616be8a5e607d54e114afae55b7eaf2fcc3240"
-scheduler@^0.11.0:
- version "0.11.0"
- resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.11.0.tgz#def1f1bfa6550cc57981a87106e65e8aea41a6b5"
+scheduler@^0.12.0:
+ version "0.12.0"
+ resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.12.0.tgz#8ab17699939c0aedc5a196a657743c496538647b"
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
@@ -8780,7 +8723,7 @@ set-value@^2.0.0:
is-plain-object "^2.0.3"
split-string "^3.0.1"
-setimmediate@^1.0.4, setimmediate@^1.0.5, setimmediate@~1.0.4:
+setimmediate@^1.0.4, setimmediate@~1.0.4:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
@@ -8811,13 +8754,6 @@ shallow-clone@^1.0.0:
kind-of "^5.0.0"
mixin-object "^2.0.1"
-shapeshift.io@^1.3.1:
- version "1.3.1"
- resolved "https://registry.yarnpkg.com/shapeshift.io/-/shapeshift.io-1.3.1.tgz#939f7d89e6a93fad4b556567d3fcdab45d5cc021"
- dependencies:
- request "^2.55.0"
- xhr "^2.0.1"
-
shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
@@ -9731,10 +9667,6 @@ typo-js@*:
version "1.0.3"
resolved "https://registry.yarnpkg.com/typo-js/-/typo-js-1.0.3.tgz#54d8ebc7949f1a7810908b6002c6841526c99d5a"
-ua-parser-js@^0.7.18:
- version "0.7.19"
- resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b"
-
ua-parser-js@^0.7.9:
version "0.7.18"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed"
@@ -10319,10 +10251,6 @@ websocket-extensions@>=0.1.1:
version "0.1.3"
resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29"
-whatwg-fetch@>=0.10.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb"
-
whatwg-fetch@^0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz#0e3684c6cb9995b43efc9df03e4c365d95fd9cc0"
@@ -10424,15 +10352,6 @@ xdg-basedir@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4"
-xhr@^2.0.1:
- version "2.5.0"
- resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.5.0.tgz#bed8d1676d5ca36108667692b74b316c496e49dd"
- dependencies:
- global "~4.3.0"
- is-function "^1.0.1"
- parse-headers "^2.0.0"
- xtend "^4.0.0"
-
xml2js@0.4.17:
version "0.4.17"
resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.17.tgz#17be93eaae3f3b779359c795b419705a8817e868"
From 0f60b011551df7832306d5861e6df3bdce2b5901 Mon Sep 17 00:00:00 2001
From: Derek Yesmunt
Date: Tue, 29 Jan 2019 23:15:01 -0500
Subject: [PATCH 06/19] fix: reset time to zero on file end
---
src/renderer/component/fileViewer/internal/player.jsx | 10 +++-------
src/renderer/component/fileViewer/view.jsx | 5 ++++-
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/renderer/component/fileViewer/internal/player.jsx b/src/renderer/component/fileViewer/internal/player.jsx
index 6d3f37054..44407ae24 100644
--- a/src/renderer/component/fileViewer/internal/player.jsx
+++ b/src/renderer/component/fileViewer/internal/player.jsx
@@ -48,6 +48,7 @@ class MediaPlayer extends React.PureComponent {
claim,
onStartCb,
onFinishCb,
+ savePosition,
} = this.props;
const loadedMetadata = () => {
@@ -95,13 +96,7 @@ class MediaPlayer extends React.PureComponent {
if (position) {
mediaElement.currentTime = position;
}
- mediaElement.addEventListener('timeupdate', () =>
- this.props.savePosition(
- claim.claim_id,
- `${claim.txid}:${claim.nout}`,
- mediaElement.currentTime
- )
- );
+ mediaElement.addEventListener('timeupdate', () => savePosition(mediaElement.currentTime));
mediaElement.addEventListener('click', this.togglePlayListener);
mediaElement.addEventListener('loadedmetadata', loadedMetadata.bind(this), {
once: true,
@@ -110,6 +105,7 @@ class MediaPlayer extends React.PureComponent {
if (onFinishCb) {
onFinishCb();
}
+ savePosition(0);
});
mediaElement.addEventListener('webkitfullscreenchange', win32FullScreenChange.bind(this));
mediaElement.addEventListener('volumechange', () => {
diff --git a/src/renderer/component/fileViewer/view.jsx b/src/renderer/component/fileViewer/view.jsx
index da15be1f5..fd916704b 100644
--- a/src/renderer/component/fileViewer/view.jsx
+++ b/src/renderer/component/fileViewer/view.jsx
@@ -18,6 +18,7 @@ type Props = {
written_bytes: number,
download_path: string,
completed: boolean,
+ blobs_completed: number,
},
fileInfoErrors: ?{
[string]: boolean,
@@ -259,7 +260,9 @@ class FileViewer extends React.PureComponent {
downloadCompleted={fileInfo.completed}
changeVolume={changeVolume}
volume={volume}
- savePosition={savePosition}
+ savePosition={newPosition =>
+ savePosition(claim.claim_id, `${claim.txid}:${claim.nout}`, newPosition)
+ }
claim={claim}
uri={uri}
position={position}
From a930c2fe84b0634f61325ff1e318c83cbedb122f Mon Sep 17 00:00:00 2001
From: Derek Yesmunt
Date: Tue, 29 Jan 2019 23:26:01 -0500
Subject: [PATCH 07/19] chore: update changelog
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6a47b108b..a1b8df229 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Flow errors ([#2213](https://github.com/lbryio/lbry-desktop/pull/2213))
+- Video position on previously viewed files ([#2240](https://github.com/lbryio/lbry-desktop/pull/2240))
## [0.27.1] - 2018-01-22
From 525de82d36ad8251c0ae3714d08732c339d0d4f1 Mon Sep 17 00:00:00 2001
From: Thomas Zarebczan
Date: Wed, 30 Jan 2019 00:35:36 -0500
Subject: [PATCH 08/19] feat: add mouse navigation Simple support for
back/forward mouse buttons. Need to test on Mac and Linux.
---
src/main/createWindow.js | 11 +++++++++++
src/renderer/index.js | 10 +++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/main/createWindow.js b/src/main/createWindow.js
index b26ada7e0..df36a782c 100644
--- a/src/main/createWindow.js
+++ b/src/main/createWindow.js
@@ -73,6 +73,17 @@ export default appState => {
setupBarMenu();
+ window.on('app-command', function(e, cmd) {
+ switch (cmd) {
+ case 'browser-backward':
+ window.webContents.send('navigate-backward', null);
+ return;
+ case 'browser-forward':
+ window.webContents.send('navigate-forward', null);
+ return;
+ }
+ });
+
window.on('close', event => {
if (!appState.isQuitting && !appState.autoUpdateAccepted) {
event.preventDefault();
diff --git a/src/renderer/index.js b/src/renderer/index.js
index 0d6847438..0f4b8d98f 100644
--- a/src/renderer/index.js
+++ b/src/renderer/index.js
@@ -18,7 +18,7 @@ import {
doHideModal,
} from 'redux/actions/app';
import { doToast, doBlackListedOutpointsSubscribe, isURIValid, setSearchApi } from 'lbry-redux';
-import { doNavigate } from 'redux/actions/navigation';
+import { doNavigate, doHistoryBack, doHistoryForward } from 'redux/actions/navigation';
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
import { doAuthenticate, Lbryio, rewards } from 'lbryinc';
import 'scss/all.scss';
@@ -41,6 +41,14 @@ if (process.env.SEARCH_API_URL) {
setSearchApi(process.env.SEARCH_API_URL);
}
+ipcRenderer.on('navigate-backward', () => {
+ app.store.dispatch(doHistoryBack());
+});
+
+ipcRenderer.on('navigate-forward', () => {
+ app.store.dispatch(doHistoryForward());
+});
+
// We need to override Lbryio for getting/setting the authToken
// We interect with ipcRenderer to get the auth key from a users keyring
// We keep a local variable for authToken beacuse `ipcRenderer.send` does not
From 720e2e7309fd8db8ac2e022bb79d5cde9b34b6c9 Mon Sep 17 00:00:00 2001
From: Sean Yesmunt
Date: Wed, 30 Jan 2019 01:33:48 -0500
Subject: [PATCH 09/19] fix: yrbl style on subscriptions page
---
src/renderer/component/common/yrbl.jsx | 4 +-
src/renderer/component/firstRun/view.jsx | 2 +-
.../page/subscriptions/internal/first-run.jsx | 61 +++++++++----------
3 files changed, 32 insertions(+), 35 deletions(-)
diff --git a/src/renderer/component/common/yrbl.jsx b/src/renderer/component/common/yrbl.jsx
index e982d2b69..dded77f12 100644
--- a/src/renderer/component/common/yrbl.jsx
+++ b/src/renderer/component/common/yrbl.jsx
@@ -1,10 +1,10 @@
// @flow
-import React from 'react';
+import * as React from 'react';
import Native from 'native';
type Props = {
title: string,
- subtitle: string,
+ subtitle: string | React.Node,
type: string,
};
diff --git a/src/renderer/component/firstRun/view.jsx b/src/renderer/component/firstRun/view.jsx
index 8f165d298..f880bf355 100644
--- a/src/renderer/component/firstRun/view.jsx
+++ b/src/renderer/component/firstRun/view.jsx
@@ -101,7 +101,7 @@ export default class FirstRun extends PureComponent {
{__('You Are Awesome!')}
-
{__("Check out some of the neat files below me. I'll see you around!")}
+
{__("Check out some of the neat content below me. I'll see you around!")}
diff --git a/src/renderer/page/subscriptions/internal/first-run.jsx b/src/renderer/page/subscriptions/internal/first-run.jsx
index 12b2f330f..e4dbadb90 100644
--- a/src/renderer/page/subscriptions/internal/first-run.jsx
+++ b/src/renderer/page/subscriptions/internal/first-run.jsx
@@ -1,8 +1,8 @@
// @flow
import React, { Fragment } from 'react';
-import Native from 'native';
import Button from 'component/button';
import SuggestedSubscriptions from 'component/subscribeSuggested';
+import Yrbl from 'component/common/yrbl';
type Props = {
showSuggested: boolean,
@@ -23,40 +23,37 @@ export default (props: Props) => {
return (
-
- {/*
- `names` and `channelClaims` should be combined
- it's set up to take a list of names (uris) to show as cards
- or a channel link, which it uses for fetch a list of names
- having both makes it really confusing
-
- will come back to this once we determine how we will receive channel links
- from the homepage uris api call
- - sean
- */}
- {names &&
- !!names.length &&
- names.map(name => (
-
+ {urisInList &&
+ urisInList.map(uri => (
+
))}
- {(!names || !names.length) &&
- channelClaims &&
- channelClaims.length &&
- channelClaims
- // Only show the first 10 claims, regardless of the amount we have on a channel page
- .slice(0, 10)
- .map(claim => (
-
- ))}
- {/*
- If there aren't any uris passed in, create an empty array and render placeholder cards
- channelClaims or names are being fetched
- */}
- {!channelClaims &&
- !names &&
+ {!urisInList &&
/* eslint-disable react/no-array-index-key */
new Array(10).fill(1).map((x, i) => )
/* eslint-enable react/no-array-index-key */
diff --git a/src/renderer/component/fileCard/view.jsx b/src/renderer/component/fileCard/view.jsx
index 3d980d5a7..931b28557 100644
--- a/src/renderer/component/fileCard/view.jsx
+++ b/src/renderer/component/fileCard/view.jsx
@@ -29,19 +29,25 @@ type Props = {
isSubscribed: boolean,
isNew: boolean,
placeholder: boolean,
+ preventResolve: boolean,
};
class FileCard extends React.PureComponent {
static defaultProps = {
placeholder: false,
+ preventResolve: false,
};
- componentWillMount() {
- this.resolve(this.props);
+ componentDidMount() {
+ if (!this.props.preventResolve) {
+ this.resolve(this.props);
+ }
}
- componentWillReceiveProps(nextProps: Props) {
- this.resolve(nextProps);
+ componentDidUpdate() {
+ if (!this.props.preventResolve) {
+ this.resolve(this.props);
+ }
}
resolve = (props: Props) => {
@@ -74,7 +80,7 @@ class FileCard extends React.PureComponent {
return null;
}
- if ((!claim && !pending) || placeholder) {
+ if (!claim && (!pending || placeholder)) {
return (