diff --git a/package.json b/package.json index f28f40c0c..89d1511ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lbry", - "version": "0.52.5-alpha.2", + "version": "0.52.4", "description": "A browser for the LBRY network, a digital marketplace controlled by its users.", "keywords": [ "lbry" diff --git a/ui/component/lastReleaseChanges/index.js b/ui/component/lastReleaseChanges/index.js index a23d1e419..2784fe4d6 100644 --- a/ui/component/lastReleaseChanges/index.js +++ b/ui/component/lastReleaseChanges/index.js @@ -1,12 +1,3 @@ -import { connect } from 'react-redux'; -import { selectRemoteVersion, selectReleaseNotes } from 'redux/selectors/app'; import LastReleaseChanges from './view'; -const select = (state) => ({ - releaseVersion: selectRemoteVersion(state), - releaseNotes: selectReleaseNotes(state), -}); - -const perform = () => ({}); - -export default connect(select, perform)(LastReleaseChanges); +export default LastReleaseChanges; diff --git a/ui/component/lastReleaseChanges/view.jsx b/ui/component/lastReleaseChanges/view.jsx index 62d129538..a41d2c778 100644 --- a/ui/component/lastReleaseChanges/view.jsx +++ b/ui/component/lastReleaseChanges/view.jsx @@ -1,21 +1,23 @@ // @flow -import React from 'react'; +import React, { useState, useEffect } from 'react'; +import MarkdownPreview from 'component/common/markdown-preview'; import Button from 'component/button'; import I18nMessage from 'component/i18nMessage'; type Props = { hideReleaseVersion?: boolean, - releaseVersion: string, - releaseNotes: string, }; const LastReleaseChanges = (props: Props) => { - const { hideReleaseVersion, releaseVersion, releaseNotes } = props; + const { hideReleaseVersion } = props; + const [releaseTag, setReleaseTag] = useState(''); + const [releaseChanges, setReleaseChanges] = useState(''); + const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false); + const [fetchReleaseFailed, setFetchReleaseFailed] = useState(false); const releaseVersionTitle = (

- {!hideReleaseVersion && - __('A new version %release_tag% of LBRY is ready for you.', { release_tag: releaseVersion })} + {!hideReleaseVersion && __('A new version %release_tag% of LBRY is ready for you.', { release_tag: releaseTag })}

); const seeReleaseNotes = ( @@ -32,10 +34,47 @@ const LastReleaseChanges = (props: Props) => {

); + useEffect(() => { + const lastReleaseUrl = 'https://api.github.com/repos/lbryio/lbry-desktop/releases/latest'; + const options = { + method: 'GET', + headers: { Accept: 'application/vnd.github.v3+json' }, + }; + + setFetchingReleaseChanges(true); + fetch(lastReleaseUrl, options) + .then((response) => response.json()) + .then((response) => { + setReleaseTag(response.tag_name); + setReleaseChanges(response.body); + setFetchingReleaseChanges(false); + setFetchReleaseFailed(false); + }) + .catch(() => { + setFetchingReleaseChanges(false); + setFetchReleaseFailed(true); + }); + }, []); + + if (fetchingReleaseChanges) { + return

{__('Loading...')}

; + } + + if (fetchReleaseFailed) { + return ( +
+ {releaseVersionTitle} + {seeReleaseNotes} +
+ ); + } + return (
{releaseVersionTitle} -

+

+ +

{seeReleaseNotes}
); diff --git a/ui/index.jsx b/ui/index.jsx index a3728bc87..cf1589bc7 100644 --- a/ui/index.jsx +++ b/ui/index.jsx @@ -117,13 +117,12 @@ ipcRenderer.on('open-uri-requested', (event, url, newSession) => { handleError(); }); -autoUpdater.on('update-available', (e) => { +autoUpdater.on('update-available', ({ version }) => { app.store.dispatch({ type: ACTIONS.CHECK_UPGRADE_SUCCESS, data: { upgradeAvailable: true, - remoteVersion: e.releaseName || e.version, - releaseNotes: e.releaseNotes, + remoteVersion: version, }, }); }); diff --git a/ui/redux/reducers/app.js b/ui/redux/reducers/app.js index 3dfa90362..6b805dcca 100644 --- a/ui/redux/reducers/app.js +++ b/ui/redux/reducers/app.js @@ -201,7 +201,6 @@ reducers[ACTIONS.CHECK_UPGRADE_SUCCESS] = (state, action) => Object.assign({}, state, { isUpgradeAvailable: action.data.upgradeAvailable, remoteVersion: action.data.remoteVersion, - releaseNotes: action.data.releaseNotes, }); reducers[ACTIONS.CHECK_UPGRADE_SUBSCRIBE] = (state, action) => diff --git a/ui/redux/selectors/app.js b/ui/redux/selectors/app.js index 28d503392..4656d3c92 100644 --- a/ui/redux/selectors/app.js +++ b/ui/redux/selectors/app.js @@ -23,8 +23,6 @@ export const selectHasClickedComment = createSelector(selectState, (state) => st export const selectRemoteVersion = createSelector(selectState, (state) => state.remoteVersion); -export const selectReleaseNotes = createSelector(selectState, (state) => state.releaseNotes); - export const selectIsUpgradeAvailable = createSelector(selectState, (state) => state.isUpgradeAvailable); export const selectUpgradeFilename = createSelector(selectPlatform, selectRemoteVersion, (platform, version) => { diff --git a/ui/scss/all.scss b/ui/scss/all.scss index 7c8f807a6..9deafe5b0 100644 --- a/ui/scss/all.scss +++ b/ui/scss/all.scss @@ -70,4 +70,3 @@ @import 'component/utils'; @import 'component/settings'; @import 'component/embed-player'; -@import 'component/last-release-changes'; diff --git a/ui/scss/component/_last-release-changes.scss b/ui/scss/component/_last-release-changes.scss deleted file mode 100644 index cd8d182ea..000000000 --- a/ui/scss/component/_last-release-changes.scss +++ /dev/null @@ -1,5 +0,0 @@ -.last-release-changes { - a { - @extend .button--link; - } -}