Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated location services alerts

  • Loading branch information...
commit 5a116d26fe5b16bcbccdd159dd61cf01ed76e8e7 1 parent 14e6d82
@deepwinter authored
View
17 Source/DataModels/RHDataModel.m
@@ -78,7 +78,7 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
// BOOL started = [server start: ^{ // ... this block runs later on when the server has started up:
if (server.error) {
[self showAlert: @"Couldn't start Couchbase." error: server.error fatal: YES];
- return;
+ return nil;
}
self.database = [server databaseNamed: [RHSettings databaseName]];
@@ -90,7 +90,7 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
NSError* error;
if (![self.database ensureCreated: &error]) {
[self showAlert: @"Couldn't create local database." error: error fatal: YES];
- return;
+ return nil;
}
NSLog(@"...Created CouchDatabase at <%@>", self.database.URL);
@@ -179,6 +179,8 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
[doc objectForKey: @"comment"], @"comment",
[doc objectForKey: @"created_at"], @"created_at",
nil];
+
+ emit(key, value);
} version: @"1.0"];
/* )
map: @"function(doc) { emit( doc._id, {'id' :doc._id, 'reporter' : doc.reporter, 'comment' : doc.comment, 'thumb' : doc.thumb, 'medium' : doc.medium, 'created_at' : doc.created_at} );}"];
@@ -380,6 +382,7 @@ + (NSArray *) getDeviceUserGalleryDocumentsWithStartKey: (NSString *) startKey a
+ (NSArray *) getAllDocuments {
//TODO: Implement
+ return [NSArray array];
}
+ (NSArray *) getDocumentsInProject: (NSString *) project {
@@ -482,10 +485,10 @@ + (NSString *) addDocument: (NSDictionary *) document {
[op wait]; //kickin it synchronous for right now.
RESTBody * responseBody = op.responseBody;
- NSLog([op.responseBody asString]);
+ NSLog(@"%@", [op.responseBody asString]);
NSDictionary * object = (NSDictionary *)responseBody.fromJSON;
- NSLog([object objectForKey:@"id"]);
+ NSLog(@"%@", [object objectForKey:@"id"]);
return [object objectForKey:@"id"];
}
@@ -544,13 +547,7 @@ - (void)updateSyncURL {
- (void)updateSyncURLWithCompletedBlock: ( CompletedBlock ) setCompletedBlock {
- //Should check for reachability of data.winterroot.net
- //http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk
- //Test for network
-
- NSInteger count = [self.database getDocumentCount];
-
if (!self.database){
NSLog(@"No Database in updateSyncURL");
return;
View
7 Source/DataModels/RHLocation.m
@@ -59,15 +59,18 @@ + (NSString *) getLongitudeString {
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
if(status != kCLAuthorizationStatusAuthorized){
- UIAlertView *alert = [[UIAlertView alloc]
+ //This block gets called both if they decline and the first time Location Services asks for access when it doesn't already have access
+ //So it gets called twice, which is confusing.
+/* UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:[NSString stringWithFormat:@"Location Services Declined"]
message:
[NSString stringWithFormat:@"We can understand not wanting to use location services, but this application is pretty useless without them turned on"]
delegate: self
- cancelButtonTitle:@"Enable Location Services"
+ cancelButtonTitle:@"Please Enable Location Services"
otherButtonTitles:nil
];
[alert show];
+ */
}
}
View
18 Source/Views and Controllers/CameraViewController.m
@@ -101,6 +101,7 @@ - (void)viewDidAppear:(BOOL)animated {
self.imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
}
+
}
- (void)viewWillDisappear:(BOOL)animated{
@@ -161,6 +162,23 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
- (void) secondTapTabButton{
if([RHSettings useCamera]){
+
+ if( !([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized)
+ || !([CLLocationManager locationServicesEnabled] == YES) ) {
+
+ UIAlertView *alert = [[UIAlertView alloc]
+ initWithTitle:[NSString stringWithFormat:@"Location Services Declined"]
+ message:
+ [NSString stringWithFormat:@"You must enable location services to capture new images in this application and add them to the map."]
+ delegate: self
+ cancelButtonTitle:@"Please Enable Location Services"
+ otherButtonTitles:nil
+ ];
+ [alert show];
+ return;
+
+ }
+
[self.view addSubview:shutterView];
if(UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation])){
self.activeImageOrientation = kLandscapePhoto;
Please sign in to comment.
Something went wrong with that request. Please try again.