From d519e9aa17bf26e92bea0314e31f0f824bc38c3d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 2 Jul 2026 22:20:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(iOS):=20fix=20lock=20overlay=20ZStack=20ord?= =?UTF-8?q?er=20=E2=80=94=20icon=20now=20above=20overlay,=20unlock=20shows?= =?UTF-8?q?=20toolbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/MiniPlayerApp.swift | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Sources/MiniPlayerApp.swift b/Sources/MiniPlayerApp.swift index 8700f85..f114d1e 100644 --- a/Sources/MiniPlayerApp.swift +++ b/Sources/MiniPlayerApp.swift @@ -454,8 +454,13 @@ struct PlayerContentView: View { lastInteraction = Date() if isLocked { isLocked = false + withAnimation(.easeInOut(duration: 0.25)) { + showToolbar = true + } + resetHideTimer() } else { isLocked = true + showToolbar = false } #else withAnimation(.easeInOut(duration: 0.25)) { @@ -466,6 +471,19 @@ struct PlayerContentView: View { } ) + // iOS 锁屏遮罩层(拦截触摸,置于图标下方) + #if os(iOS) + if isLocked { + Color.black.opacity(0.01) + .ignoresSafeArea() + .allowsHitTesting(true) + .contentShape(Rectangle()) + .onTapGesture { + // 吞掉所有触摸 + } + } + #endif + // 底部控制栏 — 半透明,30秒自动隐藏 VStack { Spacer() @@ -489,19 +507,6 @@ struct PlayerContentView: View { .transition(.move(edge: .bottom).combined(with: .opacity)) } } - - // iOS 锁屏遮罩层(拦截触摸,仅左上角图标可点击解锁) - #if os(iOS) - if isLocked { - Color.black.opacity(0.01) - .ignoresSafeArea() - .allowsHitTesting(true) - .contentShape(Rectangle()) - .onTapGesture { - // 吞掉所有触摸 - } - } - #endif } .onAppear { #if os(macOS)