From 73bc6afa3e2519f5c8cf33962ab48c2dfa8040ac Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Mon, 20 Aug 2018 17:48:14 -0400 Subject: [PATCH 01/13] feat: add publish success notification When a file is confirmed, create a desktop notification with the claim name and ability to click the notification to view the claim --- src/renderer/redux/actions/publish.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/renderer/redux/actions/publish.js b/src/renderer/redux/actions/publish.js index 72926928b..ffe8ca435 100644 --- a/src/renderer/redux/actions/publish.js +++ b/src/renderer/redux/actions/publish.js @@ -14,6 +14,8 @@ import type { UpdatePublishFormAction, PublishParams, } from 'redux/reducers/publish'; +import { selectosNotificationsEnabled } from 'redux/selectors/settings'; +import { doNavigate } from 'redux/actions/navigation'; import fs from 'fs'; import path from 'path'; @@ -274,6 +276,19 @@ export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetS }); delete pendingPublishMap[claim.name]; + if (selectosNotificationsEnabled(getState())) { + const notif = new window.Notification('LBRY Publish Complete', { + body: `${claim.name} has been published successfully, click here to view it.` , + silent: false, + }); + notif.onclick = () => { + dispatch( + doNavigate('/show', { + uri: claim.name, + }) + ); + }; + } } }); From f60531183d4240bba63d81688a05798732d8590b Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 21 Aug 2018 00:23:52 -0400 Subject: [PATCH 02/13] use correct url for recommended content on vanity claims --- src/renderer/page/file/view.jsx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/renderer/page/file/view.jsx b/src/renderer/page/file/view.jsx index 8e0ab3da2..6cd38b050 100644 --- a/src/renderer/page/file/view.jsx +++ b/src/renderer/page/file/view.jsx @@ -97,10 +97,13 @@ class FilePage extends React.Component { checkSubscription = (props: Props) => { if (props.subscriptions.find(sub => sub.channelName === props.claim.channel_name)) { props.checkSubscription( - buildURI({ - contentName: props.claim.channel_name, - claimId: props.claim.value.publisherSignature.certificateId, - }, false) + buildURI( + { + contentName: props.claim.channel_name, + claimId: props.claim.value.publisherSignature.certificateId, + }, + false + ) ); } }; @@ -157,6 +160,13 @@ class FilePage extends React.Component { editUri = buildURI(uriObject); } + let recommendedUri = uri; + if (!recommendedUri.includes('#')) { + // at a vanity url + // append the claim ID so we can properly strip it out of reccomended videos + recommendedUri = `${recommendedUri}#${claim.claim_id}`; + } + return (
@@ -241,7 +251,7 @@ class FilePage extends React.Component {
- +
); } From 6023b32c275302e57f5e4f7bd292a1462d44a085 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Tue, 21 Aug 2018 09:51:35 -0400 Subject: [PATCH 03/13] add title to message --- src/renderer/redux/actions/publish.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/redux/actions/publish.js b/src/renderer/redux/actions/publish.js index ffe8ca435..1ab5dcab6 100644 --- a/src/renderer/redux/actions/publish.js +++ b/src/renderer/redux/actions/publish.js @@ -278,7 +278,7 @@ export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetS delete pendingPublishMap[claim.name]; if (selectosNotificationsEnabled(getState())) { const notif = new window.Notification('LBRY Publish Complete', { - body: `${claim.name} has been published successfully, click here to view it.` , + body: `${claim.value.stream.metadata.title} has been published to lbry://${claim.name}. Click here to view it` , silent: false, }); notif.onclick = () => { From 9f3fa5d4e411f0ded0735f93b5074a423d43b215 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Tue, 21 Aug 2018 10:46:53 -0400 Subject: [PATCH 04/13] remove node_id per https://github.com/lbryio/internal-apis/commit/3f7bd0d969e18742fa326fa9d724e4d33e1122da --- src/renderer/redux/actions/user.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/renderer/redux/actions/user.js b/src/renderer/redux/actions/user.js index dcd074c7d..1da868a8f 100644 --- a/src/renderer/redux/actions/user.js +++ b/src/renderer/redux/actions/user.js @@ -40,7 +40,6 @@ export function doInstallNew() { const payload = { app_version: pjson.version }; Lbry.status().then(status => { payload.app_id = status.installation_id; - payload.node_id = status.lbry_id; Lbry.version().then(version => { payload.daemon_version = version.lbrynet_version; payload.operating_system = version.os_system; From ae27646d1a88eea965bd6f3097d5597ad711d8f2 Mon Sep 17 00:00:00 2001 From: kodxana Date: Tue, 21 Aug 2018 17:35:14 +0200 Subject: [PATCH 05/13] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 04616e269..a18224f5d 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ To install from source or make changes to the application, continue to the next **Community maintained** builds for Arch Linux and Flatpak are available, see below. These installs will need to be updated manually as the in-app update process only supports deb installs at this time. *Note: If coming from a deb install, the directory structure is different and you'll need to [migrate data](https://lbry.io/faq/backup-data).* -| | Flatpak | Arch -| --------------------- | ------------------------------------------| -------------------------------------------- -| Latest Release | [FlatHub Page](https://flathub.org/apps/details/io.lbry.lbry-app) | [AUR Package](https://aur.archlinux.org/packages/lbry-app-bin/) -| Maintainers | [@choofee](https://github.com/choffee)/[@iuyte](https://github.com/iuyte) | [@kcseb](https://github.com/kcseb)/[@TimurKiyivinski](https://github.com/TimurKiyivinski) +| | Flatpak | Arch | Raspberry Pi | +| --------------------- | ------------------------------------------|------------------| -------------------------------------------- +| Latest Release | [FlatHub Page](https://flathub.org/apps/details/io.lbry.lbry-app) | [AUR Package](https://aur.archlinux.org/packages/lbry-app-bin/) | [Deb installer](https://lbrypi.com) | +| Maintainers | [@choofee](https://github.com/choffee)/[@iuyte](https://github.com/iuyte) | [@kcseb](https://github.com/kcseb)/[@TimurKiyivinski](https://github.com/TimurKiyivinski) |[@Madiator2011](https://github.com/kodxana) ## Usage Double click the installed application to browse with the LBRY network. From 7e5a8c186485f8f44b861756a77fc99f2da82f65 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Tue, 21 Aug 2018 11:39:49 -0400 Subject: [PATCH 06/13] nevermind, adding node_id back With the correct value --- src/renderer/redux/actions/user.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/renderer/redux/actions/user.js b/src/renderer/redux/actions/user.js index 1da868a8f..eac36ed93 100644 --- a/src/renderer/redux/actions/user.js +++ b/src/renderer/redux/actions/user.js @@ -40,6 +40,7 @@ export function doInstallNew() { const payload = { app_version: pjson.version }; Lbry.status().then(status => { payload.app_id = status.installation_id; + payload.node_id = status.dht.node_id; Lbry.version().then(version => { payload.daemon_version = version.lbrynet_version; payload.operating_system = version.os_system; From c15c9e25c6c1265f532b772c2593646ea39d3882 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Tue, 21 Aug 2018 11:42:45 -0400 Subject: [PATCH 07/13] changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36bf0221e..8b35537de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,13 +13,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). * New viewer for human-readable text files ([#1826](https://github.com/lbryio/lbry-desktop/pull/1826)) * CSV and JSON viewer ([#1410](https://github.com/lbryio/lbry-desktop/pull/1410)) * Recommended content on file viewer page ([#1845](https://github.com/lbryio/lbry-desktop/pull/1845)) + * Desktop notification when publish is completed ([#1892](https://github.com/lbryio/lbry-desktop/pull/1892)) ### Changed * Pass error message from spee.ch API during thumbnail upload ([#1840](https://github.com/lbryio/lbry-desktop/pull/1840)) * Use router pattern for rendering file viewer ([#1544](https://github.com/lbryio/lbry-desktop/pull/1544)) * Missing word "to" added to the Bid Help Text (#1854) * Updated to electron@2 ([#1858](https://github.com/lbryio/lbry-desktop/pull/1858)) - + ### Fixed From fdbd9d5b1fc785ae69fe9b4b0a8379b049b75f59 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Tue, 21 Aug 2018 11:48:29 -0400 Subject: [PATCH 08/13] minor copy change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a18224f5d..29872a828 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ To install from source or make changes to the application, continue to the next | | Flatpak | Arch | Raspberry Pi | | --------------------- | ------------------------------------------|------------------| -------------------------------------------- -| Latest Release | [FlatHub Page](https://flathub.org/apps/details/io.lbry.lbry-app) | [AUR Package](https://aur.archlinux.org/packages/lbry-app-bin/) | [Deb installer](https://lbrypi.com) | +| Latest Release | [FlatHub Page](https://flathub.org/apps/details/io.lbry.lbry-app) | [AUR Package](https://aur.archlinux.org/packages/lbry-app-bin/) | [Pi Installer](https://lbrypi.com) | | Maintainers | [@choofee](https://github.com/choffee)/[@iuyte](https://github.com/iuyte) | [@kcseb](https://github.com/kcseb)/[@TimurKiyivinski](https://github.com/TimurKiyivinski) |[@Madiator2011](https://github.com/kodxana) ## Usage From e232b5b0d448b03070f58852fe737160b21af456 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Tue, 21 Aug 2018 12:18:10 -0400 Subject: [PATCH 09/13] check for status.dht --- src/renderer/redux/actions/user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/redux/actions/user.js b/src/renderer/redux/actions/user.js index eac36ed93..963e503c9 100644 --- a/src/renderer/redux/actions/user.js +++ b/src/renderer/redux/actions/user.js @@ -40,7 +40,7 @@ export function doInstallNew() { const payload = { app_version: pjson.version }; Lbry.status().then(status => { payload.app_id = status.installation_id; - payload.node_id = status.dht.node_id; + if (status.dht) payload.node_id = status.dht.node_id; Lbry.version().then(version => { payload.daemon_version = version.lbrynet_version; payload.operating_system = version.os_system; From 0facccd4878e14088cc4d40ff0937ff1dbcaf767 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 21 Aug 2018 00:22:47 -0400 Subject: [PATCH 10/13] use correct url for recommended conent on vanity claims --- src/renderer/page/file/view.jsx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/renderer/page/file/view.jsx b/src/renderer/page/file/view.jsx index 8e0ab3da2..6cd38b050 100644 --- a/src/renderer/page/file/view.jsx +++ b/src/renderer/page/file/view.jsx @@ -97,10 +97,13 @@ class FilePage extends React.Component { checkSubscription = (props: Props) => { if (props.subscriptions.find(sub => sub.channelName === props.claim.channel_name)) { props.checkSubscription( - buildURI({ - contentName: props.claim.channel_name, - claimId: props.claim.value.publisherSignature.certificateId, - }, false) + buildURI( + { + contentName: props.claim.channel_name, + claimId: props.claim.value.publisherSignature.certificateId, + }, + false + ) ); } }; @@ -157,6 +160,13 @@ class FilePage extends React.Component { editUri = buildURI(uriObject); } + let recommendedUri = uri; + if (!recommendedUri.includes('#')) { + // at a vanity url + // append the claim ID so we can properly strip it out of reccomended videos + recommendedUri = `${recommendedUri}#${claim.claim_id}`; + } + return (
@@ -241,7 +251,7 @@ class FilePage extends React.Component {
- +
); } From 596fdc79abbb623c0d4e1e30ecdcd4b00bc3560e Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 21 Aug 2018 15:36:37 -0400 Subject: [PATCH 11/13] new badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29872a828..b2844fec5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/78b627d4f5524792adc48719835e1523)](https://www.codacy.com/app/LBRY/lbry-desktop?utm_source=github.com&utm_medium=referral&utm_content=lbryio/lbry-desktop&utm_campaign=Badge_Grade) [![chat on Discord](https://img.shields.io/discord/362322208485277697.svg?logo=discord)](https://chat.lbry.io) -[![forthebadge](https://forthebadge.com/images/badges/certified-steve-bruhle.svg)](https://forthebadge.com) +[![forthebadge](https://forthebadge.com/images/badges/60-percent-of-the-time-works-every-time.svg)](https://forthebadge.com) The LBRY app is a graphical browser for the decentralized content marketplace provided by the [LBRY](https://lbry.io) protocol. It is essentially the From a166485a788989a37e1bf5e7e14be454eae4c6e8 Mon Sep 17 00:00:00 2001 From: seanyesmunt Date: Tue, 21 Aug 2018 23:59:06 -0400 Subject: [PATCH 12/13] move channel_list call to happen after fetching subscriptions from db --- src/renderer/page/subscriptions/index.js | 3 -- src/renderer/page/subscriptions/view.jsx | 38 --------------------- src/renderer/redux/actions/subscriptions.js | 4 ++- yarn.lock | 4 +-- 4 files changed, 5 insertions(+), 44 deletions(-) diff --git a/src/renderer/page/subscriptions/index.js b/src/renderer/page/subscriptions/index.js index 9963b26e0..d5de2d066 100644 --- a/src/renderer/page/subscriptions/index.js +++ b/src/renderer/page/subscriptions/index.js @@ -6,7 +6,6 @@ import { selectIsFetchingSubscriptions, selectNotifications, } from 'redux/selectors/subscriptions'; -import { doFetchClaimsByChannel } from 'redux/actions/content'; import { setSubscriptionNotifications, doFetchMySubscriptions } from 'redux/actions/subscriptions'; import SubscriptionsPage from './view'; @@ -14,7 +13,6 @@ const select = state => ({ loading: selectIsFetchingSubscriptions(state) || Boolean(Object.keys(selectSubscriptionsBeingFetched(state)).length), - subscriptionsBeingFetched: selectSubscriptionsBeingFetched(state), subscriptions: selectSubscriptions(state), subscriptionClaims: selectSubscriptionClaims(state), notifications: selectNotifications(state), @@ -23,7 +21,6 @@ const select = state => ({ export default connect( select, { - doFetchClaimsByChannel, setSubscriptionNotifications, doFetchMySubscriptions, } diff --git a/src/renderer/page/subscriptions/view.jsx b/src/renderer/page/subscriptions/view.jsx index 60c57cf93..a38556644 100644 --- a/src/renderer/page/subscriptions/view.jsx +++ b/src/renderer/page/subscriptions/view.jsx @@ -6,16 +6,13 @@ import * as NOTIFICATION_TYPES from 'constants/notification_types'; import Button from 'component/button'; import FileList from 'component/fileList'; import type { Claim } from 'types/claim'; -import isDev from 'electron-is-dev'; import HiddenNsfwClaims from 'component/hiddenNsfwClaims'; type Props = { - doFetchClaimsByChannel: (string, number) => void, doFetchMySubscriptions: () => void, setSubscriptionNotifications: ({}) => void, subscriptions: Array, subscriptionClaims: Array<{ uri: string, claims: Array }>, - subscriptionsBeingFetched: {}, notifications: {}, loading: boolean, }; @@ -37,41 +34,6 @@ export default class extends React.PureComponent { setSubscriptionNotifications(newNotifications); } - componentDidUpdate() { - const { - subscriptions, - subscriptionClaims, - doFetchClaimsByChannel, - subscriptionsBeingFetched, - } = this.props; - - const subscriptionClaimMap = {}; - subscriptionClaims.forEach(claim => { - /* - This check added 6/20/18 to fix function receiving empty claims unexpectedly. - The better fix is ensuring channels aren't added to byId if there are no associated claims - We are adding this now with the redesign release to ensure users see the correct subscriptions - */ - if (claim.claims.length) { - subscriptionClaimMap[claim.uri] = 1; - } else if (isDev) { - // eslint-disable no-console - console.error( - `Claim for ${ - claim.uri - } was added to byId in redux but there are no loaded fetched claims. This shouldn't happen because a subscription should have claims attached to it.` - ); - // eslint-enable no-console - } - }); - - subscriptions.forEach(sub => { - if (!subscriptionClaimMap[sub.uri] && !subscriptionsBeingFetched[sub.uri]) { - doFetchClaimsByChannel(sub.uri, 1); - } - }); - } - render() { const { subscriptions, subscriptionClaims, loading } = this.props; diff --git a/src/renderer/redux/actions/subscriptions.js b/src/renderer/redux/actions/subscriptions.js index 2af4d5844..d677d51a6 100644 --- a/src/renderer/redux/actions/subscriptions.js +++ b/src/renderer/redux/actions/subscriptions.js @@ -8,7 +8,7 @@ import type { Subscription } from 'types/subscription'; import { selectSubscriptions } from 'redux/selectors/subscriptions'; import { makeSelectClientSetting } from 'redux/selectors/settings'; import { Lbry, buildURI, parseURI } from 'lbry-redux'; -import { doPurchaseUri } from 'redux/actions/content'; +import { doPurchaseUri, doFetchClaimsByChannel } from 'redux/actions/content'; import { doClaimRewardType } from 'redux/actions/rewards'; import Promise from 'bluebird'; import Lbryio from 'lbryio'; @@ -91,6 +91,8 @@ export const doFetchMySubscriptions = () => (dispatch: Dispatch, getState: () => type: ACTIONS.FETCH_SUBSCRIPTIONS_SUCCESS, data: subscriptions, }); + + subscriptions.forEach(({ uri }) => dispatch(doFetchClaimsByChannel(uri))); }) .catch(() => { dispatch({ diff --git a/yarn.lock b/yarn.lock index 8684ec3eb..d52cf43b2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5651,9 +5651,9 @@ lazy-val@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/lazy-val/-/lazy-val-1.0.3.tgz#bb97b200ef00801d94c317e29dc6ed39e31c5edc" -lbry-redux@lbryio/lbry-redux#ada4880c5d0758c7973aff9d443a87874d98b320: +lbry-redux@lbryio/lbry-redux#31f7afa8a37f5741dac01fc1ecdf153f3bed95dc: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/ada4880c5d0758c7973aff9d443a87874d98b320" + resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/31f7afa8a37f5741dac01fc1ecdf153f3bed95dc" dependencies: proxy-polyfill "0.1.6" reselect "^3.0.0" From ce18339f255efa96151688ae3dcef2ac55ea1fe3 Mon Sep 17 00:00:00 2001 From: seanyesmunt Date: Wed, 22 Aug 2018 01:03:40 -0400 Subject: [PATCH 13/13] add autodownload toggle to subscriptions page --- src/renderer/page/subscriptions/index.js | 5 +++++ src/renderer/page/subscriptions/view.jsx | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/renderer/page/subscriptions/index.js b/src/renderer/page/subscriptions/index.js index d5de2d066..efc00db9b 100644 --- a/src/renderer/page/subscriptions/index.js +++ b/src/renderer/page/subscriptions/index.js @@ -1,4 +1,5 @@ import { connect } from 'react-redux'; +import * as settings from 'constants/settings'; import { selectSubscriptionClaims, selectSubscriptions, @@ -7,6 +8,8 @@ import { selectNotifications, } from 'redux/selectors/subscriptions'; import { setSubscriptionNotifications, doFetchMySubscriptions } from 'redux/actions/subscriptions'; +import { doSetClientSetting } from 'redux/actions/settings'; +import { makeSelectClientSetting } from 'redux/selectors/settings'; import SubscriptionsPage from './view'; const select = state => ({ @@ -16,6 +19,7 @@ const select = state => ({ subscriptions: selectSubscriptions(state), subscriptionClaims: selectSubscriptionClaims(state), notifications: selectNotifications(state), + autoDownload: makeSelectClientSetting(settings.AUTO_DOWNLOAD)(state), }); export default connect( @@ -23,5 +27,6 @@ export default connect( { setSubscriptionNotifications, doFetchMySubscriptions, + doSetClientSetting, } )(SubscriptionsPage); diff --git a/src/renderer/page/subscriptions/view.jsx b/src/renderer/page/subscriptions/view.jsx index a38556644..16f3f1bd0 100644 --- a/src/renderer/page/subscriptions/view.jsx +++ b/src/renderer/page/subscriptions/view.jsx @@ -1,12 +1,14 @@ // @flow import React from 'react'; import Page from 'component/page'; +import * as settings from 'constants/settings'; import type { Subscription } from 'types/subscription'; import * as NOTIFICATION_TYPES from 'constants/notification_types'; import Button from 'component/button'; import FileList from 'component/fileList'; import type { Claim } from 'types/claim'; import HiddenNsfwClaims from 'component/hiddenNsfwClaims'; +import { FormField, FormRow } from 'component/common/form'; type Props = { doFetchMySubscriptions: () => void, @@ -15,9 +17,16 @@ type Props = { subscriptionClaims: Array<{ uri: string, claims: Array }>, notifications: {}, loading: boolean, + autoDownload: boolean, + doSetClientSetting: (string, boolean) => void, }; export default class extends React.PureComponent { + constructor() { + super(); + (this: any).onAutoDownloadChange = this.onAutoDownloadChange.bind(this); + } + componentDidMount() { const { notifications, setSubscriptionNotifications, doFetchMySubscriptions } = this.props; doFetchMySubscriptions(); @@ -34,8 +43,12 @@ export default class extends React.PureComponent { setSubscriptionNotifications(newNotifications); } + onAutoDownloadChange(event: SyntheticInputEvent<*>) { + this.props.doSetClientSetting(settings.AUTO_DOWNLOAD, event.target.checked); + } + render() { - const { subscriptions, subscriptionClaims, loading } = this.props; + const { subscriptions, subscriptionClaims, loading, autoDownload } = this.props; let claimList = []; subscriptionClaims.forEach(claimData => { @@ -47,6 +60,15 @@ export default class extends React.PureComponent { return ( + + + {!subscriptions.length && (
{__("It looks like you aren't subscribed to any channels yet.")}