mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Update DND UI for toast mode
This commit is contained in:
parent
2ce6a3ae96
commit
83cca50a66
4 changed files with 169 additions and 26 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue