chore: 删死代码 —— OpenReport/ReadLocalFile/isDesktop/openReport + admin Soon (P2)
完成度审计确认全链零生产调用: - app.go OpenReport(仅被死包装引用)、ReadLocalFile(仅测试引用); desktop.ts openReport 包装、isDesktop 导出(实际用 isMacDesktop)——全删。 绑定重新生成(OpenReport/ReadLocalFile 归零,PrintReportPage/SaveReportAs/ Notify 保留)。删对应的 app_test TestReadLocalFile。 - admin Soon.tsx(规划中占位组件)已成未引用死组件——routes.tsx 9 条路由全 ready:true,import 未用。删组件+import。 openInSystem/filepath/os 仍被 PrintReportPage/download 使用,不孤立。 desktop go test + tsc + 68 vitest、admin tsc + 41 vitest 全绿。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -8,11 +8,6 @@ function inWails(): boolean {
|
||||
return !!(window as unknown as { _wails?: { environment?: unknown } })._wails?.environment;
|
||||
}
|
||||
|
||||
// isDesktop 是否运行在真实 Wails 桌面窗口(而非浏览器预览)。
|
||||
export function isDesktop(): boolean {
|
||||
return inWails();
|
||||
}
|
||||
|
||||
// isMacDesktop 用于交通灯让位等 macOS 专属适配。
|
||||
export function isMacDesktop(): boolean {
|
||||
return inWails() && System.IsMac();
|
||||
@@ -27,15 +22,6 @@ export async function saveReportAs(url: string, filename: string): Promise<strin
|
||||
return App.SaveReportAs(url, filename);
|
||||
}
|
||||
|
||||
// openReport:桌面端下载到临时目录并用系统默认应用打开;浏览器降级为新标签打开。
|
||||
export async function openReport(url: string, filename: string): Promise<void> {
|
||||
if (!inWails()) {
|
||||
window.open(url, "_blank");
|
||||
return;
|
||||
}
|
||||
await App.OpenReport(url, filename);
|
||||
}
|
||||
|
||||
// notify:桌面端弹系统通知;浏览器为空操作(由应用内 Toast 兜底)。
|
||||
export function notify(title: string, body: string): void {
|
||||
if (inWails()) void App.Notify(title, body);
|
||||
|
||||
Reference in New Issue
Block a user