diff options
Diffstat (limited to 'iphone/FixMyStreet/Classes')
5 files changed, 60 insertions, 8 deletions
diff --git a/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m b/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m index 4491bb85e..ae6739e41 100644 --- a/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m +++ b/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m @@ -97,6 +97,19 @@ // Report stuff -(void)uploadReport { // Not yet working - do something spinny here + [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; +// struct CGRect rect = [UIHardware fullScreenApplicationContentRect]; +// rect.origin.x = rect.origin.y = 0.0f; +// UIWindow *window = [[UIWindow alloc] initWithContentRect: rect]; +// [window orderFront: self]; +// [window makeKey: self]; +// [window setContentView: imgView]; +// +// id HUD = [[UIProgressHUD alloc] initWithWindow:window]; +// [HUD setText:@"Downloading now..."]; +// [HUD show:YES]; + + // UIActivityIndicatorView *spinny = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; // [spinny startAnimating]; // [spinny release]; @@ -168,7 +181,10 @@ NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSASCIIStringEncoding]; - + + [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; +// [HUD show:NO]; + // For now, just pop up alert box with return data UIAlertView *v = [[UIAlertView alloc] initWithTitle:@"Return" message:returnString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [v show]; diff --git a/iphone/FixMyStreet/Classes/InputTableViewController.h b/iphone/FixMyStreet/Classes/InputTableViewController.h index 3eeef327b..eb904d5a1 100644 --- a/iphone/FixMyStreet/Classes/InputTableViewController.h +++ b/iphone/FixMyStreet/Classes/InputTableViewController.h @@ -28,7 +28,7 @@ -(void)uploadReport; -(IBAction)addPhoto:(id) sender; --(IBAction)gotoSettings:(id)sender; +-(IBAction)gotoSettings:(id)sender firstTime:(BOOL)firstTime; // UIImagePickerControllerDelegate - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo; diff --git a/iphone/FixMyStreet/Classes/InputTableViewController.m b/iphone/FixMyStreet/Classes/InputTableViewController.m index 850257632..fcf11c879 100644 --- a/iphone/FixMyStreet/Classes/InputTableViewController.m +++ b/iphone/FixMyStreet/Classes/InputTableViewController.m @@ -267,10 +267,12 @@ // Buttons --(IBAction)gotoSettings:(id)sender { +-(IBAction)gotoSettings:(id)sender firstTime:(BOOL)firstTime { backButton.title = @"Done"; - UIViewController* settingsViewController = [[SettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + SettingsViewController* settingsViewController = [[SettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + if (firstTime) + settingsViewController.firstTime = firstTime; // [self.navigationController pushViewController:settingsViewController animated:YES]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration: 1]; @@ -283,7 +285,7 @@ -(void)uploadReport { FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; if (!delegate.name || !delegate.email) { - [self gotoSettings:nil]; + [self gotoSettings:nil firstTime:NO]; } else { [delegate uploadReport]; } diff --git a/iphone/FixMyStreet/Classes/SettingsViewController.h b/iphone/FixMyStreet/Classes/SettingsViewController.h index 0e325132b..1030129f9 100644 --- a/iphone/FixMyStreet/Classes/SettingsViewController.h +++ b/iphone/FixMyStreet/Classes/SettingsViewController.h @@ -15,6 +15,10 @@ UILabel *emailCurrent; UILabel *phoneLabel; UILabel *phoneCurrent; + + BOOL firstTime; } +@property (nonatomic, assign) BOOL firstTime; + @end diff --git a/iphone/FixMyStreet/Classes/SettingsViewController.m b/iphone/FixMyStreet/Classes/SettingsViewController.m index 4be1686ba..2e3b2dbed 100644 --- a/iphone/FixMyStreet/Classes/SettingsViewController.m +++ b/iphone/FixMyStreet/Classes/SettingsViewController.m @@ -12,6 +12,8 @@ @implementation SettingsViewController +@synthesize firstTime; + /* - (id)initWithStyle:(UITableViewStyle)style { // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. @@ -36,7 +38,9 @@ } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 3; + if (self.firstTime) + return 3; + return 4; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { @@ -47,9 +51,31 @@ return 1; } +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + if (indexPath.section == 3) { + return 54.0; + } + return 44.0; +} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - + + if (indexPath.section == 3) { + static NSString *CellIdentifier = @"InfoCell"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; + UITextView *blurb = [[UITextView alloc] initWithFrame:CGRectMake(10, 0, 280, 44)]; + blurb.font = [UIFont italicSystemFontOfSize:14]; + blurb.textAlignment = UITextAlignmentCenter; + blurb.editable = NO; + blurb.text = @"Please fill in your details, and\nwe'll remember them for next time"; + [cell.contentView addSubview:blurb]; + [blurb release]; + } + return cell; + } + static NSString *CellIdentifier = @"Cell"; FixMyStreetAppDelegate* delegate = [[UIApplication sharedApplication] delegate]; @@ -130,8 +156,12 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; [tableView deselectRowAtIndexPath:indexPath animated:YES]; + if (indexPath.section == 3) { + return; + } + + FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; EditSubjectViewController* editSubjectViewController = [[EditSubjectViewController alloc] initWithStyle:UITableViewStyleGrouped]; if (indexPath.section == 0) { [editSubjectViewController setAll:delegate.name viewTitle:@"Edit name" placeholder:@"Your name" keyboardType:UIKeyboardTypeDefault capitalisation:UITextAutocapitalizationTypeWords]; |