diff --git GitUp/Application/AppDelegate.m GitUp/Application/AppDelegate.m index 1042982..a07370e 100644 --- GitUp/Application/AppDelegate.m +++ GitUp/Application/AppDelegate.m @@ -41,7 +41,7 @@ #define kToolName @"gitup" #define kToolInstallPath @"/usr/local/bin/" kToolName -@interface AppDelegate () +@interface AppDelegate () @property(nonatomic, strong) AboutWindowController* aboutWindowController; @property(nonatomic, strong) CloneWindowController* cloneWindowController; @property(nonatomic, strong) PreferencesWindowController* preferencesWindowController; @@ -49,7 +49,6 @@ @interface AppDelegate () @end @implementation AppDelegate { - SUUpdater* _updater; BOOL _manualCheck; CFMessagePortRef _messagePort; @@ -71,20 +70,9 @@ - (CloneWindowController*)cloneWindowController { return _cloneWindowController; } -- (void)didChangeReleaseChannel:(BOOL)didChange { - if (didChange) { - _manualCheck = NO; - [_updater checkForUpdatesInBackground]; - } -} - - (PreferencesWindowController*)preferencesWindowController { if (!_preferencesWindowController) { _preferencesWindowController = [[PreferencesWindowController alloc] init]; - __weak typeof(self) weakSelf = self; - _preferencesWindowController.didChangeReleaseChannel = ^(BOOL didChange) { - [weakSelf didChangeReleaseChannel:didChange]; - }; } return _preferencesWindowController; } @@ -110,7 +98,6 @@ + (void)initialize { GICommitMessageViewUserDefaultKey_ShowMargins : @(YES), GICommitMessageViewUserDefaultKey_EnableSpellChecking : @(YES), GIUserDefaultKey_FontSize : @(GIDefaultFontSize), - kUserDefaultsKey_ReleaseChannel : PreferencesWindowController_ReleaseChannel_Stable, kUserDefaultsKey_CheckInterval : @(15 * 60), kUserDefaultsKey_FirstLaunch : @(YES), kUserDefaultsKey_DiffWhitespaceMode : @(kGCLiveRepositoryDiffWhitespaceMode_Normal), @@ -196,18 +183,6 @@ - (void)applicationWillFinishLaunching:(NSNotification*)notification { } - (void)applicationDidFinishLaunching:(NSNotification*)notification { -#if !DEBUG - // Initialize Sparkle and check for update immediately - if (![[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKey_DisableSparkle]) { - _updater = [SUUpdater sharedUpdater]; - _updater.delegate = self; - _updater.automaticallyChecksForUpdates = YES; - _updater.sendsSystemProfile = NO; - - _manualCheck = NO; - [_updater checkForUpdatesInBackground]; - } -#endif // Locate installed apps. [GILaunchServicesLocator setup]; @@ -354,9 +329,6 @@ - (NSDictionary*)_processToolCommand:(NSDictionary*)input { #pragma mark - Actions - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { - if (menuItem.action == @selector(checkForUpdates:)) { - return [_updater validateMenuItem:menuItem]; - } return YES; } @@ -462,11 +434,6 @@ - (IBAction)dimissModal:(id)sender { [[(NSButton*)sender window] orderOut:nil]; } -- (IBAction)checkForUpdates:(id)sender { - _manualCheck = YES; - [_updater checkForUpdatesInBackground]; -} - - (IBAction)installTool:(id)sender { AuthorizationRef authorization; OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &authorization); @@ -526,46 +493,4 @@ - (void)userNotificationCenter:(NSUserNotificationCenter*)center didActivateNoti } } -#pragma mark - SUUpdaterDelegate - -- (NSString*)feedURLStringForUpdater:(SUUpdater*)updater { - NSString* channel = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsKey_ReleaseChannel]; - return [NSString stringWithFormat:kURL_AppCast, channel]; -} - -- (void)updater:(SUUpdater*)updater didFindValidUpdate:(SUAppcastItem*)item { - NSString* channel = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsKey_ReleaseChannel]; - XLOG_INFO(@"Did find app update on channel '%@' for version %@", channel, item.versionString); -} - -- (void)updaterDidNotFindUpdate:(SUUpdater*)updater { - NSString* channel = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsKey_ReleaseChannel]; - XLOG_VERBOSE(@"App is up-to-date at version %@ on channel '%@'", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"], channel); - if (_manualCheck) { - NSAlert* alert = [[NSAlert alloc] init]; - alert.messageText = NSLocalizedString(@"GitUp is already up-to-date!", nil); - [alert addButtonWithTitle:NSLocalizedString(@"OK", nil)]; - alert.type = kGIAlertType_Note; - [alert runModal]; - } -} - -- (void)updater:(SUUpdater*)updater didAbortWithError:(NSError*)error { - NSString* channel = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsKey_ReleaseChannel]; - if (![error.domain isEqualToString:SUSparkleErrorDomain] || (error.code != SUNoUpdateError)) { - XLOG_ERROR(@"App update on channel '%@' aborted: %@", channel, error); - } -} - -- (void)updater:(SUUpdater*)updater willInstallUpdate:(SUAppcastItem*)item { - XLOG_INFO(@"Installing app update for version %@", item.versionString); -} - -- (void)updater:(SUUpdater*)updater willInstallUpdateOnQuit:(SUAppcastItem*)item immediateInstallationInvocation:(NSInvocation*)invocation { - XLOG_INFO(@"Will install app update for version %@ on quit", item.versionString); - [self _showNotificationWithTitle:NSLocalizedString(@"Update Available", nil) - action:NULL - message:NSLocalizedString(@"Relaunch GitUp to update to version %@ (%@).", nil), item.displayVersionString, item.versionString]; -} - @end diff --git GitUp/Application/Base.lproj/MainMenu.xib GitUp/Application/Base.lproj/MainMenu.xib index 528efb4..711833c 100644 --- GitUp/Application/Base.lproj/MainMenu.xib +++ GitUp/Application/Base.lproj/MainMenu.xib @@ -25,12 +25,6 @@ - - - - - -