@@ -18,6 +18,7 @@ import {
1818} from "matrix-js-sdk/src/matrix" ;
1919import React from "react" ;
2020import { logger } from "matrix-js-sdk/src/logger" ;
21+ import { uniqueId } from "lodash" ;
2122
2223import BasePlatform , { UpdateCheckStatus , type UpdateStatus } from "../../BasePlatform" ;
2324import type BaseEventIndexManager from "../../indexing/BaseEventIndexManager" ;
@@ -43,6 +44,7 @@ import { SeshatIndexManager } from "./SeshatIndexManager";
4344import { IPCManager } from "./IPCManager" ;
4445import { _t } from "../../languageHandler" ;
4546import { BadgeOverlayRenderer } from "../../favicon" ;
47+ import GenericToast from "../../components/views/toasts/GenericToast.tsx" ;
4648
4749interface SquirrelUpdate {
4850 releaseNotes : string ;
@@ -182,6 +184,25 @@ export default class ElectronPlatform extends BasePlatform {
182184 await this . ipc . call ( "callDisplayMediaCallback" , source ?? { id : "" , name : "" , thumbnailURL : "" } ) ;
183185 } ) ;
184186
187+ this . electron . on ( "showToast" , ( ev , { title, description, priority = 40 } ) => {
188+ const key = uniqueId ( "electron_showToast_" ) ;
189+ const onPrimaryClick = ( ) : void => {
190+ ToastStore . sharedInstance ( ) . dismissToast ( key ) ;
191+ } ;
192+
193+ ToastStore . sharedInstance ( ) . addOrReplaceToast ( {
194+ key,
195+ title,
196+ props : {
197+ description,
198+ primaryLabel : _t ( "action|dismiss" ) ,
199+ onPrimaryClick,
200+ } ,
201+ component : GenericToast ,
202+ priority,
203+ } ) ;
204+ } ) ;
205+
185206 BreadcrumbsStore . instance . on ( UPDATE_EVENT , this . onBreadcrumbsUpdate ) ;
186207
187208 this . initialised = this . initialise ( ) ;
0 commit comments