From 24082fe63cdcdf41993f9e1430d1405152a2c930 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Sat, 21 Nov 2026 22:23:03 -0500 Subject: feat: Support new Steam Betas (only) and Frame (#1019) --- frontend/src/toaster.tsx | 125 ----------------------------------------------- 1 file changed, 125 deletions(-) delete mode 100644 frontend/src/toaster.tsx (limited to 'frontend/src/toaster.tsx') diff --git a/frontend/src/toaster.tsx b/frontend/src/toaster.tsx deleted file mode 100644 index e5b2d986..00000000 --- a/frontend/src/toaster.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import type { ToastData, ToastNotification } from '@decky/api'; -import { - ESteamNotificationAction, - ErrorBoundary, - Patch, - callOriginal, - findModuleExport, - injectFCTrampoline, - replacePatch, -} from '@decky/ui'; - -import Toast from './components/Toast'; -import Logger from './logger'; - -declare global { - interface Window { - __TOASTER_INSTANCE: any; - } -} - -class Toaster extends Logger { - private toastPatch?: Patch; - - constructor() { - super('Toaster'); - - window.__TOASTER_INSTANCE?.deinit?.(); - window.__TOASTER_INSTANCE = this; - - const ValveToastRenderer = findModuleExport((e) => e?.toString?.()?.includes(`controller:"notification",method:`)); - // TODO find a way to undo this if possible? - const patchedRenderer = injectFCTrampoline(ValveToastRenderer); - this.toastPatch = replacePatch(patchedRenderer, 'component', (args: any[]) => { - if (args?.[0]?.group?.decky || args?.[0]?.group?.notifications?.[0]?.decky) { - return args[0].group.notifications.map((notification: any) => ( - - - - )); - } - return callOriginal; - }); - - this.log('Initialized'); - } - - toast(toast: ToastData): ToastNotification { - if (toast.sound === undefined) toast.sound = 6; - if (toast.playSound === undefined) toast.playSound = true; - if (toast.showToast === undefined) toast.showToast = true; - if (toast.timestamp === undefined) toast.timestamp = new Date(); - if (toast.showNewIndicator === undefined) toast.showNewIndicator = true; - /* eType 13 - 13: { - proto: m.mu, - fnTray: null, - showToast: !0, - sound: f.PN.ToastMisc, - eFeature: l.uX - } - */ - let toastData = { - nNotificationID: window.NotificationStore.m_nNextTestNotificationID++, - bNewIndicator: toast.showNewIndicator, - rtCreated: Date.now(), - eType: toast.eType || 31, - eSource: 1, // Client - nToastDurationMS: toast.duration || (toast.duration = 5e3), - data: toast, - decky: true, - }; - let group: any; - function fnTray(toast: any, tray: any) { - group = { - eType: toast.eType, - notifications: [toast], - }; - tray.unshift(group); - } - const info = { - showToast: toast.showToast, - sound: toast.sound, - playSound: toast.playSound, - eFeature: 0, - toastDurationMS: toastData.nToastDurationMS, - bCritical: toast.critical, - fnTray, - }; - const self = this; - let expirationTimeout: number; - const toastResult: ToastNotification = { - data: toast, - dismiss() { - // it checks against the id of notifications[0] - try { - expirationTimeout && clearTimeout(expirationTimeout); - group && window.NotificationStore.RemoveGroupFromTray(group); - } catch (e) { - self.error('Error while dismissing toast:', e); - } - }, - }; - if (toast.expiration) { - expirationTimeout = setTimeout(() => { - try { - group && window.NotificationStore.RemoveGroupFromTray(group); - } catch (e) { - this.error('Error while dismissing expired toast:', e); - } - }, toast.expiration); - } - try { - window.NotificationStore.ProcessNotification(info, toastData, ESteamNotificationAction.New); - } catch (e) { - this.error('Error while sending toast:', e); - } - return toastResult; - } - - deinit() { - this.toastPatch?.unpatch(); - } -} - -export default Toaster; -- cgit v1.2.3