Adding current version to iPhone app so it can update from the server.

This commit is contained in:
Samuel Clay 2011-12-07 09:57:33 -08:00
parent f727c3a3d6
commit 5a8d154b47
4 changed files with 53 additions and 32 deletions

View file

@ -269,7 +269,7 @@ def load_feeds_flat(request):
make_feeds_folder(folder, flat_folder_name, depth+1) make_feeds_folder(folder, flat_folder_name, depth+1)
make_feeds_folder(folders) 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 return data
@ratelimit(minutes=1, requests=10) @ratelimit(minutes=1, requests=10)

View file

@ -249,6 +249,17 @@
[self calculateFeedLocations:YES]; [self calculateFeedLocations:YES];
[self.feedTitlesTable reloadData]; [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]; [sortedFolders release];
[results release]; [results release];
} }
@ -256,10 +267,12 @@
- (IBAction)doLogoutButton { - (IBAction)doLogoutButton {
UIAlertView *logoutConfirm = [[UIAlertView alloc] initWithTitle:@"Positive?" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Logout", nil]; UIAlertView *logoutConfirm = [[UIAlertView alloc] initWithTitle:@"Positive?" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Logout", nil];
[logoutConfirm show]; [logoutConfirm show];
[logoutConfirm setTag:1];
[logoutConfirm release]; [logoutConfirm release];
} }
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (alertView.tag == 1) {
if (buttonIndex == 0) { if (buttonIndex == 0) {
return; return;
} else { } else {
@ -289,6 +302,14 @@
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.labelText = @"Logging out..."; 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];
}
}
} }
- (IBAction)doSwitchSitesUnread { - (IBAction)doSwitchSitesUnread {

View file

@ -24,11 +24,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.1</string> <string></string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.1</string> <string>1.2</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSMainNibFile</key> <key>NSMainNibFile</key>

View file

@ -15,7 +15,7 @@
// #define BACKGROUND_REFRESH_SECONDS -5 // #define BACKGROUND_REFRESH_SECONDS -5
#define BACKGROUND_REFRESH_SECONDS -10*60 #define BACKGROUND_REFRESH_SECONDS -10*60
// #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host:8000"] #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host:8000"]
#define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"] // #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
#endif #endif