修复iOS端窗口尺寸被桌面配置限制导致黑边

This commit is contained in:
JSR
2026-03-19 18:50:06 +08:00
parent 62c4855cc4
commit 1d1f891051
+29
View File
@@ -103,6 +103,35 @@ function MainContent(): React.JSX.Element {
loadAuthAndSettings() loadAuthAndSettings()
}, []) }, [])
useEffect(() => {
const api = (window as any).api
if (!api || !isIosDevice) return
const fitIosWindow = async () => {
try {
await api.windowSetResizable(false)
} catch {
void 0
}
try {
// 传入远大于设备尺寸的物理像素,交由系统裁剪为可用全屏区域
await api.windowResize(10000, 10000)
} catch {
void 0
}
}
fitIosWindow().catch(() => void 0)
const timer = window.setTimeout(() => {
fitIosWindow().catch(() => void 0)
}, 300)
return () => {
window.clearTimeout(timer)
}
}, [isIosDevice])
const applySyncStrategy = async (strategy: "keep_local" | "keep_remote") => { const applySyncStrategy = async (strategy: "keep_local" | "keep_remote") => {
const api = (window as any).api const api = (window as any).api
if (!api) return if (!api) return