Skip to content

Open source CapCut alternative.

TypeScript

refactor(app): drop obsolete notch open/close workarounds

David Le946f5089c377
diff --git a/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift b/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
index 47ef4256..5aa3c181 100644
--- a/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
+++ b/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
@@ -37,7 +37,6 @@ final class UserQueryOverlayController {
private var statusHostShrinkWorkItem: DispatchWorkItem?
private var spawnDesktopEmergeWorkItems: [String: DispatchWorkItem] = [:]
private var hasPrewarmedInputPanel = false
- private var hasPrewarmedStatusPanelExpansion = false
private var lastStatusViewSnapshot: StatusPanelViewSnapshot?
init(
@@ -82,7 +81,6 @@ final class UserQueryOverlayController {
self.inputPanel = inputPanel
self.statusPanel = statusPanel
prewarmInputPanel()
- prewarmStatusPanelExpansion()
startActivationMonitoring()
startAppDeactivationMonitoring()
positionStatusPanel()
@@ -221,7 +219,6 @@ final class UserQueryOverlayController {
statusPanel = nil
statusHostingView = nil
hasPrewarmedInputPanel = false
- hasPrewarmedStatusPanelExpansion = false
lastStatusViewSnapshot = nil
}
@@ -561,16 +558,11 @@ final class UserQueryOverlayController {
_ hostingView: UserQueryHostingView<UserQueryNotchStatusView>,
metrics: NotchMetrics
) {
- hostingView.layer?.backgroundColor = statusHostDebugBackgroundColor?.cgColor
hostingView.layer?.cornerRadius = metrics.hostCornerRadius
hostingView.layer?.maskedCorners = [.layerMinXMaxYCorner, .layerMaxXMaxYCorner]
hostingView.layer?.masksToBounds = true
}
- private var statusHostDebugBackgroundColor: NSColor? {
- nil
- }
-
private func statusViewSnapshot(metrics: NotchMetrics) -> StatusPanelViewSnapshot {
let spawnCue = notchSpawnCue(metrics: metrics)
return StatusPanelViewSnapshot(
@@ -813,25 +805,6 @@ final class UserQueryOverlayController {
scheduleStatusHostShrink()
}
- private func prewarmStatusPanelExpansion() {
- guard !hasPrewarmedStatusPanelExpansion,
- statusPanel != nil else { return }
- hasPrewarmedStatusPanelExpansion = true
-
- // AppKit and SwiftUI layout must stay on the main actor, but doing this
- // while the status panel is still hidden keeps first-hover setup work off
- // the visible animation path.
- isStatusHostExpanded = true
- positionStatusPanel()
- updateStatusPanelView()
- flushStatusHostLayout()
-
- isStatusHostExpanded = false
- positionStatusPanel()
- updateStatusPanelView()
- flushStatusHostLayout()
- }
-
private func prewarmInputPanel() {
guard !hasPrewarmedInputPanel,
let inputPanel else { return }
@@ -840,20 +813,6 @@ final class UserQueryOverlayController {
flushPanelLayout(inputPanel)
}
- private func flushStatusHostLayout() {
- guard let statusPanel else { return }
-
- // The host uses `sizingOptions = []` (see makeStatusPanel) to keep its SwiftUI content
- // from re-driving the window size. A side effect is that assigning `rootView` no longer
- // invalidates the hosting view's AppKit layout, so `layoutSubtreeIfNeeded()` alone won't
- // flush the pending SwiftUI render. The surface grow animation needs the collapsed render
- // committed before `isStatusExpanded` flips, so it animates from the notch rather than
- // snapping open. Mark the host dirty so the flush forces it through.
- statusHostingView?.needsLayout = true
- statusHostingView?.needsDisplay = true
- flushPanelLayout(statusPanel)
- }
-
private func flushPanelLayout(_ panel: NSPanel) {
NSAnimationContext.runAnimationGroup { context in
context.duration = 0
diff --git a/apps/Donkey/Sources/DonkeyContracts/UserQueryNotchLayout.swift b/apps/Donkey/Sources/DonkeyContracts/UserQueryNotchLayout.swift
index ce8acc65..3326d90d 100644
--- a/apps/Donkey/Sources/DonkeyContracts/UserQueryNotchLayout.swift
+++ b/apps/Donkey/Sources/DonkeyContracts/UserQueryNotchLayout.swift
@@ -10,7 +10,6 @@ public struct UserQueryNotchLayout: Equatable, Sendable {
public var expandedVisibleHeight: CGFloat
public var contentHorizontalInset: CGFloat
public var visibleHeight: CGFloat
- public var cornerRadius: CGFloat
public var collapsedSurfaceFrame: CGRect
public var expandedSurfaceFrame: CGRect
public var expandedContentFrame: CGRect
@@ -28,7 +27,6 @@ public struct UserQueryNotchLayout: Equatable, Sendable {
expandedVisibleHeight: CGFloat,
contentHorizontalInset: CGFloat,
visibleHeight: CGFloat,
- cornerRadius: CGFloat,
collapsedSurfaceFrame: CGRect,
expandedSurfaceFrame: CGRect,
expandedContentFrame: CGRect,
@@ -43,7 +41,6 @@ public struct UserQueryNotchLayout: Equatable, Sendable {
self.expandedVisibleHeight = expandedVisibleHeight
self.contentHorizontalInset = contentHorizontalInset
self.visibleHeight = visibleHeight
- self.cornerRadius = cornerRadius
self.collapsedSurfaceFrame = collapsedSurfaceFrame
self.expandedSurfaceFrame = expandedSurfaceFrame
self.expandedContentFrame = expandedContentFrame
@@ -128,7 +125,6 @@ public struct UserQueryNotchMetrics: Equatable, Sendable {
expandedVisibleHeight: expandedVisibleHeight,
contentHorizontalInset: 14,
visibleHeight: visibleHeight,
- cornerRadius: isExpanded ? Self.expandedCornerRadius : Self.collapsedCornerRadius,
collapsedSurfaceFrame: collapsedSurfaceFrame,
expandedSurfaceFrame: expandedSurfaceFrame,
expandedContentFrame: expandedContentFrame,