feat: surface the dialog response from makeUserNotifier#235
Draft
claude[bot] wants to merge 1 commit into
Draft
Conversation
The function returned by makeUserNotifier now accepts an optional callback that receives the index of the button the user clicked (0 = restart, 1 = later), letting callers react when the user chooses "Later". Closes #194 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qoymwe8fe4vauwoGPtTzwq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Samuel Attard · Slack thread
Before / After
Before: The function returned by
makeUserNotifiershowed the update dialog and only acted on the "Restart" button (response0). The "Later" choice was silently discarded, so a caller had no way to know the user had dismissed the prompt and couldn't, for example, show their own "restart now" affordance later.After: That function now takes an optional second argument,
callback(response), which receives the index of the button the user clicked (0= restart,1= later). Callers can react to either choice. The argument is optional, so existing usage is unchanged.How
In
src/index.ts,makeUserNotifier's returned closure gains an optionalcallback?: (response: number) => voidparameter. Afterdialog.showMessageBoxresolves, the existingquitAndInstall()branch is kept and the resolvedresponseindex is forwarded viacallback?.(response). The helper's return type signature is widened to(info: IUpdateInfo, callback?: (response: number) => void) => void. This matches the patch proposed in the issue. Added twomakeUserNotifiertests intest/index.test.tsasserting the callback receives the correct index for both buttons, and documented the callback under the API section ofREADME.md.Closes #194
Generated by Claude Code