Sparkle icon indicating copy to clipboard operation
Sparkle copied to clipboard

Add option to automatically download/install new updates in permission prompt

Open zorgiepoo opened this issue 3 years ago • 8 comments
trafficstars

From discussion #2208, in the permission prompt I think we should consider adding a checkbox option that reflects SUAutomaticallyUpdate / -setAutomaticallyDownloadsUpdates: (i.e, an option to automatically download/install new updates).

Current permission prompt: Screen Shot 2022-07-18 at 9 03 05 PM

zorgiepoo avatar Jul 19 '22 04:07 zorgiepoo

does this also mean re-adding the checkbox from Sparkle 1.x? or is there already some way to get that one back? Screenshot 2022-08-29 at 21 10 19

core-code avatar Aug 29 '22 19:08 core-code

That shouldn't have changed. This is for the permission prompt. That checkbox on the update prompt window in particular may not show up when automaticallyChecksForUpdates is NO or when SUAllowsAutomaticUpdates is NO (I think, or something like that, not looking at the code/docs at the moment, off top of my head)

zorgiepoo avatar Aug 30 '22 01:08 zorgiepoo

That shouldn't have changed

i just can't confirm that. the button was there with Sparkle 1.x and its gone in Sparkle 2.x - nothing was changed except upgrading the framework.

looking at the source code i can't see how it would work either:

_allowsAutomaticUpdates = updaterSettings.allowsAutomaticUpdates && updaterSettings.automaticallyChecksForUpdates && !item.informationOnlyUpdate;

so the button is only there if the user has already checked the button (huh!?) or if SUAllowsAutomaticUpdatesKey is true. but we don't want to set SUAllowsAutomaticUpdatesKey to true, since automatic updates should be off by default and only on if the user activated it himself. but the user can't that without seeing the button. chicken and egg :-)

i changed the line to

_allowsAutomaticUpdates = (updaterSettings.allowsAutomaticUpdates || updaterSettings.automaticallyChecksForUpdates) && !item.informationOnlyUpdate;

which seems to work fine for me.

core-code avatar Sep 15 '22 23:09 core-code

A little misunderstanding I think but yes there's a potential issue.

_allowsAutomaticUpdates refers to allowing user to opt into automatic downloading/installing of updates. automaticallyChecksForUpdates refers to Sparkle's automatic checking of new updates, which you seem to not use and have set to NO (?) SUAllowsAutomaticUpdates defaults to true. It's for developers that want to set it to false that want to not provide the user the option to automatically download/install updates.

If automaticallyChecksForUpdates is set to NO, Sparkle doesn't know the developer wants to schedule update checks themselves (not always the case, sometimes a user/developer may not want to schedule automatic update checks at all..). In this scenario, providing an option to automatically download/installing updates is a bit unsound because automatic checking is NO (or 'unspecified' in this case of permission prompt (if kept enabled) not being requested yet).

However this also breaks, which you may have found out, if the developer wants to disable Sparkle's scheduler and check for updates themselves automatically, and also provide the user the option to opt into allowing automatic installing/downloading of updates. I think this is your case but let me know if I'm wrong.

--

I can think of a simple way to fix this. If SUAllowsAutomaticUpdates is specified, always use that value (except info only updates). If unspecified, use current behavior. So then you can specify SUAllowsAutomaticUpdates as YES and the user will have the option to toggle it.

zorgiepoo avatar Sep 16 '22 02:09 zorgiepoo

and also provide the user the option to opt into allowing automatic installing/downloading of updates. I think this is your case but let me know if I'm wrong.

confirmed, this is exactly my case.

automaticallyChecksForUpdates refers to Sparkle's automatic checking of new updates, which you seem to not use and have set to NO (?)

i can confirm that. its set to no because we don't want Sparkle to "ask users on second launch for permission if they want automatic update checks enabled".

core-code avatar Sep 16 '22 09:09 core-code

Change on your end for that issue will be to set SUAllowsAutomaticUpdates to YES in Info.plist with https://github.com/sparkle-project/Sparkle/pull/2266

zorgiepoo avatar Sep 17 '22 03:09 zorgiepoo

thanks! i'll try that, and hope it won't have any other consequences besides showing that checkbox :)

core-code avatar Sep 19 '22 16:09 core-code

it's only for the UI to allow changing automatic downloading/installing updates setting and it's only used in the update alert for hiding/showing the control / managing some UI constraints (Sparkle 1 is slightly different, but setting it there to YES too has no consequential effect).

zorgiepoo avatar Sep 21 '22 03:09 zorgiepoo

Adding this change in #2285

zorgiepoo avatar Nov 27 '22 14:11 zorgiepoo