瀏覽代碼

fix(desktop): audio stuff

Adam 2 月之前
父節點
當前提交
3f5cd2c4a8
共有 1 個文件被更改,包括 1 次插入25 次删除
  1. 1 25
      packages/desktop/src/context/notification.tsx

+ 1 - 25
packages/desktop/src/context/notification.tsx

@@ -25,11 +25,6 @@ type ErrorNotification = NotificationBase & {
 
 
 export type Notification = TurnCompleteNotification | ErrorNotification
 export type Notification = TurnCompleteNotification | ErrorNotification
 
 
-export type AudioSettings = {
-  enabled: boolean
-  volume: number
-}
-
 export const { use: useNotification, provider: NotificationProvider } = createSimpleContext({
 export const { use: useNotification, provider: NotificationProvider } = createSimpleContext({
   name: "Notification",
   name: "Notification",
   init: () => {
   init: () => {
@@ -39,10 +34,6 @@ export const { use: useNotification, provider: NotificationProvider } = createSi
     const [store, setStore] = makePersisted(
     const [store, setStore] = makePersisted(
       createStore({
       createStore({
         list: [] as Notification[],
         list: [] as Notification[],
-        audio: {
-          enabled: true,
-          volume: 1,
-        } as AudioSettings,
       }),
       }),
       {
       {
         name: "notification.v1",
         name: "notification.v1",
@@ -64,10 +55,7 @@ export const { use: useNotification, provider: NotificationProvider } = createSi
       }
       }
       switch (event.type) {
       switch (event.type) {
         case "session.idle": {
         case "session.idle": {
-          if (store.audio.enabled) {
-            idlePlayer.setVolume(store.audio.volume)
-            idlePlayer.play()
-          }
+          idlePlayer.play()
           const session = event.properties.sessionID
           const session = event.properties.sessionID
           setStore("list", store.list.length, {
           setStore("list", store.list.length, {
             ...base,
             ...base,
@@ -113,18 +101,6 @@ export const { use: useNotification, provider: NotificationProvider } = createSi
           setStore("list", (n) => n.directory === directory, "viewed", true)
           setStore("list", (n) => n.directory === directory, "viewed", true)
         },
         },
       },
       },
-      audio: {
-        get settings() {
-          return store.audio
-        },
-        setEnabled(enabled: boolean) {
-          setStore("audio", "enabled", enabled)
-        },
-        setVolume(volume: number) {
-          const clamped = Math.max(0, Math.min(1, volume))
-          setStore("audio", "volume", clamped)
-        },
-      },
     }
     }
   },
   },
 })
 })