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