From 4adb53dc51c1415673376823836320a0b7f9dbd4 Mon Sep 17 00:00:00 2001 From: Kevin Wojniak Date: Mon, 29 Jun 2015 08:35:53 -0700 Subject: [PATCH 1/2] Replace deprecated NSRunAlertPanel --- Sparkle/Autoupdate/Autoupdate.m | 5 ++++- Sparkle/SUUpdater.m | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Sparkle/Autoupdate/Autoupdate.m b/Sparkle/Autoupdate/Autoupdate.m index 11887adf..4d4dd138 100644 --- a/Sparkle/Autoupdate/Autoupdate.m +++ b/Sparkle/Autoupdate/Autoupdate.m @@ -167,7 +167,10 @@ static const NSTimeInterval SUParentQuitCheckInterval = .25; completionHandler:^(NSError *error) { if (error) { if (self.shouldShowUI) { - NSRunAlertPanel(@"", @"%@", @"OK", @"", @"", [error localizedDescription]); + NSAlert *alert = [[NSAlert alloc] init]; + alert.messageText = @""; + alert.informativeText = [NSString stringWithFormat:@"%@", [error localizedDescription]]; + [alert runModal]; } exit(EXIT_FAILURE); } else { diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index ee26656c..ca3b3606 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -104,11 +104,17 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults BOOL hostIsCodeSigned = [SUCodeSigningVerifier hostApplicationIsCodeSigned]; if (!isMainBundle && !hasPublicDSAKey) { [self notifyWillShowModalAlert]; - NSRunAlertPanel(@"Insecure update error!", @"For security reasons, you need to sign your updates with a DSA key. See Sparkle's documentation for more information.", @"OK", nil, nil); + NSAlert *alert = [[NSAlert alloc] init]; + alert.messageText = @"Insecure update error!"; + alert.informativeText = @"For security reasons, you need to sign your updates with a DSA key. See Sparkle's documentation for more information."; + [alert runModal]; [self notifyDidShowModalAlert]; } else if (isMainBundle && !(hasPublicDSAKey || hostIsCodeSigned)) { [self notifyWillShowModalAlert]; - NSRunAlertPanel(@"Insecure update error!", @"For security reasons, you need to code sign your application or sign your updates with a DSA key. See Sparkle's documentation for more information.", @"OK", nil, nil); + NSAlert *alert = [[NSAlert alloc] init]; + alert.messageText = @"Insecure update error!"; + alert.informativeText = @"For security reasons, you need to code sign your application or sign your updates with a DSA key. See Sparkle's documentation for more information."; + [alert runModal]; [self notifyDidShowModalAlert]; } From 11eaa3e092896dc6bb41c6c38f0d8f39e04a739b Mon Sep 17 00:00:00 2001 From: Kevin Wojniak Date: Mon, 29 Jun 2015 08:45:08 -0700 Subject: [PATCH 2/2] Replace deprecated alertWithMessageText --- Sparkle/SUUIBasedUpdateDriver.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index 7875dadd..b1e09370 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -63,11 +63,10 @@ [[self.updater delegate] updaterDidNotFindUpdate:self.updater]; [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:self.updater]; - NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.") - defaultButton:SULocalizedString(@"OK", nil) - alternateButton:nil - otherButton:nil - informativeTextWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]]; + NSAlert *alert = [[NSAlert alloc] init]; + alert.messageText = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates."); + alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]]; + [alert addButtonWithTitle:SULocalizedString(@"OK", nil)]; [self showModalAlert:alert]; [self abortUpdate]; } @@ -201,7 +200,10 @@ - (void)abortUpdateWithError:(NSError *)error { - NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"Update Error!", nil) defaultButton:SULocalizedString(@"Cancel Update", nil) alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", [error localizedDescription]]; + NSAlert *alert = [[NSAlert alloc] init]; + alert.messageText = SULocalizedString(@"Update Error!", nil); + alert.informativeText = [NSString stringWithFormat:@"%@", [error localizedDescription]]; + [alert addButtonWithTitle:SULocalizedString(@"Cancel Update", nil)]; [self showModalAlert:alert]; [super abortUpdateWithError:error]; }