|
|
|
@ -92,6 +92,10 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
|
|
|
|
|
|
static NSString *mostRecentVersionInDict(NSDictionary *dictionary) |
|
|
|
|
{ |
|
|
|
|
return [dictionary.allKeys sortedArrayUsingSelector:@selector(compareVersion:)].lastObject; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@interface iVersion () |
|
|
|
|
|
|
|
|
@ -151,25 +155,6 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
{ |
|
|
|
|
if ((self = [super init])) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
#if TARGET_OS_IPHONE |
|
|
|
|
|
|
|
|
|
//register for iphone application events |
|
|
|
|
if (&UIApplicationWillEnterForegroundNotification) |
|
|
|
|
{ |
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self |
|
|
|
|
selector:@selector(applicationWillEnterForeground) |
|
|
|
|
name:UIApplicationWillEnterForegroundNotification |
|
|
|
|
object:nil]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self |
|
|
|
|
selector:@selector(didRotate) |
|
|
|
|
name:UIDeviceOrientationDidChangeNotification |
|
|
|
|
object:nil]; |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
//get country |
|
|
|
|
self.appStoreCountry = [(NSLocale *)[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]; |
|
|
|
|
if ([self.appStoreCountry isEqualToString:@"150"]) |
|
|
|
@ -198,6 +183,7 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
self.checkAtLaunch = YES; |
|
|
|
|
self.checkPeriod = 0.0f; |
|
|
|
|
self.remindPeriod = 1.0f; |
|
|
|
|
self.verboseLogging = YES; |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
|
@ -216,14 +202,7 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
{ |
|
|
|
|
if (_delegate == nil) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
#if TARGET_OS_IPHONE |
|
|
|
|
#define APP_CLASS UIApplication |
|
|
|
|
#else |
|
|
|
|
#define APP_CLASS NSApplication |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
_delegate = (id<iVersionDelegate>)[APP_CLASS sharedApplication].delegate; |
|
|
|
|
_delegate = (id<iVersionDelegate>)[NSApplication sharedApplication].delegate; |
|
|
|
|
} |
|
|
|
|
return _delegate; |
|
|
|
|
} |
|
|
|
@ -275,16 +254,7 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
NSLog(@"iVersion error: No App Store ID was found for this application. If the application is not intended for App Store release then you must specify a custom updateURL."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if TARGET_OS_IPHONE |
|
|
|
|
|
|
|
|
|
return [NSURL URLWithString:[NSString stringWithFormat:iVersioniOSAppStoreURLFormat, @(self.appStoreID)]]; |
|
|
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
|
|
return [NSURL URLWithString:[NSString stringWithFormat:iVersionMacAppStoreURLFormat, @(self.appStoreID)]]; |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (NSUInteger)appStoreID |
|
|
|
@ -341,7 +311,6 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
[[NSUserDefaults standardUserDefaults] setObject:(viewed? self.applicationVersion: nil) forKey:iVersionLastVersionKey]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (NSString *)lastVersion |
|
|
|
|
{ |
|
|
|
|
return [[NSUserDefaults standardUserDefaults] objectForKey:iVersionLastVersionKey]; |
|
|
|
@ -378,11 +347,6 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
return versionsDict; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (NSString *)mostRecentVersionInDict:(NSDictionary *)dict |
|
|
|
|
{ |
|
|
|
|
return [dict.allKeys sortedArrayUsingSelector:@selector(compareVersion:)].lastObject; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (NSString *)versionDetails:(NSString *)version inDict:(NSDictionary *)dict |
|
|
|
|
{ |
|
|
|
|
id versionData = dict[version]; |
|
|
|
@ -445,9 +409,6 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
|
|
|
|
|
- (void)downloadedVersionsData |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
#if !TARGET_OS_IPHONE |
|
|
|
|
|
|
|
|
|
//only show when main window is available |
|
|
|
|
if (self.onlyPromptIfMainWindowIsAvailable && ![NSApplication sharedApplication].mainWindow) |
|
|
|
|
{ |
|
|
|
@ -455,8 +416,6 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (self.checkingForNewVersion) |
|
|
|
|
{ |
|
|
|
|
//no longer checking |
|
|
|
@ -491,7 +450,7 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
|
|
|
|
|
//get version details |
|
|
|
|
NSString *details = [self versionDetailsSince:self.applicationVersion inDict:self.remoteVersionsDict]; |
|
|
|
|
NSString *mostRecentVersion = [self mostRecentVersionInDict:self.remoteVersionsDict]; |
|
|
|
|
NSString *mostRecentVersion = mostRecentVersionInDict(self.remoteVersionsDict); |
|
|
|
|
if (details) |
|
|
|
|
{ |
|
|
|
|
//inform delegate of new version |
|
|
|
@ -792,9 +751,6 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
|
|
|
|
|
- (void)checkIfNewVersion |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
#if !TARGET_OS_IPHONE |
|
|
|
|
|
|
|
|
|
//only show when main window is available |
|
|
|
|
if (self.onlyPromptIfMainWindowIsAvailable && ![NSApplication sharedApplication].mainWindow) |
|
|
|
|
{ |
|
|
|
@ -802,8 +758,6 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (self.lastVersion != nil || self.showOnFirstLaunch || self.previewMode) |
|
|
|
|
{ |
|
|
|
|
if ([self.applicationVersion compareVersion:self.lastVersion] == NSOrderedDescending || self.previewMode) |
|
|
|
@ -852,70 +806,6 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
ignoreButton:(NSString *)ignoreButton |
|
|
|
|
remindButton:(NSString *)remindButton |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
#if TARGET_OS_IPHONE |
|
|
|
|
|
|
|
|
|
UIViewController *topController = [UIApplication sharedApplication].delegate.window.rootViewController; |
|
|
|
|
while (topController.presentedViewController) |
|
|
|
|
{ |
|
|
|
|
topController = topController.presentedViewController; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ([UIAlertController class] && topController && self.useUIAlertControllerIfAvailable) |
|
|
|
|
{ |
|
|
|
|
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:details preferredStyle:UIAlertControllerStyleAlert]; |
|
|
|
|
|
|
|
|
|
//download/ok action |
|
|
|
|
[alert addAction:[UIAlertAction actionWithTitle:self.downloadButtonLabel style:UIAlertActionStyleDefault handler:^(__unused UIAlertAction *action) { |
|
|
|
|
[self didDismissAlert:alert withButtonAtIndex:0]; |
|
|
|
|
}]]; |
|
|
|
|
|
|
|
|
|
//ignore action |
|
|
|
|
if ([self showIgnoreButton]) |
|
|
|
|
{ |
|
|
|
|
[alert addAction:[UIAlertAction actionWithTitle:self.ignoreButtonLabel style:UIAlertActionStyleCancel handler:^(__unused UIAlertAction *action) { |
|
|
|
|
[self didDismissAlert:alert withButtonAtIndex:1]; |
|
|
|
|
}]]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//remind action |
|
|
|
|
if ([self showRemindButton]) |
|
|
|
|
{ |
|
|
|
|
[alert addAction:[UIAlertAction actionWithTitle:self.remindButtonLabel style:UIAlertActionStyleDefault handler:^(__unused UIAlertAction *action) { |
|
|
|
|
[self didDismissAlert:alert withButtonAtIndex:[self showIgnoreButton]? 2: 1]; |
|
|
|
|
}]]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//get current view controller and present alert |
|
|
|
|
[topController presentViewController:alert animated:YES completion:NULL]; |
|
|
|
|
|
|
|
|
|
return alert; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title |
|
|
|
|
message:details |
|
|
|
|
delegate:(id<UIAlertViewDelegate>)self |
|
|
|
|
cancelButtonTitle:nil |
|
|
|
|
otherButtonTitles:defaultButton, nil]; |
|
|
|
|
if (ignoreButton) |
|
|
|
|
{ |
|
|
|
|
[alert addButtonWithTitle:ignoreButton]; |
|
|
|
|
alert.cancelButtonIndex = 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (remindButton) |
|
|
|
|
{ |
|
|
|
|
[alert addButtonWithTitle:remindButton]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[alert show]; |
|
|
|
|
|
|
|
|
|
return alert; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
|
|
NSAlert *alert = [[NSAlert alloc] init]; |
|
|
|
|
alert.messageText = title; |
|
|
|
|
alert.informativeText = self.inThisVersionTitle; |
|
|
|
@ -953,12 +843,7 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
if (remindButton) |
|
|
|
|
{ |
|
|
|
|
[alert addButtonWithTitle:remindButton]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9 |
|
|
|
|
|
|
|
|
|
if (![alert respondsToSelector:@selector(runModal:)]) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
NSModalResponse modalResponse = [alert runModal]; |
|
|
|
|
if (modalResponse == NSAlertFirstButtonReturn) |
|
|
|
@ -975,43 +860,20 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
[self didDismissAlert:alert withButtonAtIndex:2]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
NSModalResponse modalResponse = [alert runModal]; |
|
|
|
|
if (modalResponse == NSAlertFirstButtonReturn) |
|
|
|
|
{ |
|
|
|
|
//right most button |
|
|
|
|
[self didDismissAlert:alert withButtonAtIndex:0]; |
|
|
|
|
} |
|
|
|
|
else if (modalResponse == NSAlertSecondButtonReturn) |
|
|
|
|
{ |
|
|
|
|
[self didDismissAlert:alert withButtonAtIndex:1]; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
[self didDismissAlert:alert withButtonAtIndex:2]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return alert; |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)didDismissAlert:(id)alertView withButtonAtIndex:(NSInteger)buttonIndex |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
//get button indices |
|
|
|
|
NSInteger downloadButtonIndex = 0; |
|
|
|
|
NSInteger ignoreButtonIndex = [self showIgnoreButton]? 1: 0; |
|
|
|
|
NSInteger remindButtonIndex = [self showRemindButton]? ignoreButtonIndex + 1: 0; |
|
|
|
|
|
|
|
|
|
//latest version |
|
|
|
|
NSString *latestVersion = [self mostRecentVersionInDict:self.remoteVersionsDict]; |
|
|
|
|
NSString *latestVersion = mostRecentVersionInDict(self.remoteVersionsDict); |
|
|
|
|
|
|
|
|
|
if (alertView == self.visibleLocalAlert) |
|
|
|
|
{ |
|
|
|
@ -1067,161 +929,15 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
|
|
|
|
|
//release alert |
|
|
|
|
self.visibleRemoteAlert = nil; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if TARGET_OS_IPHONE |
|
|
|
|
|
|
|
|
|
- (BOOL)openAppPageInAppStore |
|
|
|
|
{ |
|
|
|
|
if (!_updateURL && !self.appStoreID) |
|
|
|
|
{ |
|
|
|
|
if (self.verboseLogging) |
|
|
|
|
{ |
|
|
|
|
NSLog(@"iVersion was unable to open the App Store because the app store ID is not set."); |
|
|
|
|
} |
|
|
|
|
return NO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if defined(IVERSION_USE_STOREKIT) && IVERSION_USE_STOREKIT |
|
|
|
|
|
|
|
|
|
if (!_updateURL && [SKStoreProductViewController class]) |
|
|
|
|
{ |
|
|
|
|
if (self.verboseLogging) |
|
|
|
|
{ |
|
|
|
|
NSLog(@"iVersion will attempt to open the StoreKit in-app product page using the following app store ID: %@", @(self.appStoreID)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//create store view controller |
|
|
|
|
SKStoreProductViewController *productController = [[SKStoreProductViewController alloc] init]; |
|
|
|
|
productController.delegate = (id<SKStoreProductViewControllerDelegate>)self; |
|
|
|
|
|
|
|
|
|
//load product details |
|
|
|
|
NSDictionary *productParameters = @{SKStoreProductParameterITunesItemIdentifier: [@(_appStoreID) description]}; |
|
|
|
|
[productController loadProductWithParameters:productParameters completionBlock:NULL]; |
|
|
|
|
|
|
|
|
|
//get root view controller |
|
|
|
|
UIWindow *window = [[UIApplication sharedApplication] delegate].window; |
|
|
|
|
UIViewController *rootViewController = window.rootViewController; |
|
|
|
|
if (!rootViewController) |
|
|
|
|
{ |
|
|
|
|
if (self.verboseLogging) |
|
|
|
|
{ |
|
|
|
|
NSLog(@"iVersion couldn't find a root view controller from which to display StoreKit product page"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
while (rootViewController.presentedViewController) |
|
|
|
|
{ |
|
|
|
|
rootViewController = rootViewController.presentedViewController; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//present product view controller |
|
|
|
|
[rootViewController presentViewController:productController animated:YES completion:nil]; |
|
|
|
|
if ([self.delegate respondsToSelector:@selector(iVersionDidPresentStoreKitModal)]) |
|
|
|
|
- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(__unused void *)contextInfo |
|
|
|
|
{ |
|
|
|
|
[self.delegate iVersionDidPresentStoreKitModal]; |
|
|
|
|
} |
|
|
|
|
return YES; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (self.verboseLogging) |
|
|
|
|
{ |
|
|
|
|
NSLog(@"iVersion will open the App Store using the following URL: %@", self.updateURL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[[UIApplication sharedApplication] openURL:self.updateURL]; |
|
|
|
|
return YES; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)productViewControllerDidFinish:(UIViewController *)controller |
|
|
|
|
{ |
|
|
|
|
[controller.presentingViewController dismissViewControllerAnimated:YES completion:NULL]; |
|
|
|
|
if ([self.delegate respondsToSelector:@selector(iVersionDidDismissStoreKitModal)]) |
|
|
|
|
{ |
|
|
|
|
[self.delegate iVersionDidDismissStoreKitModal]; |
|
|
|
|
[self didDismissAlert:alert withButtonAtIndex:returnCode - NSAlertFirstButtonReturn]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)resizeAlertView:(UIAlertView *)alertView |
|
|
|
|
{ |
|
|
|
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && |
|
|
|
|
UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation) && |
|
|
|
|
[[UIDevice currentDevice].systemVersion floatValue] < 7.0f) |
|
|
|
|
{ |
|
|
|
|
CGFloat max = alertView.window.bounds.size.height - alertView.frame.size.height - 10.0f; |
|
|
|
|
CGFloat offset = 0.0f; |
|
|
|
|
for (UIView *view in alertView.subviews) |
|
|
|
|
{ |
|
|
|
|
CGRect frame = view.frame; |
|
|
|
|
if ([view isKindOfClass:[UILabel class]]) |
|
|
|
|
{ |
|
|
|
|
UILabel *label = (UILabel *)view; |
|
|
|
|
if ([label.text isEqualToString:alertView.message]) |
|
|
|
|
{ |
|
|
|
|
label.lineBreakMode = NSLineBreakByWordWrapping; |
|
|
|
|
label.numberOfLines = 0; |
|
|
|
|
label.alpha = 1.0f; |
|
|
|
|
[label sizeToFit]; |
|
|
|
|
offset = label.frame.size.height - frame.size.height; |
|
|
|
|
frame.size.height = label.frame.size.height; |
|
|
|
|
if (offset > max) |
|
|
|
|
{ |
|
|
|
|
frame.size.height -= (offset - max); |
|
|
|
|
offset = max; |
|
|
|
|
} |
|
|
|
|
if (offset > max - 10.0f) |
|
|
|
|
{ |
|
|
|
|
frame.size.height -= (offset - max - 10); |
|
|
|
|
frame.origin.y += (offset - max - 10) / 2.0f; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if ([view isKindOfClass:[UITextView class]]) |
|
|
|
|
- (void)openAppPageWhenAppStoreLaunched |
|
|
|
|
{ |
|
|
|
|
view.alpha = 0.0f; |
|
|
|
|
} |
|
|
|
|
else if ([view isKindOfClass:[UIControl class]]) |
|
|
|
|
{ |
|
|
|
|
frame.origin.y += offset; |
|
|
|
|
} |
|
|
|
|
view.frame = frame; |
|
|
|
|
} |
|
|
|
|
CGRect frame = alertView.frame; |
|
|
|
|
frame.origin.y -= roundf(offset/2.0f); |
|
|
|
|
frame.size.height += offset; |
|
|
|
|
alertView.frame = frame; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)didRotate |
|
|
|
|
{ |
|
|
|
|
[self performSelectorOnMainThread:@selector(resizeAlertView:) withObject:self.visibleLocalAlert waitUntilDone:NO]; |
|
|
|
|
[self performSelectorOnMainThread:@selector(resizeAlertView:) withObject:self.visibleRemoteAlert waitUntilDone:NO]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)willPresentAlertView:(UIAlertView *)alertView |
|
|
|
|
{ |
|
|
|
|
[self resizeAlertView:alertView]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex |
|
|
|
|
{ |
|
|
|
|
[self didDismissAlert:alertView withButtonAtIndex:buttonIndex]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
|
|
- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(__unused void *)contextInfo |
|
|
|
|
{ |
|
|
|
|
[self didDismissAlert:alert withButtonAtIndex:returnCode - NSAlertFirstButtonReturn]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)openAppPageWhenAppStoreLaunched |
|
|
|
|
{ |
|
|
|
|
//check if app store is running |
|
|
|
|
for (NSRunningApplication *app in [NSWorkspace sharedWorkspace].runningApplications) |
|
|
|
|
{ |
|
|
|
@ -1235,10 +951,10 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
|
|
|
|
|
//try again |
|
|
|
|
[self performSelector:@selector(openAppPageWhenAppStoreLaunched) withObject:nil afterDelay:0.0]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (BOOL)openAppPageInAppStore |
|
|
|
|
{ |
|
|
|
|
- (BOOL)openAppPageInAppStore |
|
|
|
|
{ |
|
|
|
|
if (!_updateURL && !self.appStoreID) |
|
|
|
|
{ |
|
|
|
|
if (self.verboseLogging) |
|
|
|
@ -1256,32 +972,13 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
[[NSWorkspace sharedWorkspace] openURL:self.updateURL]; |
|
|
|
|
if (!_updateURL) [self openAppPageWhenAppStoreLaunched]; |
|
|
|
|
return YES; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
- (void)applicationLaunched |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
if (self.checkAtLaunch) |
|
|
|
|
{ |
|
|
|
|
[self checkIfNewVersion]; |
|
|
|
|
if ([self shouldCheckForNewVersion]) [self checkForNewVersion]; |
|
|
|
|
} |
|
|
|
|
else if (self.verboseLogging) |
|
|
|
|
{ |
|
|
|
|
NSLog(@"iVersion will not check for updates because the checkAtLaunch option is disabled"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if TARGET_OS_IPHONE |
|
|
|
|
|
|
|
|
|
- (void)applicationWillEnterForeground |
|
|
|
|
{ |
|
|
|
|
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) |
|
|
|
|
- (void)applicationLaunched |
|
|
|
|
{ |
|
|
|
|
if (self.checkAtLaunch) |
|
|
|
|
{ |
|
|
|
|
[self checkIfNewVersion]; |
|
|
|
|
if ([self shouldCheckForNewVersion]) [self checkForNewVersion]; |
|
|
|
|
} |
|
|
|
|
else if (self.verboseLogging) |
|
|
|
@ -1289,8 +986,5 @@ static NSString *const iVersionMacAppStoreURLFormat = @"macappstore://itunes.app
|
|
|
|
|
NSLog(@"iVersion will not check for updates because the checkAtLaunch option is disabled"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
@end |
|
|
|
|
@end |
|
|
|
|