diff --git a/apps/reader/views.py b/apps/reader/views.py index ea9783e56..a839c333c 100644 --- a/apps/reader/views.py +++ b/apps/reader/views.py @@ -269,7 +269,7 @@ def load_feeds_flat(request): make_feeds_folder(folder, flat_folder_name, depth+1) make_feeds_folder(folders) - data = dict(flat_folders=flat_folders, feeds=feeds, user=user.username) + data = dict(flat_folders=flat_folders, feeds=feeds, user=user.username, iphone_version="1.2") return data @ratelimit(minutes=1, requests=10) diff --git a/media/iphone/Classes/NewsBlurViewController.m b/media/iphone/Classes/NewsBlurViewController.m index 36ec99d73..2c2efb4ab 100644 --- a/media/iphone/Classes/NewsBlurViewController.m +++ b/media/iphone/Classes/NewsBlurViewController.m @@ -249,6 +249,17 @@ [self calculateFeedLocations:YES]; [self.feedTitlesTable reloadData]; + NSString *serveriPhoneVersion = [results objectForKey:@"iphone_version"]; + NSString *currentiPhoneVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; + if (![currentiPhoneVersion isEqualToString:serveriPhoneVersion]) { + NSLog(@"Version: %@ - %@", serveriPhoneVersion, currentiPhoneVersion); + NSString *title = [NSString stringWithFormat:@"You should download the new version of NewsBlur.\n\nNew version: v%@.\nYou have: v%@.", serveriPhoneVersion, currentiPhoneVersion]; + UIAlertView *upgradeConfirm = [[UIAlertView alloc] initWithTitle:title message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Upgrade!", nil]; + [upgradeConfirm show]; + [upgradeConfirm setTag:2]; + [upgradeConfirm release]; + } + [sortedFolders release]; [results release]; } @@ -256,38 +267,48 @@ - (IBAction)doLogoutButton { UIAlertView *logoutConfirm = [[UIAlertView alloc] initWithTitle:@"Positive?" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Logout", nil]; [logoutConfirm show]; + [logoutConfirm setTag:1]; [logoutConfirm release]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - if (buttonIndex == 0) { - return; - } else { - NSLog(@"Logging out..."); - NSString *urlS = [NSString stringWithFormat:@"http://%@/reader/logout?api=1", - NEWSBLUR_URL]; - NSURL *url = [NSURL URLWithString:urlS]; - - __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; - [request setDelegate:self]; - [request setResponseEncoding:NSUTF8StringEncoding]; - [request setDefaultResponseEncoding:NSUTF8StringEncoding]; - [request setFailedBlock:^(void) { - [MBProgressHUD hideHUDForView:self.view animated:YES]; - [self finishedWithError:request]; - }]; - [request setCompletionBlock:^(void) { - [MBProgressHUD hideHUDForView:self.view animated:YES]; - [appDelegate showLogin]; - }]; - [request setTimeOutSeconds:30]; - [request startAsynchronous]; - - [ASIHTTPRequest setSessionCookies:nil]; + if (alertView.tag == 1) { + if (buttonIndex == 0) { + return; + } else { + NSLog(@"Logging out..."); + NSString *urlS = [NSString stringWithFormat:@"http://%@/reader/logout?api=1", + NEWSBLUR_URL]; + NSURL *url = [NSURL URLWithString:urlS]; + + __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; + [request setDelegate:self]; + [request setResponseEncoding:NSUTF8StringEncoding]; + [request setDefaultResponseEncoding:NSUTF8StringEncoding]; + [request setFailedBlock:^(void) { + [MBProgressHUD hideHUDForView:self.view animated:YES]; + [self finishedWithError:request]; + }]; + [request setCompletionBlock:^(void) { + [MBProgressHUD hideHUDForView:self.view animated:YES]; + [appDelegate showLogin]; + }]; + [request setTimeOutSeconds:30]; + [request startAsynchronous]; + + [ASIHTTPRequest setSessionCookies:nil]; - [MBProgressHUD hideHUDForView:self.view animated:YES]; - MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; - HUD.labelText = @"Logging out..."; + [MBProgressHUD hideHUDForView:self.view animated:YES]; + MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; + HUD.labelText = @"Logging out..."; + } + } else if (alertView.tag == 2) { + if (buttonIndex == 0) { + return; + } else { + NSURL *url = [NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=463981119&mt=8"]; + [[UIApplication sharedApplication] openURL:url]; + } } } diff --git a/media/iphone/NewsBlur-Info.plist b/media/iphone/NewsBlur-Info.plist index 7ac39a634..3aa7278d9 100644 --- a/media/iphone/NewsBlur-Info.plist +++ b/media/iphone/NewsBlur-Info.plist @@ -24,11 +24,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1 + CFBundleSignature ???? CFBundleVersion - 1.1 + 1.2 LSRequiresIPhoneOS NSMainNibFile diff --git a/media/iphone/NewsBlur_Prefix.pch b/media/iphone/NewsBlur_Prefix.pch index 98e9374b9..df7b5154b 100644 --- a/media/iphone/NewsBlur_Prefix.pch +++ b/media/iphone/NewsBlur_Prefix.pch @@ -15,7 +15,7 @@ // #define BACKGROUND_REFRESH_SECONDS -5 #define BACKGROUND_REFRESH_SECONDS -10*60 -// #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host:8000"] - #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"] + #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host:8000"] +// #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"] #endif