Skip to content

Open source CapCut alternative.

TypeScript

feat(app): restore a dismissed spawn pointer by clicking its notch task

David Lecf11699bec1f
diff --git a/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift b/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
index 242179b9..3a8a232a 100644
--- a/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
+++ b/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
@@ -627,6 +627,9 @@ final class UserQueryOverlayController {
resumeRequested: { [weak self] taskID in
self?.model.resumeTask(id: taskID)
},
+ taskSelected: { [weak self] taskID in
+ self?.restoreSpawnPointer(forTaskID: taskID)
+ },
approvePermissionRequested: { [weak self] taskID, alwaysAllow in
self?.model.approvePermissionGate(id: taskID, alwaysAllow: alwaysAllow)
},
@@ -648,6 +651,18 @@ final class UserQueryOverlayController {
model.showUpdateUI()
}
+ /// Brings back a pointer the user dismissed when its task is clicked in
+ /// the notch; the surface re-emerges and travels to its target again.
+ private func restoreSpawnPointer(forTaskID taskID: String) {
+ guard let spawnID = model.spawnStates.first(where: { $0.taskID == taskID })?.id else {
+ return
+ }
+
+ spawnOverlayController.restoreSpawn(id: spawnID)
+ model.selectSpawn(id: spawnID)
+ updateSpawnOverlay()
+ }
+
private func presentAgentVisualization(
request: PointerCoachCursorGuideRequest,
preferredSpawnID: String?
diff --git a/apps/Donkey/Sources/Donkey/UserQuerySpawnOverlayController.swift b/apps/Donkey/Sources/Donkey/UserQuerySpawnOverlayController.swift
index c9098ab2..e7c2755a 100644
--- a/apps/Donkey/Sources/Donkey/UserQuerySpawnOverlayController.swift
+++ b/apps/Donkey/Sources/Donkey/UserQuerySpawnOverlayController.swift
@@ -116,6 +116,12 @@ final class UserQuerySpawnOverlayController {
return true
}
+ /// Clears a user dismissal so the next update re-creates the pointer
+ /// surface, emerging from the notch again.
+ func restoreSpawn(id spawnID: String) {
+ dismissedSpawnIDs.remove(spawnID)
+ }
+
private func updateSurface(
for spawnState: UserQuerySpawnState,
selectedSpawnID: String?,
diff --git a/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift b/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift
index 2d55ff4c..79c96a58 100644
--- a/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift
+++ b/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift
@@ -26,6 +26,7 @@ public struct UserQueryNotchStatusView: View {
private let assetsDropped: @MainActor ([UserQueryTaskAssetDraft]) -> Void
private let pauseRequested: @MainActor (String) -> Void
private let resumeRequested: @MainActor (String) -> Void
+ private let taskSelected: @MainActor (String) -> Void
/// (taskID, alwaysAllow). `alwaysAllow` persists a standing rule for the
/// command signature; it is only offered for non-highRisk shell consent.
private let approvePermissionRequested: @MainActor (String, Bool) -> Void
@@ -51,6 +52,7 @@ public struct UserQueryNotchStatusView: View {
assetsDropped: @escaping @MainActor ([UserQueryTaskAssetDraft]) -> Void,
pauseRequested: @escaping @MainActor (String) -> Void,
resumeRequested: @escaping @MainActor (String) -> Void,
+ taskSelected: @escaping @MainActor (String) -> Void,
approvePermissionRequested: @escaping @MainActor (String, Bool) -> Void,
updateRequested: @escaping @MainActor () -> Void
) {
@@ -73,6 +75,7 @@ public struct UserQueryNotchStatusView: View {
self.assetsDropped = assetsDropped
self.pauseRequested = pauseRequested
self.resumeRequested = resumeRequested
+ self.taskSelected = taskSelected
self.approvePermissionRequested = approvePermissionRequested
self.updateRequested = updateRequested
}
@@ -475,6 +478,12 @@ public struct UserQueryNotchStatusView: View {
.frame(minHeight: 48)
.background(Color.white.opacity(0.055))
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
+ .contentShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
+ .onTapGesture {
+ if let taskID = primaryTask?.id {
+ taskSelected(taskID)
+ }
+ }
}
/// A count-up elapsed-time label for a running task — the timeline ticks every second on its
@@ -539,6 +548,10 @@ public struct UserQueryNotchStatusView: View {
.frame(minHeight: 48)
.background(Color.white.opacity(0.055))
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
+ .contentShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
+ .onTapGesture {
+ taskSelected(task.id)
+ }
}
private var commandRow: some View {