Repository navigation
Fix Sparkle update dialog requiring two presses #1908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -101,10 +101,13 @@ extension UpdateDriver: SPUUpdaterDelegate { | |||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func updater(_ updater: SPUUpdater, userDidMake _: SPUUserUpdateChoice, forUpdate _: SUAppcastItem, state _: SPUUserUpdateState) { | ||||||||||||||
| func updater(_ updater: SPUUpdater, userDidMake choice: SPUUserUpdateChoice, forUpdate _: SUAppcastItem, state: SPUUserUpdateState) { | ||||||||||||||
| DispatchQueue.main.async { [weak viewModel] in | ||||||||||||||
| viewModel?.clearDetectedUpdate() | ||||||||||||||
| } | ||||||||||||||
| if state.userInitiated, choice != .install { | ||||||||||||||
| finishUserInitiatedCheckPresentation() | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+108
to
+110
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For the
Suggested change
Alternatively, since |
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func updaterWillRelaunchApplication(_ updater: SPUUpdater) { | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prepareForUserInitiatedChecksets pending presentation before the previous check is cancelledWhen
viewModel.state != .idle,prepareForUserInitiatedCheck(presentation:)is called at line 218 beforeviewModel.state.cancel()at line 225. If cancelling the in-flight check causes Sparkle to calldismissUpdateInstallationsynchronously (or before the 100 ms async block runs),usesStandardPresentationevaluates totruebecausependingUserInitiatedCheckPresentationis already set. This causesstandard.dismissUpdateInstallation()to be called on aSPUStandardUserDriverthat was never activated (noshowUserInitiatedUpdateCheckwas forwarded to it), which could leave the standard driver in an unexpected internal state.Moving the first
prepareForUserInitiatedCheckcall inside the async block alongside the second one would ensure the pending presentation is only set immediately beforeupdater.checkForUpdates()is actually invoked: