Prevent the "Update available" Sparkle popup on Mac

It was shown when Brave was run as non-admin user and tried to
update a system-wide installation.
This commit is contained in:
Michael Herrmann
2022-02-22 15:28:42 +01:00
committed by GitHub
parent eefb90db97
commit a29f563282
3 changed files with 18 additions and 7 deletions
+1 -1
View File
@@ -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",
+10 -3
View File
@@ -190,9 +190,16 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> {
// 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];
}
@@ -229,7 +236,7 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> {
[self updateStatus:kAutoupdateChecking version:nil error:nil];
[su_updater_ checkForUpdatesInBackground];
[su_updater_ checkForUpdatesInBackgroundWithoutUi];
}
- (void)relaunch {
@@ -239,7 +246,7 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> {
- (void)checkForUpdatesInBackground {
DCHECK(registered_);
[su_updater_ checkForUpdatesInBackground];
[su_updater_ checkForUpdatesInBackgroundWithoutUi];
}
- (void)updateStatus:(AutoupdateStatus)status
+7 -3
View File
@@ -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/. */
@@ -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_