Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor cleanup, bugfix.
  • Loading branch information
nfarina committed Mar 26, 2011
1 parent d2783e2 commit e7074cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
5 changes: 1 addition & 4 deletions SampleProject/AppDelegate.h
@@ -1,6 +1,3 @@

@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
bool displayedOfflineAlert;
}
@interface AppDelegate : NSObject <UIApplicationDelegate>
@end
15 changes: 10 additions & 5 deletions SampleProject/AppDelegate.m
Expand Up @@ -28,7 +28,7 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application {
home.tableView.backgroundColor = [UIColor colorWithRed:246.0/255.0 green:246.0/255.0 blue:239.0/255.0 alpha:1];
nav.navigationBar.tintColor = [UIColor colorWithRed:235.0/255.0 green:120.0/255.0 blue:31.0/255.0 alpha:1];

window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[window addSubview:nav.view];
[window makeKeyAndVisible];
}
Expand All @@ -40,10 +40,15 @@ - (void)googleFinished:(NSData *)responseData {

// Global error handler displays a simple failure message.
- (void)webRequestError:(NSNotification *)notification {
if (displayedOfflineAlert) return;
displayedOfflineAlert = YES;
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Request Error" message:@"You appear to be offline. Please try again later." delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
[alertView show];
static bool displayedOfflineAlert = NO;
static NSString *title = @"Request Error";
static NSString *message = @"You appear to be offline. Please try again later.";

if (!displayedOfflineAlert) {
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:title message:message delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil] autorelease];
[alertView show];
displayedOfflineAlert = YES;
}
}

@end

0 comments on commit e7074cd

Please sign in to comment.