Merge pull request #794 from ente-io/integrate-mute-update-notification-api

integrate mute update notification API
This commit is contained in:
Abhinav Kumar 2023-01-21 09:58:27 +05:30 committed by GitHub
commit 3a37be3e4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 8 deletions

View file

@ -148,7 +148,9 @@ export default function App({ Component, err }) {
if (isElectron()) {
const showUpdateDialog = (updateInfo: AppUpdateInfo) => {
if (updateInfo.autoUpdatable) {
setDialogMessage(getUpdateReadyToInstallMessage());
setDialogMessage(
getUpdateReadyToInstallMessage(updateInfo)
);
} else {
setNotificationAttributes({
endIcon: <ArrowForward />,

View file

@ -21,9 +21,14 @@ class ElectronUpdateService {
}
}
skipAppVersion(version: string) {
if (this.electronAPIs?.skipAppVersion) {
this.electronAPIs.skipAppVersion(version);
skipAppUpdate(version: string) {
if (this.electronAPIs?.skipAppUpdate) {
this.electronAPIs.skipAppUpdate(version);
}
}
muteUpdateNotification(version: string) {
if (this.electronAPIs?.muteUpdateNotification) {
this.electronAPIs.muteUpdateNotification(version);
}
}
}

View file

@ -77,7 +77,7 @@ export interface ElectronAPIs {
showUpdateDialog: (updateInfo: AppUpdateInfo) => void
) => void;
updateAndRestart: () => void;
skipAppVersion: (version: string) => void;
skipAppUpdate: (version: string) => void;
getSentryUserID: () => Promise<string>;
getAppVersion: () => Promise<string>;
runFFmpegCmd: (
@ -85,6 +85,7 @@ export interface ElectronAPIs {
inputFile: File | ElectronFile,
outputFileName: string
) => Promise<File>;
muteUpdateNotification: (version: string) => void;
generateImageThumbnail: (
inputFile: File | ElectronFile,
maxDimension: number,

View file

@ -46,16 +46,20 @@ export const getTrashFileMessage = (deleteFileHelper): DialogBoxAttributes => ({
close: { text: constants.CANCEL },
});
export const getUpdateReadyToInstallMessage = (): DialogBoxAttributes => ({
export const getUpdateReadyToInstallMessage = (
updateInfo: AppUpdateInfo
): DialogBoxAttributes => ({
icon: <AutoAwesomeOutlinedIcon />,
title: constants.UPDATE_AVAILABLE,
content: constants.UPDATE_INSTALLABLE_MESSAGE,
close: {
text: constants.INSTALL_ON_NEXT_LAUNCH,
variant: 'secondary',
action: () => ElectronUpdateService.updateAndRestart(),
},
proceed: {
action: () => ElectronUpdateService.updateAndRestart(),
action: () =>
ElectronUpdateService.muteUpdateNotification(updateInfo.version),
text: constants.INSTALL_NOW,
variant: 'accent',
},
@ -70,7 +74,7 @@ export const getUpdateAvailableForDownloadMessage = (
close: {
text: constants.IGNORE_THIS_VERSION,
variant: 'secondary',
action: () => ElectronUpdateService.skipAppVersion(updateInfo.version),
action: () => ElectronUpdateService.skipAppUpdate(updateInfo.version),
},
proceed: {
action: downloadApp,