reverts electron updates testing

This commit is contained in:
zeppi 2022-02-23 12:36:55 -05:00
parent 72310710af
commit bf87ac08db
8 changed files with 50 additions and 30 deletions

View file

@ -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"

View file

@ -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;

View file

@ -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 = (
<p>
{!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 })}
</p>
);
const seeReleaseNotes = (
@ -32,10 +34,47 @@ const LastReleaseChanges = (props: Props) => {
</p>
);
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 <p>{__('Loading...')}</p>;
}
if (fetchReleaseFailed) {
return (
<div>
{releaseVersionTitle}
{seeReleaseNotes}
</div>
);
}
return (
<div className="release__notes">
{releaseVersionTitle}
<p className="last-release-changes" dangerouslySetInnerHTML={{ __html: releaseNotes }} />
<p>
<MarkdownPreview content={releaseChanges} />
</p>
{seeReleaseNotes}
</div>
);

View file

@ -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,
},
});
});

View file

@ -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) =>

View file

@ -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) => {

View file

@ -70,4 +70,3 @@
@import 'component/utils';
@import 'component/settings';
@import 'component/embed-player';
@import 'component/last-release-changes';

View file

@ -1,5 +0,0 @@
.last-release-changes {
a {
@extend .button--link;
}
}