Changeset View
Changeset View
Standalone View
Standalone View
web/modals/update-modal.react.js
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | pushModal( | ||||
/>, | />, | ||||
); | ); | ||||
// eslint-disable-next-line react-hooks/exhaustive-deps | // eslint-disable-next-line react-hooks/exhaustive-deps | ||||
}, []); | }, []); | ||||
React.useEffect( | React.useEffect( | ||||
() => | () => | ||||
electron?.onNewVersionAvailable?.(version => { | electron?.onNewVersionAvailable?.(version => { | ||||
// On these versions we want to update immediately because there's | |||||
// an issue if the user decides to update 10min after showing the modal | |||||
if (electron?.version === '1.0.0' || electron?.version === '2.0.0') { | |||||
electron?.updateToNewVersion?.(); | |||||
} | |||||
pushModal( | pushModal( | ||||
<UpdateModal | <UpdateModal | ||||
title={`Version ${version} is available!`} | title={`Version ${version} is available!`} | ||||
text="Please restart to update." | text="Please restart to update." | ||||
confirmText="Restart" | confirmText="Restart" | ||||
onConfirm={() => electron?.updateToNewVersion?.()} | onConfirm={() => electron?.updateToNewVersion?.()} | ||||
/>, | />, | ||||
); | ); | ||||
}), | }), | ||||
[pushModal], | [pushModal], | ||||
); | ); | ||||
return null; | return null; | ||||
} | } | ||||
export default UpdateModalHandler; | export default UpdateModalHandler; |