Repository navigation
feat(app): open the file or the task when a notification is clicked - #533
Conversation
Clicking a finished download saved on this device opens its file, falling back to its task when the file is gone or will not open; every other notification opens Ketch on its task, a summary on its device's Finished tab and a message on the message. Desktop notifications did nothing when clicked: macOS now posts through NSUserNotificationCenter with a delegate of its own, Windows and Linux tell tray balloon clicks from icon clicks by their lack of mouse events, and notify-send waits for its default action. Android and iOS replace the Open button with Show, and Share is only offered for files on this device. The link handling Android had is now shared by every platform.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2cba1d68e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| link.filter?.let { statusFilter = it } | ||
| if (key == null) return |
There was a problem hiding this comment.
Send summary clicks to the Downloads destination
For a CompletedBatch or QueueDrained click, key is null, so this updates statusFilter and immediately returns without requesting AppDestination.Downloads. AppShell only changes destinations when downloadsRequests emits (AppShell.kt:348-350), so if the user last left the app on Discover—especially when a desktop window is recreated after being hidden—the click opens Ketch but remains on Discover instead of showing the Finished tab. Make this navigation durably select Downloads before returning.
AGENTS.md reference: AGENTS.md:L997-L1000
Useful? React with 👍 / 👎.
| val builder = builder(CHANNEL_DONE, copy) | ||
| .setGroup(GROUP_DONE) | ||
| .setContentIntent(showIntent(tag, task = event.taskKey)) | ||
| copy.actions.mapNotNull { fileAction(it, event.state.outputPath, tag) } | ||
| .forEach(builder::addAction) | ||
| .setContentIntent(open ?: show) |
There was a problem hiding this comment.
Route file taps through Ketch to preserve fallback
If the file exists when the notification is posted but is moved or deleted before the tap—or if no activity handles its MIME type—open remains a direct external ACTION_VIEW pending intent selected here. MainActivity therefore never receives the tap and cannot fall back to showing the task, leaving the click ineffective despite the promised fallback; route the content tap through Ketch so it can attempt the open and handle failure.
AGENTS.md reference: AGENTS.md:L997-L998
Useful? React with 👍 / 👎.
What
Clicking a notification now always leads somewhere useful:
Per platform
MacNotificationsposts throughNSUserNotificationCenterwith its own delegate (via JNA, likeMacDock) that reports clicks by notification name. Only works in an app bundle; from a build directory it falls back to AWT's tray notifications, which still ignore clicks.TrayClickstells the two apart because only icon clicks come with mouse events; a balloon click is taken to be the last balloon posted.notify-send --action=default=…waits and reports the click; versions without--actionfall back to posting without it.TrayNotifieremitsNotificationClicks;main.ktopens the file or shows the window on the target.The task-opening logic that lived in
MainActivityis now shared asNotificationLink+AppState.openinapp:sharedcommonMain and used by every platform.NotificationAction.OpenbecameShow.Reviewer notes
Tests
NotificationLinkTest(common) andNotificationClickTest(desktop: tray click classification, last-posted target,notify-sendcommand).:app:shared:jvmTest,:app:desktop:testpass;:app:android:compileDirectDebugKotlin,:app:shared:compileKotlinWasmJsand:app:shared:compileTestKotlinIosSimulatorArm64compile.