Permalink
Browse files

Rhus now running off TouchDB

  • Loading branch information...
1 parent 5316c04 commit 73fa3b748b1a03e9678fc6c63d7441a88e4a2c00 @deepwinter committed May 22, 2012
@@ -753,6 +753,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.2;
ONLY_ACTIVE_ARCH = NO;
+ OTHER_LDFLAGS = "-ObjC";
PROVISIONING_PROFILE = "";
SDKROOT = iphoneos5.0;
TARGETED_DEVICE_FAMILY = 1;
@@ -780,6 +781,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 4.2;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ OTHER_LDFLAGS = "-ObjC";
PROVISIONING_PROFILE = "";
SDKROOT = iphoneos5.0;
TARGETED_DEVICE_FAMILY = 1;
@@ -32,7 +32,7 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
-
+ /*
NSLog(@"Creating database...");
CouchTouchDBServer* aserver = [CouchTouchDBServer sharedInstance];
NSAssert(!aserver.error, @"Error initializing TouchDB: %@", aserver.error);
@@ -49,7 +49,7 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
return self;
-
+ */
@@ -87,13 +87,13 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
if(![RHSettings useRemoteServer]){
// Create the database on the first run of the app.
- NSError* error;
- /*
+ NSError* error;
if (![self.database ensureCreated: &error]) {
[self showAlert: @"Couldn't create local database." error: error fatal: YES];
return;
}
- */
+ NSLog(@"...Created CouchDatabase at <%@>", self.database.URL);
+
}
@@ -110,19 +110,6 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
[design defineViewNamed: @"deviceUserGalleryDocuments" mapBlock: ^(NSDictionary* doc, void (^emit)(id key, id value)){
-
- /* NSMutableArray * key = [NSMutableArray array];
- [key addObject:[doc objectForKey: @"deviceuser_identifier"]];
- [key addObject:[doc objectForKey: @"project"]];
- [key addObject:[doc objectForKey: @"created_at"]];
-
- /*arrayWithObjects:
- [doc objectForKey: @"deviceuser_identifier"],
- [doc objectForKey: @"project"],
- [doc objectForKey: @"created_at"],
- nil];
- */
-
NSArray * key = [NSArray arrayWithObjects:
[doc objectForKey: @"deviceuser_identifier"],
@@ -131,13 +118,13 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
nil];
NSDictionary * value = [NSDictionary dictionaryWithObjectsAndKeys:
- @"id", [doc objectForKey: @"_id"],
- @"thumb", [doc objectForKey: @"thumb"],
- @"latitude", [doc objectForKey: @"latitude"],
- @"longitude", [doc objectForKey: @"longitude"],
- @"reporter", [doc objectForKey: @"reporter"],
- @"comment", [doc objectForKey: @"comment"],
- @"created_at", [doc objectForKey: @"created_at"],
+ [doc objectForKey: @"_id"], @"id",
+ [doc objectForKey: @"thumb"], @"thumb",
+ [doc objectForKey: @"latitude"], @"latitude",
+ [doc objectForKey: @"longitude"], @"longitude",
+ [doc objectForKey: @"reporter"], @"reporter",
+ [doc objectForKey: @"comment"], @"comment",
+ [doc objectForKey: @"created_at"],@"created_at",
nil];
emit(key, value);
} version: @"1.0"];
@@ -161,15 +148,17 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
[doc objectForKey:@"project"],
[doc objectForKey:@"created_at"],
nil];
+
NSDictionary * value = [NSDictionary dictionaryWithObjectsAndKeys:
- @"id", [doc objectForKey: @"_id"],
- @"thumb", [doc objectForKey: @"thumb"],
- @"latitude", [doc objectForKey: @"latitude"],
- @"longitude", [doc objectForKey: @"longitude"],
- @"reporter", [doc objectForKey: @"reporter"],
- @"comment", [doc objectForKey: @"comment"],
- @"created_at", [doc objectForKey: @"created_at"],
+ [doc objectForKey: @"_id"], @"id",
+ [doc objectForKey: @"thumb"], @"thumb",
+ [doc objectForKey: @"latitude"], @"latitude",
+ [doc objectForKey: @"longitude"], @"longitude",
+ [doc objectForKey: @"reporter"], @"reporter",
+ [doc objectForKey: @"comment"], @"comment",
+ [doc objectForKey: @"created_at"], @"created_at",
nil];
+
emit(key, value);
} version: @"1.0"];
@@ -181,14 +170,14 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
[design defineViewNamed: @"documentDetail" mapBlock: ^(NSDictionary* doc, void (^emit)(id key, id value)){
NSString * key = [doc objectForKey:@"_id"];
NSDictionary * value = [NSDictionary dictionaryWithObjectsAndKeys:
- @"id", [doc objectForKey: @"_id"],
- @"thumb", [doc objectForKey: @"thumb"],
- @"medium", [doc objectForKey: @"medium"],
- @"latitude", [doc objectForKey: @"latitude"],
- @"longitude", [doc objectForKey: @"longitude"],
- @"reporter", [doc objectForKey: @"reporter"],
- @"comment", [doc objectForKey: @"comment"],
- @"created_at", [doc objectForKey: @"created_at"],
+ [doc objectForKey: @"_id"], @"id",
+ [doc objectForKey: @"thumb"], @"thumb",
+ [doc objectForKey: @"medium"], @"medium",
+ [doc objectForKey: @"latitude"], @"latitude",
+ [doc objectForKey: @"longitude"], @"longitude",
+ [doc objectForKey: @"reporter"], @"reporter",
+ [doc objectForKey: @"comment"], @"comment",
+ [doc objectForKey: @"created_at"], @"created_at",
nil];
} version: @"1.0"];
/* )
@@ -198,7 +187,9 @@ - (id) initWithBlock:( void ( ^ )() ) didStartBlock {
[design defineViewNamed: @"projects" mapBlock: ^(NSDictionary* doc, void (^emit)(id key, id value)){
NSString * key = [doc objectForKey:@"project"];
- emit(key, NULL);
+ if(key != NULL){
+ emit(key, NULL);
+ }
}
reduceBlock: REDUCEBLOCK({
return NULL;
@@ -23,6 +23,10 @@ @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
+
+ NSDictionary * dict = [NSDictionary dictionary];
+ //NSLog(@"wact %@",(NSString *)[dict objectForKey:@"hey"]);
+
[self initializeAppDelegateAndLaunch];
return true;
@@ -104,7 +108,7 @@ - (void) initializeInBackground{
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(receivedRotate) name: UIDeviceOrientationDidChangeNotification object: nil];
}
//If we are on iPhone 4, start replications
- // [[RHDataModel instance] updateSyncURL];
+ [[RHDataModel instance] updateSyncURL];
} ];
@@ -244,7 +244,7 @@ - (void) addAnnotations {
if(coordinate.latitude == 0 && coordinate.longitude==0){
continue;
}
- // NSLog(@"%f %f", coordinate.latitude, coordinate.longitude );
+ //NSLog(@"%f %f", coordinate.latitude, coordinate.longitude );
RHMapAnnotation * rhusMapAnnotation = (RHMapAnnotation *) [RHMapAnnotation
mapAnnotationWithCoordinate: coordinate
title: [document getDateString]

0 comments on commit 73fa3b7

Please sign in to comment.