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.swiftindex 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 = falseprivate var lastStatusViewSnapshot: StatusPanelViewSnapshot?init(@@ -82,7 +81,6 @@ final class UserQueryOverlayController {self.inputPanel = inputPanelself.statusPanel = statusPanelprewarmInputPanel()- prewarmStatusPanelExpansion()startActivationMonitoring()startAppDeactivationMonitoring()positionStatusPanel()@@ -221,7 +219,6 @@ final class UserQueryOverlayController {statusPanel = nilstatusHostingView = nilhasPrewarmedInputPanel = false- hasPrewarmedStatusPanelExpansion = falselastStatusViewSnapshot = nil}@@ -561,16 +558,11 @@ final class UserQueryOverlayController {_ hostingView: UserQueryHostingView<UserQueryNotchStatusView>,metrics: NotchMetrics) {- hostingView.layer?.backgroundColor = statusHostDebugBackgroundColor?.cgColorhostingView.layer?.cornerRadius = metrics.hostCornerRadiushostingView.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 incontext.duration = 0diff --git a/apps/Donkey/Sources/DonkeyContracts/UserQueryNotchLayout.swift b/apps/Donkey/Sources/DonkeyContracts/UserQueryNotchLayout.swiftindex 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: CGFloatpublic var contentHorizontalInset: CGFloatpublic var visibleHeight: CGFloat- public var cornerRadius: CGFloatpublic var collapsedSurfaceFrame: CGRectpublic var expandedSurfaceFrame: CGRectpublic 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 = expandedVisibleHeightself.contentHorizontalInset = contentHorizontalInsetself.visibleHeight = visibleHeight- self.cornerRadius = cornerRadiusself.collapsedSurfaceFrame = collapsedSurfaceFrameself.expandedSurfaceFrame = expandedSurfaceFrameself.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,