3 * C wrapper for the Sparkle API
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include <ui/macosx/sparkle_bridge.h>
14 #import <Cocoa/Cocoa.h>
18 // https://sparkle-project.org/documentation/customization/
19 // Sparkle stores its state in ~/Library/Preferences/org.wireshark.Wireshark.plist.
20 // You can check its log output via `log stream | grep -i sparkle`.
22 // The Sparkle 1 UI provided a sharedUpdater singleton, which is deprecated
24 // https://sparkle-project.org/documentation/upgrading/
25 // Create our own singleton which uses the updated API.
26 // https://sparkle-project.org/documentation/programmatic-setup/
28 @interface SparkleBridge : NSObject
29 + (SPUStandardUpdaterController *)sharedStandardUpdaterController;
32 @implementation SparkleBridge
34 + (SPUStandardUpdaterController *)sharedStandardUpdaterController {
35 static SPUStandardUpdaterController *sharedStandardUpdaterController_ = nil;
36 static dispatch_once_t onceToken;
37 dispatch_once(&onceToken, ^{
38 sharedStandardUpdaterController_ = [[SPUStandardUpdaterController alloc] initWithUpdaterDelegate: nil userDriverDelegate: nil];
40 return sharedStandardUpdaterController_;
45 void sparkle_software_update_init(const char *url, bool enabled, int interval)
47 [[[SparkleBridge sharedStandardUpdaterController] updater] setAutomaticallyChecksForUpdates: enabled];
48 [[[SparkleBridge sharedStandardUpdaterController] updater] setUpdateCheckInterval: interval];
49 [[[SparkleBridge sharedStandardUpdaterController] updater] setFeedURL: [NSURL URLWithString: [[NSString alloc] initWithUTF8String: url] ]];
52 void sparkle_software_update_check(void)
54 [[SparkleBridge sharedStandardUpdaterController] checkForUpdates: [[NSApplication sharedApplication] delegate]];