Skip to content

Prevent the "Update available" Sparkle popup on Mac #12335

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

Merged
merged 1 commit into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ deps = {
"vendor/boto": "https://github.com/boto/boto@f7574aa6cc2c819430c1f05e9a1a1a666ef8169b",
"vendor/python-patch": "https://github.com/brave/python-patch@d8880110be6554686bc08261766538c2926d4e82",
"vendor/omaha": "https://github.com/brave/omaha.git@baf5b9977a49db893b557c7ceca18ab414fd2a08",
"vendor/sparkle": "https://github.com/brave/Sparkle.git@07933da3e178265d0f0ba86e02bbde38e701a04d",
"vendor/sparkle": "https://github.com/brave/Sparkle.git@57fb153bea4c71ed10102d50e68ead89ca483b49",
"vendor/bat-native-rapidjson": "https://github.com/brave-intl/bat-native-rapidjson.git@60b7e4574cebdd79f441bdd6f0f3ab469fd7e04c",
"vendor/bip39wally-core-native": "https://github.com/brave-intl/bat-native-bip39wally-core.git@0d3a8713a2b388d2156fe49a70ef3f7cdb44b190",
"vendor/bat-native-anonize": "https://github.com/brave-intl/bat-native-anonize.git@e3742ba3e8942eea9e4755d91532491871bd3116",
Expand Down
13 changes: 10 additions & 3 deletions browser/mac/sparkle_glue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,16 @@ - (void)registerWithSparkle {
// Background update check interval.
constexpr NSTimeInterval kBraveUpdateCheckIntervalInSec = 3 * 60 * 60;
[su_updater_ setUpdateCheckInterval:kBraveUpdateCheckIntervalInSec];
[su_updater_ setAutomaticallyChecksForUpdates:YES];

[su_updater_ setAutomaticallyDownloadsUpdates:YES];

// We only want to perform automatic update checks if we have write
// access to the installation directory. Such access can be checked
// with SUSystemUpdateInfo:systemAllowsAutomaticUpdatesForHost.
// The following makes su_updater_ call this method for us because
// we setAutomaticallyDownloadUpdates:YES above.
if ([su_updater_ automaticallyDownloadsUpdates])
[su_updater_ setAutomaticallyChecksForUpdates:YES];
[self updateStatus:kAutoupdateRegistered version:nil error:nil];
}

Expand Down Expand Up @@ -229,7 +236,7 @@ - (void)checkForUpdates {

[self updateStatus:kAutoupdateChecking version:nil error:nil];

[su_updater_ checkForUpdatesInBackground];
[su_updater_ checkForUpdatesInBackgroundWithoutUi];
}

- (void)relaunch {
Expand All @@ -239,7 +246,7 @@ - (void)relaunch {

- (void)checkForUpdatesInBackground {
DCHECK(registered_);
[su_updater_ checkForUpdatesInBackground];
[su_updater_ checkForUpdatesInBackgroundWithoutUi];
}

- (void)updateStatus:(AutoupdateStatus)status
Expand Down
10 changes: 7 additions & 3 deletions browser/mac/su_updater.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
/* Copyright 2022 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

Expand All @@ -16,17 +17,20 @@

@interface SUUpdater : NSObject

@property (strong) SUUpdateDriver *driver;
@property(strong) SUUpdateDriver* driver; // NOLINT

+ (SUUpdater *)sharedUpdater;
+ (SUUpdater*)sharedUpdater; // NOLINT

- (void)checkForUpdates:(id)sender;
- (void)setDelegate:(id)delegate;
- (void)setAutomaticallyChecksForUpdates:(BOOL)enable;
- (void)setAutomaticallyDownloadsUpdates:(BOOL)enable;
- (void)checkForUpdatesInBackground;
- (void)checkForUpdatesInBackgroundWithoutUi;
- (void)setUpdateCheckInterval:(NSTimeInterval)interval;

@property BOOL automaticallyDownloadsUpdates;

@end

#endif // BRAVE_BROWSER_MAC_SU_UPDATER_H_