Skip to content

Commit 57660ae

Browse files
author
Zachary Schneirov
committed
have sparkle for new versions every 4 days
1 parent cd72ce6 commit 57660ae

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

AppController.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,23 @@ - (void)runDelayedUIActionsAfterLaunch {
137137
[notationController checkIfNotationIsTrashed];
138138

139139
//connect sparkle programmatically to avoid loading its framework at nib awake;
140+
140141
if (!NSClassFromString(@"SUUpdater")) {
141142
NSString *frameworkPath = [[[NSBundle bundleForClass:[self class]] privateFrameworksPath] stringByAppendingPathComponent:@"Sparkle.framework"];
142143
if ([[NSBundle bundleWithPath:frameworkPath] load]) {
143-
[sparkleUpdateItem setTarget:[[NSClassFromString(@"SUUpdater") alloc] init]];
144+
id updater = [NSClassFromString(@"SUUpdater") performSelector:@selector(sharedUpdater)];
145+
[sparkleUpdateItem setTarget:updater];
144146
[sparkleUpdateItem setAction:@selector(checkForUpdates:)];
147+
if (![[prefsController notationPrefs] firstTimeUsed]) {
148+
//don't do anything automatically on the first launch; afterwards, check every 4 days, as specified in Info.plist
149+
SEL checksSEL = @selector(setAutomaticallyChecksForUpdates:);
150+
[updater methodForSelector:checksSEL](updater, checksSEL, YES);
151+
}
145152
} else {
146153
NSLog(@"Could not load %@!", frameworkPath);
147154
}
148155
}
149-
156+
150157
[NSApp setServicesProvider:self];
151158
}
152159

Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@
199199
</array>
200200
<key>SUCheckAtStartup</key>
201201
<false/>
202+
<key>SUScheduledCheckInterval</key>
203+
<real>345600</real>
202204
<key>SUFeedURL</key>
203205
<string>http://notational.net/nvupdates.xml</string>
204206
<key>SmartCrashReports_CompanyName</key>

0 commit comments

Comments
 (0)