Update DND UI for toast mode

This commit is contained in:
Hariharan Mudaliar 2025-12-13 00:54:17 +05:30
commit 83cca50a66
No known key found for this signature in database
GPG key ID: D04F1C2B9194DDFC
4 changed files with 169 additions and 26 deletions

View file

@ -352,7 +352,12 @@ enum FocusModeType: String, CaseIterable {
}
var activeIcon: Image {
if let internalSymbolName,
resolvedActiveIcon()
}
func resolvedActiveIcon(usePrivateSymbol: Bool = true) -> Image {
if usePrivateSymbol,
let internalSymbolName,
let image = Image(internalSystemName: internalSymbolName) {
return image
}

View file

@ -24,6 +24,7 @@ class LockScreenLiveActivityWindowManager {
private weak var viewModel: DynamicIslandViewModel?
private var screenChangeObserver: NSObjectProtocol?
private var workspaceObservers: [NSObjectProtocol] = []
private var currentNotchSize: CGSize?
private init() {
registerScreenChangeObservers()
@ -136,6 +137,8 @@ class LockScreenLiveActivityWindowManager {
hostingView.rootView = LockScreenLiveActivityOverlay(model: overlayModel, animator: overlayAnimator, notchSize: context.notchSize)
}
currentNotchSize = context.notchSize
print("[\(timestamp())] LockScreenLiveActivityWindowManager: realigned window due to \(reason)")
}
@ -175,14 +178,18 @@ class LockScreenLiveActivityWindowManager {
window.orderFrontRegardless()
window.alphaValue = 1
currentNotchSize = notchSize
}
func showLocked() {
hideTask?.cancel()
guard let context = lockContext() else { return }
let collapsedScale = LockScreenLiveActivityOverlay.collapsedScale(for: context.notchSize)
overlayAnimator.update(isLocked: true)
overlayModel.scale = 0.6
overlayModel.scale = collapsedScale
overlayModel.opacity = 0
present(notchSize: context.notchSize, on: context.screen)
@ -229,9 +236,16 @@ class LockScreenLiveActivityWindowManager {
private func hideWithAnimation() {
guard let window else { return }
let targetScale: CGFloat
if let notchSize = currentNotchSize {
targetScale = LockScreenLiveActivityOverlay.collapsedScale(for: notchSize)
} else {
targetScale = 0.7
}
withAnimation(.smooth(duration: LockScreenAnimationTimings.unlockCollapse)) {
overlayModel.opacity = 0
overlayModel.scale = 0.7
overlayModel.scale = targetScale
}
NSAnimationContext.runAnimationGroup { context in
@ -242,6 +256,7 @@ class LockScreenLiveActivityWindowManager {
DispatchQueue.main.asyncAfter(deadline: .now() + LockScreenAnimationTimings.unlockCollapse + 0.02) {
window.orderOut(nil)
self.currentNotchSize = nil
}
print("[\(timestamp())] LockScreenLiveActivityWindowManager: HUD hidden")