autoupdate: add Sparkle framework
This commits brings optionnal linking against Sparkle framework.
This framework is used to autoupdate apps not present in the Mac app store
Refs #75349
Change-Id: I82b14757c106f1282d91e631927057d00989feb7
diff --git a/src/GeneralPrefsVC.mm b/src/GeneralPrefsVC.mm
index 866972b..a9f88e6 100644
--- a/src/GeneralPrefsVC.mm
+++ b/src/GeneralPrefsVC.mm
@@ -31,12 +31,19 @@
#import <categorizedhistorymodel.h>
+#if ENABLE_SPARKLE
+#import <Sparkle/Sparkle.h>
+#endif
+
#import "Constants.h"
@interface GeneralPrefsVC ()
@property (unsafe_unretained) IBOutlet NSTextField *historyChangedLabel;
@property (unsafe_unretained) IBOutlet NSView *advancedGeneralSettings;
@property (unsafe_unretained) IBOutlet NSButton *startUpButton;
+@property (unsafe_unretained) IBOutlet NSButton *toggleAutomaticUpdateCheck;
+@property (unsafe_unretained) IBOutlet NSPopUpButton *checkIntervalPopUp;
+@property (unsafe_unretained) IBOutlet NSView *sparkleContainer;
@end
@@ -44,6 +51,9 @@
@synthesize historyChangedLabel;
@synthesize advancedGeneralSettings;
@synthesize startUpButton;
+@synthesize toggleAutomaticUpdateCheck;
+@synthesize checkIntervalPopUp;
+@synthesize sparkleContainer;
- (void)loadView
{
@@ -53,6 +63,17 @@
[startUpButton setState:[self isLaunchAtStartup]];
+#if ENABLE_SPARKLE
+ [sparkleContainer setHidden:NO];
+ SUUpdater *updater = [SUUpdater sharedUpdater];
+ [toggleAutomaticUpdateCheck bind:@"value" toObject:updater withKeyPath:@"automaticallyChecksForUpdates" options:nil];
+
+ [checkIntervalPopUp bind:@"enabled" toObject:updater withKeyPath:@"automaticallyChecksForUpdates" options:nil];
+ [checkIntervalPopUp bind:@"selectedTag" toObject:updater withKeyPath:@"updateCheckInterval" options:nil];
+#else
+ [sparkleContainer setHidden:YES];
+#endif
+
//[advancedGeneralSettings setHidden:![[NSUserDefaults standardUserDefaults] boolForKey:Preferences::ShowAdvanced]];
}