From 0b1c0694489b1b74b21c10ad29b59912edeb5e01 Mon Sep 17 00:00:00 2001
From: AAGaming <aagaming@riseup.net>
Date: Sun, 12 May 2024 15:47:08 -0400
Subject: port to @decky/ui TODO: update package.json to match once @decky/ui
 is on NPM

---
 frontend/src/toaster.tsx | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

(limited to 'frontend/src/toaster.tsx')

diff --git a/frontend/src/toaster.tsx b/frontend/src/toaster.tsx
index 8f274ff2..c6b15347 100644
--- a/frontend/src/toaster.tsx
+++ b/frontend/src/toaster.tsx
@@ -1,14 +1,14 @@
 import {
-  Module,
+  Export,
   Patch,
   ToastData,
   afterPatch,
   findClass,
   findInReactTree,
-  findModuleChild,
+  findModuleExport,
   getReactRoot,
   sleep,
-} from 'decky-frontend-lib';
+} from '@decky/ui';
 import { ReactNode } from 'react';
 
 import Toast from './components/Toast';
@@ -150,16 +150,7 @@ class Toaster extends Logger {
     this.rNode.stateNode.forceUpdate();
     delete this.rNode.stateNode.shouldComponentUpdate;
 
-    this.audioModule = findModuleChild((m: Module) => {
-      if (typeof m !== 'object') return undefined;
-      for (let prop in m) {
-        try {
-          if (m[prop].PlayNavSound && m[prop].RegisterCallbackOnPlaySound) return m[prop];
-        } catch {
-          return undefined;
-        }
-      }
-    });
+    this.audioModule = findModuleExport((e: Export) => e.PlayNavSound && e.RegisterCallbackOnPlaySound);
 
     this.log('Initialized');
     this.finishStartup?.();
-- 
cgit v1.2.3

