Display release notes and version for Linux installations using .deb packages.
This commit is contained in:
parent
64a2e908ae
commit
1f8c9fd24d
4 changed files with 48 additions and 51 deletions
11
ui/index.jsx
11
ui/index.jsx
|
@ -20,6 +20,7 @@ import {
|
||||||
doHideModal,
|
doHideModal,
|
||||||
doToggle3PAnalytics,
|
doToggle3PAnalytics,
|
||||||
doUpdateDownloadProgress,
|
doUpdateDownloadProgress,
|
||||||
|
doNotifyUpdateAvailable,
|
||||||
} from 'redux/actions/app';
|
} from 'redux/actions/app';
|
||||||
import { isURIValid } from 'util/lbryURI';
|
import { isURIValid } from 'util/lbryURI';
|
||||||
import { setSearchApi } from 'redux/actions/search';
|
import { setSearchApi } from 'redux/actions/search';
|
||||||
|
@ -129,14 +130,8 @@ ipcRenderer.on('open-uri-requested', (event, url, newSession) => {
|
||||||
handleError();
|
handleError();
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-available', ({ version }) => {
|
autoUpdater.on('update-available', (e) => {
|
||||||
app.store.dispatch({
|
app.store.dispatch(doNotifyUpdateAvailable(e));
|
||||||
type: ACTIONS.CHECK_UPGRADE_SUCCESS,
|
|
||||||
data: {
|
|
||||||
upgradeAvailable: true,
|
|
||||||
remoteVersion: version,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('download-progress-update', (e, p) => {
|
ipcRenderer.on('download-progress-update', (e, p) => {
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { selectRemoteVersion } from 'redux/selectors/app';
|
||||||
import { doDownloadUpgrade, doSkipUpgrade, doHideModal } from 'redux/actions/app';
|
import { doDownloadUpgrade, doSkipUpgrade, doHideModal } from 'redux/actions/app';
|
||||||
import ModalUpgrade from './view';
|
import ModalUpgrade from './view';
|
||||||
|
|
||||||
const select = () => ({});
|
const select = (state) => ({
|
||||||
|
releaseVersion: selectRemoteVersion(state),
|
||||||
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = (dispatch) => ({
|
||||||
downloadUpgrade: () => dispatch(doDownloadUpgrade()),
|
downloadUpgrade: () => dispatch(doDownloadUpgrade()),
|
||||||
skipUpgrade: () => {
|
skipUpgrade: () => {
|
||||||
dispatch(doHideModal());
|
dispatch(doHideModal());
|
||||||
|
@ -12,7 +15,4 @@ const perform = dispatch => ({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(select, perform)(ModalUpgrade);
|
||||||
select,
|
|
||||||
perform
|
|
||||||
)(ModalUpgrade);
|
|
||||||
|
|
|
@ -8,11 +8,12 @@ const IS_MAC = navigator.userAgent.indexOf('Mac OS X') !== -1;
|
||||||
type Props = {
|
type Props = {
|
||||||
downloadUpgrade: () => void,
|
downloadUpgrade: () => void,
|
||||||
skipUpgrade: () => void,
|
skipUpgrade: () => void,
|
||||||
|
releaseVersion: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModalUpgrade extends React.PureComponent<Props> {
|
class ModalUpgrade extends React.PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { downloadUpgrade, skipUpgrade } = this.props;
|
const { downloadUpgrade, skipUpgrade, releaseVersion } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -26,10 +27,7 @@ class ModalUpgrade extends React.PureComponent<Props> {
|
||||||
onConfirmed={downloadUpgrade}
|
onConfirmed={downloadUpgrade}
|
||||||
onAborted={skipUpgrade}
|
onAborted={skipUpgrade}
|
||||||
>
|
>
|
||||||
<p>
|
{__('A new version %release_tag% of LBRY is ready for you.', { release_tag: releaseVersion })}
|
||||||
{__('An updated version of LBRY is now available.')}{' '}
|
|
||||||
{__('Your version is out of date and may be unreliable or insecure.')}
|
|
||||||
</p>
|
|
||||||
<LastReleaseChanges hideReleaseVersion />
|
<LastReleaseChanges hideReleaseVersion />
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,7 +18,6 @@ import { Lbryio } from 'lbryinc';
|
||||||
import { selectFollowedTagsList } from 'redux/selectors/tags';
|
import { selectFollowedTagsList } from 'redux/selectors/tags';
|
||||||
import { doToast, doError, doNotificationList } from 'redux/actions/notifications';
|
import { doToast, doError, doNotificationList } from 'redux/actions/notifications';
|
||||||
|
|
||||||
import Native from 'native';
|
|
||||||
import {
|
import {
|
||||||
doFetchDaemonSettings,
|
doFetchDaemonSettings,
|
||||||
doSetAutoLaunch,
|
doSetAutoLaunch,
|
||||||
|
@ -183,46 +182,51 @@ export function doCheckUpgradeAvailable() {
|
||||||
type: ACTIONS.CHECK_UPGRADE_START,
|
type: ACTIONS.CHECK_UPGRADE_START,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE) {
|
const autoUpdateSupported = ['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE;
|
||||||
// On Windows, Mac, and AppImage, updates happen silently through
|
|
||||||
// electron-updater.
|
|
||||||
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
|
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
|
||||||
const disableAutoUpdate = selectDisableAutoUpdates(state);
|
|
||||||
|
// If auto update isn't supported (Linux using .deb packages)
|
||||||
|
// don't perform any download, just get the upgrade info
|
||||||
|
// (release notes and version)
|
||||||
|
const disableAutoUpdate = !autoUpdateSupported || selectDisableAutoUpdates(state);
|
||||||
|
|
||||||
if (autoUpdateDeclined || isDev) {
|
if (autoUpdateDeclined || isDev) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcRenderer.send('check-for-updates', !disableAutoUpdate);
|
ipcRenderer.send('check-for-updates', !disableAutoUpdate);
|
||||||
return;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const success = ({ remoteVersion, upgradeAvailable }) => {
|
export function doNotifyUpdateAvailable(e) {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
const remoteVersion = e.releaseName || e.version;
|
||||||
|
|
||||||
|
const state = getState();
|
||||||
|
const noModalBeingDisplayed = !selectModal(state);
|
||||||
|
const isUpgradeSkipped = selectIsUpgradeSkipped(state);
|
||||||
|
const isRemoveVersionDiff = remoteVersion !== selectRemoteVersion(state);
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.CHECK_UPGRADE_SUCCESS,
|
type: ACTIONS.CHECK_UPGRADE_SUCCESS,
|
||||||
data: {
|
data: {
|
||||||
upgradeAvailable,
|
upgradeAvailable: true,
|
||||||
remoteVersion,
|
remoteVersion,
|
||||||
|
releaseNotes: e.releaseNotes,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
const autoUpdateSupported = ['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE;
|
||||||
upgradeAvailable &&
|
|
||||||
!selectModal(state) &&
|
if (autoUpdateSupported) {
|
||||||
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
return;
|
||||||
) {
|
}
|
||||||
|
|
||||||
|
if (noModalBeingDisplayed && !isUpgradeSkipped && isRemoveVersionDiff) {
|
||||||
dispatch(doOpenModal(MODALS.UPGRADE));
|
dispatch(doOpenModal(MODALS.UPGRADE));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const fail = () => {
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.CHECK_UPGRADE_FAIL,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Native.getAppVersionInfo().then(success, fail);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue