// @flow import React, { useState, useEffect } from 'react'; // @if TARGET='app' import { ipcRenderer } from 'electron'; // @endif import { Modal } from 'modal/modal'; import LastReleaseChanges from 'component/lastReleaseChanges'; type Props = { closeModal: (any) => any, declineAutoUpdate: () => any, errorWhileUpdating: boolean, isDownloading: boolean, isUpdateAvailable: boolean, }; const ModalAutoUpdateDownloaded = (props: Props) => { const { closeModal, declineAutoUpdate, errorWhileUpdating, isDownloading, isUpdateAvailable } = props; const [waitingForAutoUpdateResponse, setWaitingForAutoUpdateResponse] = useState(false); const handleConfirm = () => { setWaitingForAutoUpdateResponse(true); ipcRenderer.send('autoUpdateAccepted'); }; const handleAbort = () => { declineAutoUpdate(); closeModal(); }; useEffect(() => { setWaitingForAutoUpdateResponse(false); }, [errorWhileUpdating, isDownloading, isUpdateAvailable]); return ( {errorWhileUpdating &&

{__('There was an error while updating. Please try again.')}

}
); }; export default ModalAutoUpdateDownloaded;