Files
Signal-Desktop/ts/services/updateListener.ts
2020-09-04 09:39:17 -04:00

25 lines
639 B
TypeScript

import { ipcRenderer } from 'electron';
import { Dialogs } from '../types/Dialogs';
import { ShowUpdateDialogAction } from '../state/ducks/updates';
type UpdatesActions = {
showUpdateDialog: (x: Dialogs) => ShowUpdateDialogAction;
};
type EventsType = {
once: (ev: string, f: () => void) => void;
};
export function initializeUpdateListener(
updatesActions: UpdatesActions,
events: EventsType
): void {
ipcRenderer.on('show-update-dialog', (_, dialogType: Dialogs) => {
updatesActions.showUpdateDialog(dialogType);
});
events.once('snooze-update', () => {
updatesActions.showUpdateDialog(Dialogs.Update);
});
}