aboutsummaryrefslogtreecommitdiffstats
path: root/iphone/FixMyStreet/Classes
diff options
context:
space:
mode:
Diffstat (limited to 'iphone/FixMyStreet/Classes')
-rw-r--r--iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m56
-rw-r--r--iphone/FixMyStreet/Classes/InputTableViewController.m12
2 files changed, 53 insertions, 15 deletions
diff --git a/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m b/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m
index 326692568..4491bb85e 100644
--- a/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m
+++ b/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m
@@ -25,23 +25,73 @@
[aNavigationController release];
[inputTableViewController release];
// [rootViewController release];
-
+
+ // NSMutableArray *tempMutableCopy = [[[NSUserDefaults standardUserDefaults] objectForKey:kRestoreLocationKey] mutableCopy];
+ name = [[NSUserDefaults standardUserDefaults] stringForKey:@"Name"];
+ email = [[NSUserDefaults standardUserDefaults] stringForKey:@"Email"];
+ phone = [[NSUserDefaults standardUserDefaults] stringForKey:@"Phone"];
+ subject = [[NSUserDefaults standardUserDefaults] stringForKey:@"Subject"];
+
+// NSData *imageData = [[[NSUserDefaults standardUserDefaults] objectForKey:@"Image"] mutableCopy];
+// if (imageData != nil)
+// image = (UIImage *)[NSKeyedUnarchiver unarchiveObjectWithData:imageData];
+// [imageData release];
+
+// NSData *locationData = [[NSUserDefaults standardUserDefaults] objectForKey:@"Location"];
+// if (locationData != nil)
+// location = (CLLocation *)[NSUnarchiver unarchiveObjectWithData:locationData];
+// [locationData release];
+
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
-
- // Need to fetch defaults here, plus anything saved when we quit last time
+
+// NSArray *keys = [NSArray arrayWithObjects:@"Name", @"Email", @"Phone", nil];
+// NSArray *values = [NSArray arrayWithObjects:name, email, phone, nil];
+// NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:values forKeys:keys];
+// [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
+// [[NSUserDefaults standardUserDefaults] synchronize];
+// [keys release];
+// [values release];
+// [dictionary release];
}
- (void)dealloc {
[window release];
[navigationController release];
// [viewController release];
+ [image release];
+ [subject release];
+ [location release];
+ [name release];
+ [email release];
+ [phone release];
[super dealloc];
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Save state in case they're just in the middle of a phone call...
+ [[NSUserDefaults standardUserDefaults] setObject:name forKey:@"Name"];
+ [[NSUserDefaults standardUserDefaults] setObject:email forKey:@"Email"];
+ [[NSUserDefaults standardUserDefaults] setObject:phone forKey:@"Phone"];
+ [[NSUserDefaults standardUserDefaults] setObject:subject forKey:@"Subject"];
+
+// XXX image crashes (restarting app. still has image showing?! and then quitting crashes, either way)
+// Location just doesn't seem to work
+
+// if (image) {
+// NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+// NSString *imageFile = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"saved.image"];
+// [NSKeyedArchiver archiveRootObject:image toFile:imageFile];
+// }
+// NSData *imageData = [NSKeyedArchiver archivedDataWithRootObject:image];
+// [[NSUserDefaults standardUserDefaults] setObject:imageData forKey:@"Image"];
+// [imageData release];
+
+// NSData *locationData = [NSKeyedArchiver archivedDataWithRootObject:location];
+// [[NSUserDefaults standardUserDefaults] setObject:locationData forKey:@"Location"];
+// [locationData release];
+ [[NSUserDefaults standardUserDefaults] synchronize];
}
// Report stuff
diff --git a/iphone/FixMyStreet/Classes/InputTableViewController.m b/iphone/FixMyStreet/Classes/InputTableViewController.m
index 4de1b38bd..850257632 100644
--- a/iphone/FixMyStreet/Classes/InputTableViewController.m
+++ b/iphone/FixMyStreet/Classes/InputTableViewController.m
@@ -20,9 +20,6 @@
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle {
if (self = [super initWithNibName:nibName bundle:nibBundle]) {
self.title = @"FixMyStreet";
- // These seem to work better in viewDidLoad
- // actionsToDoView.sectionHeaderHeight = 0.0;
- // self.navigationItem.backBarButtonItem.title = @"Foo";
}
return self;
}
@@ -62,19 +59,10 @@
return 3;
}
-- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
- // Possible section==1 heading to make summary clearer once entered?
- return nil;
-}
-
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
-//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-// return 44.0f;
-//}
-
-(void)enableSubmissionButton {
[actionsToDoView reloadData];
FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate];