Files
CODE_ASSISTANT/2_frontend/src/lib/bridge/webviewBridge.ts
T
lee-hyeon-cheolandClaude Fable 5.1 89fc8fab45 feat(app): 답변 완료 알림 — 창 안 보고 있으면 토스트 + 트레이 점
- 프론트: 스트림 onDone 에서 chat.done(title) 한 번. 브라우저에선 no-op
- Rust shell/notify: 창 보이고 포커스면 아무것도 안 함. 아니면 Windows 토스트(tauri-plugin-notification)
  + 트레이 아이콘을 점 찍힌 tray-alert.png 로. 창 Focused(true) 에서 원복
- 토스트는 설치본(msi)에서만 알림센터에 등록돼 보임. dev 에선 트레이 점으로 확인

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 14:13:40 +09:00

25 lines
1.0 KiB
TypeScript

import { hostKind, send } from "./transport"
/** 데스크톱 호스트 안에서 실행 중이면 true. 기존 소비자 이름은 유지함. */
export function isWebView(): boolean {
return hostKind() !== "browser"
}
/** 데스크톱 창 숨김(트레이로 내림). */
export const hideWindow = () => send({ type: "window.hide" })
/** 코드를 소환 직전 앱에 붙여넣음. */
export const pasteToApp = (text: string) => send({ type: "paste.code", text })
/** 현재 React route를 데스크톱 호스트에 알림. */
export const reportRoute = (path: string) => send({ type: "route.changed", path })
/** 답변 스트림 끝 — 데스크톱이 창 안 보고 있으면 토스트 + 트레이 점. 브라우저에선 no-op. */
export const notifyChatDone = (title?: string) => {
if (hostKind() !== "tauri") return
send({ type: "chat.done", title: title ?? "" })
}
/** 프레임리스 창을 native 창 이동으로 끌 수 있게 함. */
export const startWindowDrag = () => send({ type: "window.drag" })