Use same hazel endpoint to notify update to Linux users (#2497)
Add a pseudo auto-updater for Linux Fixes #2476
This commit is contained in:
parent
59273ddb2a
commit
1fbc85760b
8 changed files with 114 additions and 33 deletions
|
|
@ -10,10 +10,12 @@ export function installUpdate() {
|
|||
};
|
||||
}
|
||||
|
||||
export function updateAvailable(version, notes) {
|
||||
export function updateAvailable(version, notes, releaseUrl, canInstall) {
|
||||
return {
|
||||
type: UPDATE_AVAILABLE,
|
||||
version,
|
||||
notes
|
||||
notes,
|
||||
releaseUrl,
|
||||
canInstall
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,20 +79,38 @@ export default class Notifications extends PureComponent {
|
|||
window.require('electron').shell.openExternal(ev.target.href);
|
||||
ev.preventDefault();
|
||||
}}
|
||||
href={`https://github.com/zeit/hyper/releases/tag/${this.props.updateVersion}`}
|
||||
href={this.props.updateReleaseUrl}
|
||||
>
|
||||
notes
|
||||
</a>).{' '}
|
||||
<a
|
||||
style={{
|
||||
cursor: 'pointer',
|
||||
textDecoration: 'underline',
|
||||
fontWeight: 'bold'
|
||||
}}
|
||||
onClick={this.props.onUpdateInstall}
|
||||
>
|
||||
Restart
|
||||
</a>.{' '}
|
||||
{this.props.updateCanInstall ? (
|
||||
<a
|
||||
style={{
|
||||
cursor: 'pointer',
|
||||
textDecoration: 'underline',
|
||||
fontWeight: 'bold'
|
||||
}}
|
||||
onClick={this.props.onUpdateInstall}
|
||||
>
|
||||
Restart
|
||||
</a>
|
||||
) : (
|
||||
<a
|
||||
style={{
|
||||
color: '#fff',
|
||||
cursor: 'pointer',
|
||||
textDecoration: 'underline',
|
||||
fontWeight: 'bold'
|
||||
}}
|
||||
onClick={ev => {
|
||||
window.require('electron').shell.openExternal(ev.target.href);
|
||||
ev.preventDefault();
|
||||
}}
|
||||
href={this.props.updateReleaseUrl}
|
||||
>
|
||||
Download
|
||||
</a>
|
||||
)}.{' '}
|
||||
</Notification>
|
||||
)}
|
||||
{this.props.customChildren}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ const NotificationsContainer = connect(
|
|||
Object.assign(state_, {
|
||||
updateShowing: true,
|
||||
updateVersion: ui.updateVersion,
|
||||
updateNote: ui.updateNotes.split('\n')[0]
|
||||
updateNote: ui.updateNotes.split('\n')[0],
|
||||
updateReleaseUrl: ui.updateReleaseUrl,
|
||||
updateCanInstall: ui.updateCanInstall
|
||||
});
|
||||
} else if (notifications.message) {
|
||||
Object.assign(state_, {
|
||||
|
|
|
|||
|
|
@ -147,8 +147,8 @@ rpc.on('open file', ({path}) => {
|
|||
store_.dispatch(uiActions.openFile(path));
|
||||
});
|
||||
|
||||
rpc.on('update available', ({releaseName, releaseNotes}) => {
|
||||
store_.dispatch(updaterActions.updateAvailable(releaseName, releaseNotes));
|
||||
rpc.on('update available', ({releaseName, releaseNotes, releaseUrl, canInstall}) => {
|
||||
store_.dispatch(updaterActions.updateAvailable(releaseName, releaseNotes, releaseUrl, canInstall));
|
||||
});
|
||||
|
||||
rpc.on('move', () => {
|
||||
|
|
|
|||
|
|
@ -346,7 +346,9 @@ const reducer = (state = initial, action) => {
|
|||
case UPDATE_AVAILABLE:
|
||||
state_ = state.merge({
|
||||
updateVersion: action.version,
|
||||
updateNotes: action.notes || ''
|
||||
updateNotes: action.notes || '',
|
||||
updateReleaseUrl: action.releaseUrl,
|
||||
updateCanInstall: !!action.canInstall
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue