=== modified file 'Files/U1FolderViewController.m' --- Files/U1FolderViewController.m 2011-12-14 19:43:35 +0000 +++ Files/U1FolderViewController.m 2012-04-09 20:42:31 +0000 @@ -18,6 +18,7 @@ #import #import #import +#import #import "U1Asset.h" #import "U1AssetRepresenationDataProvider.h" @@ -136,7 +137,21 @@ { UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; - [self presentModalViewController:imagePicker animated:YES]; + + if ([CLLocationManager locationServicesEnabled] == YES ) { + CLAuthorizationStatus auth = [CLLocationManager authorizationStatus]; + if (auth==kCLAuthorizationStatusAuthorized) { + // rock on + [self presentModalViewController:imagePicker animated:YES]; + } else { + UIAlertView *alert=[[[UIAlertView alloc] initWithTitle:@"Location Services Off" message:@"U1 Files app must be authorized to use location services to upload from Photos. In Settings App turn on Locatation Services -> U1Files" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] autorelease]; + [alert show]; + } + } else { + // present error dialog with directions how to turn it on + UIAlertView *alert=[[[UIAlertView alloc] initWithTitle:@"Location Services Off" message:@"Location services must be on to upload from Photos. In Settings App turn on Locatation Services" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] autorelease]; + [alert show]; + } } - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info; === modified file 'Files/U1SettingsViewController.m' --- Files/U1SettingsViewController.m 2011-12-14 20:33:53 +0000 +++ Files/U1SettingsViewController.m 2012-04-09 20:42:31 +0000 @@ -16,6 +16,7 @@ #import "U1SettingsViewController.h" #import +#import #import "U1AccountManager.h" #import "U1ByteSizeValueTransformer.h" @@ -118,25 +119,39 @@ - (void)toggleAutoUpload:(id)sender; { BOOL switchValue = ((UISwitch *)sender).on; - [[NSUserDefaults standardUserDefaults] setBool:switchValue forKey:@"auto_upload"]; - if (switchValue) - { - self.includeVideoToggleLabel.textColor = [UIColor blackColor]; - self.includeVideoToggle.enabled = YES; - self.wifiOnlyToggleLabel.textColor = [UIColor blackColor]; - self.wifiOnlyToggle.enabled = YES; - self.disableSleepToggleLabel.textColor = [UIColor blackColor]; - self.disableSleepToggle.enabled = YES; - } - else - { - self.includeVideoToggleLabel.textColor = [UIColor grayColor]; - self.includeVideoToggle.enabled = NO; - self.wifiOnlyToggleLabel.textColor = [UIColor grayColor]; - self.wifiOnlyToggle.enabled = NO; - self.disableSleepToggleLabel.textColor = [UIColor grayColor]; - self.disableSleepToggle.enabled = NO; - } + + if ([CLLocationManager locationServicesEnabled] == YES ) { + CLAuthorizationStatus auth = [CLLocationManager authorizationStatus]; + if (auth==kCLAuthorizationStatusAuthorized) { + // rock on + + [[NSUserDefaults standardUserDefaults] setBool:switchValue forKey:@"auto_upload"]; + if (switchValue) { + self.includeVideoToggleLabel.textColor = [UIColor blackColor]; + self.includeVideoToggle.enabled = YES; + self.wifiOnlyToggleLabel.textColor = [UIColor blackColor]; + self.wifiOnlyToggle.enabled = YES; + self.disableSleepToggleLabel.textColor = [UIColor blackColor]; + self.disableSleepToggle.enabled = YES; + } else { + self.includeVideoToggleLabel.textColor = [UIColor grayColor]; + self.includeVideoToggle.enabled = NO; + self.wifiOnlyToggleLabel.textColor = [UIColor grayColor]; + self.wifiOnlyToggle.enabled = NO; + self.disableSleepToggleLabel.textColor = [UIColor grayColor]; + self.disableSleepToggle.enabled = NO; + } + } else { + UIAlertView *alert=[[[UIAlertView alloc] initWithTitle:@"Location Services Off" message:@"U1 Files app must be authorized to use location services to upload from Photos. In Settings App turn on Locatation Services -> U1Files" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] autorelease]; + [alert show]; + [(UISwitch *)sender setOn:NO animated:NO]; + } + } else { + // present error dialog with directions how to turn it on + UIAlertView *alert=[[[UIAlertView alloc] initWithTitle:@"Location Services Off" message:@"Location services must be on to upload from Photos. In Settings App turn on Locatation Services" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] autorelease]; + [alert show]; + [(UISwitch *)sender setOn:NO animated:NO]; + } } - (void)toggleWifiOnly:(id)sender;