macOS: Require Sparkle 2.

Remove our Sparkle 1 code. Fixes #18035.
This commit is contained in:
Gerald Combs 2022-04-21 10:11:08 -07:00 committed by A Wireshark GitLab Utility
parent a1e0c34c30
commit 4bb16383a3
3 changed files with 5 additions and 20 deletions

View File

@ -1245,7 +1245,7 @@ if(BUILD_wireshark OR BUILD_logwolf)
endif()
set(QT_FOUND ON)
if(APPLE)
ws_find_package(Sparkle ENABLE_SPARKLE HAVE_SOFTWARE_UPDATE 1)
ws_find_package(Sparkle ENABLE_SPARKLE HAVE_SOFTWARE_UPDATE 2)
endif()
if(Qt${qtver}Multimedia_FOUND)
set(QT_MULTIMEDIA_LIB 1)

View File

@ -9,8 +9,8 @@
include(FindPackageHandleStandardArgs)
file(GLOB USR_LOCAL_HINT "/usr/local/Sparkle-[1-9]*/")
file(GLOB HOMEBREW_HINT "/usr/local/Caskroom/sparkle/[1-9]*/")
file(GLOB USR_LOCAL_HINT "/usr/local/Sparkle-[2-9]*/")
file(GLOB HOMEBREW_HINT "/usr/local/Caskroom/sparkle/[2-9]*/")
find_path(SPARKLE_INCLUDE_DIR Sparkle.h
HINTS ${USR_LOCAL_HINT} ${HOMEBREW_HINT}
@ -33,6 +33,8 @@ if(_spustandardupdatercontroller_h)
set(SPARKLE_VERSION 2)
endif()
unset(_spustandardupdatercontroller_h CACHE)
find_package_handle_standard_args(Sparkle
REQUIRED_VARS SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY
VERSION_VAR SPARKLE_VERSION

View File

@ -15,16 +15,10 @@
#import <Sparkle.h>
// XXX Is there a more reliable way to do this?
#ifdef SPUUserUpdateState_h
#define HAVE_SPARKLE_2
#endif
// https://sparkle-project.org/documentation/customization/
// Sparkle stores its state in ~/Library/Preferences/org.wireshark.Wireshark.plist.
// You can check its log output via `log stream | grep -i sparkle`.
#ifdef HAVE_SPARKLE_2
// The Sparkle 1 UI provided a sharedUpdater singleton, which is deprecated
// in Sparkle 2:
// https://sparkle-project.org/documentation/upgrading/
@ -47,28 +41,17 @@
}
@end
#endif
void sparkle_software_update_init(const char *url, bool enabled, int interval)
{
#ifdef HAVE_SPARKLE_2
[[[SparkleBridge sharedStandardUpdaterController] updater] setAutomaticallyChecksForUpdates: enabled];
[[[SparkleBridge sharedStandardUpdaterController] updater] setUpdateCheckInterval: interval];
[[[SparkleBridge sharedStandardUpdaterController] updater] setFeedURL: [NSURL URLWithString: [[NSString alloc] initWithUTF8String: url] ]];
#else
[[SUUpdater sharedUpdater] setAutomaticallyChecksForUpdates: enabled];
[[SUUpdater sharedUpdater] setUpdateCheckInterval: interval];
[[SUUpdater sharedUpdater] setFeedURL: [NSURL URLWithString: [[NSString alloc] initWithUTF8String: url] ]];
#endif
}
void sparkle_software_update_check(void)
{
#ifdef HAVE_SPARKLE_2
[[SparkleBridge sharedStandardUpdaterController] checkForUpdates: [[NSApplication sharedApplication] delegate]];
#else
[[SUUpdater sharedUpdater] checkForUpdates: [[NSApplication sharedApplication] delegate]];
#endif
}
// Sparkle requires NSApplicationWillTerminateNotification in order to