Permalink
Browse files

Refactored, renaming Rhus library files with RH prefix

  • Loading branch information...
1 parent efb9711 commit 1f321fdec1f894ec380a2417510c53755a169c8e @deepwinter committed Apr 23, 2012
@@ -10,7 +10,7 @@
#import "GalleryViewController.h"
#import "CameraViewController.h"
#import "MapViewController.h"
-#import "MapDataModel.h"
+#import "RHDataModel.h"
#import "RHLocation.h"
@implementation AppDelegate
@@ -82,7 +82,7 @@ - (void) initializeInBackground{
@autoreleasepool {
NSLog(@"%@", @"Starting app resources in background");
- [MapDataModel instance];
+ [RHDataModel instance];
NSLog(@"%@", @"Done");
@@ -1,50 +0,0 @@
-//
-// MapCouchbaseDataModel.h
-// Wildflowers of Detroit Iphone
-//
-// Created by Deep Winter on 2/1/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "MapDataModelBase.h"
-
-#import <Couchbase/CouchbaseMobile.h>
-#import <CouchCocoa/CouchCocoa.h>
-
-@class CouchDatabase;
-
-@interface MapCouchbaseDataModel : MapDataModelBase {
-
- CouchPersistentReplication* _pull;
- CouchPersistentReplication* _push;
-
-}
-
-
-@property (nonatomic, strong) CouchDatabase *database;
-@property (nonatomic, strong) CouchLiveQuery* query;
-
-
-+ (MapCouchbaseDataModel *)instance;
-
-+ (void) initializeServer;
-
-
-- (void)showAlert: (NSString*)message error: (NSError*)error fatal: (BOOL)fatal;
-- (NSArray *) _getUserDocuments;
-
-- (void) initializeQuery;
-- (NSArray *) _getUserDocuments;
-
--(void) test;
-
-- (void)updateSyncURL;
-- (void)forgetSync;
-- (NSArray *) getView: (NSString *) viewName;
-
-
-+ (NSArray *) getDetailDocumentsWithStartKey: (NSString *) startKey andLimit: (NSInteger) limit;
-+ (NSArray *) getGalleryDocumentsWithStartKey: (NSString *) startKey andLimit: (NSInteger) limit;
-
-@end
@@ -1,25 +0,0 @@
-//
-// MapDataModel.h
-// Wildflowers of Detroit Iphone
-//
-// Created by Deep Winter on 2/1/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-
-//Uncomment this line to use data spoofing
-//#define UseMapDataModelSpoof
-
-#ifdef UseMapDataModelSpoof
-
-#import "MapDataModelSpoof.h"
-@interface MapDataModel : MapDataModelSpoof
-
-#else
-
-#import "MapCouchbaseDataModel.h"
-@interface MapDataModel : MapCouchbaseDataModel
-
-#endif
-
-@end
@@ -1,13 +0,0 @@
-//
-// MapDataModel.m
-// Wildflowers of Detroit Iphone
-//
-// Created by Deep Winter on 2/1/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#import "MapDataModel.h"
-
-@implementation MapDataModel
- //should be empty
-@end
@@ -1,23 +0,0 @@
-//
-// MapDataModelBase.m
-// Wildflowers of Detroit Iphone
-//
-// Created by Deep Winter on 2/1/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#import "MapDataModelBase.h"
-#import "SharedInstanceMacro.h"
-
-
-@implementation MapDataModelBase
-
-
-+ (id)instance
-{
- DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
- return [[self alloc] init];
- });
-}
-
-@end
@@ -1,23 +0,0 @@
-//
-// MapDataModel.h
-// Wildflowers of Detroit Iphone
-//
-// Created by Deep Winter on 1/10/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "OrderedDictionary.h"
-#import "MapDataModelBase.h"
-
-
-@interface MapDataModelSpoof: MapDataModelBase
-{
- OrderedDictionary * userDocuments;
-}
-@property(nonatomic, strong) OrderedDictionary * userDocuments;
-
-
-+ (MapDataModelSpoof *) instance;
-
-@end
@@ -1,86 +0,0 @@
-//
-// MapDataModel.m
-// Wildflowers of Detroit Iphone
-//
-// Created by Deep Winter on 1/10/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-#import "MapDataModelSpoof.h"
-
-#import <CouchCocoa/CouchCocoa.h>
-
-@implementation MapDataModelSpoof
-
-@synthesize userDocuments;
-
-+ (MapDataModelSpoof *) instance {
- return (MapDataModelSpoof *) [super instance];
-}
-
-+ (NSArray *) getUserDocuments {
- return [ ( (MapDataModelSpoof *) [self instance] ).userDocuments allValues];
-}
-
-+ (NSArray *) getUserDocumentsWithOffset: (NSInteger) offset andLimit: (NSInteger) limit {
-
- OrderedDictionary * subset = [[self instance].userDocuments subsetWithOffset:offset andLimit:limit];
- return [subset allValues];
-
-}
-
-+ (NSDictionary *) getDocumentById: (NSString *) documentId{
- return [[self instance].userDocuments objectForKey:documentId];
-}
-
-+ (NSDictionary *) getNextDocument: (NSString *) documentId{
- NSDictionary * currObject = [self getDocumentById:documentId];
- NSInteger indexOfObject = [[self instance].userDocuments indexOfObject:currObject];
- id key = [[self instance].userDocuments keyAtIndex:indexOfObject+1];
- return [[self instance].userDocuments objectForKey:key];
-}
-
-+ (NSDictionary *) getPrevDocument: (NSString *) documentId{
- NSDictionary * currObject = [self getDocumentById:documentId];
- NSInteger indexOfObject = [[self instance].userDocuments indexOfObject:currObject];
- id key = [[self instance].userDocuments keyAtIndex:indexOfObject-1];
- return [[self instance].userDocuments objectForKey:key];
-}
-
-+ (NSDictionary *) getDocumentAtIndex: (NSUInteger) index {
- NSString * key = [[self instance].userDocuments keyAtIndex:index];
- return [[self instance].userDocuments objectForKey:key];
-}
-
-+ (UIImage *) getThumbnailForId: (NSString *) documentId {
-
- NSDictionary * document = [self getDocumentById:documentId];
-
- NSString * thumbnailName = [NSString stringWithFormat:@"thumbnail_%@", [document objectForKey:@"plantImage"] ];
- UIImage * image = [UIImage imageNamed:thumbnailName];
- return image;
-
-}
-
-+ (UIImage *) getImageForId: (NSString *) documentId {
-
- NSDictionary * document = [self getDocumentById:documentId];
-
- NSString * imageName = [document objectForKey:@"plantImage"];
- UIImage * image = [UIImage imageNamed:imageName];
- return image;
-
-}
-
-
-
-- (id) init {
- NSString * fullPath = [[NSBundle mainBundle] pathForResource:@"testdataplist" ofType:@"plist"];
- NSDictionary * plist;
- plist = [NSDictionary dictionaryWithContentsOfFile:fullPath];
- self.userDocuments = [OrderedDictionary dictionaryWithDictionary:[plist objectForKey:@"Documents"]];
- return self;
-}
-
-
-@end
@@ -10,11 +10,11 @@
#include <stdlib.h>
#import "WOverlay.h"
#import "WOverlayView.h"
-#import "MapDataModel.h"
-#import "RhusMapAnnotation.h"
-#import "RhusDocument.h"
+#import "RHDataModel.h"
+#import "RHMapAnnotation.h"
+#import "RHDocument.h"
#import "RHSettings.h"
-#import "DeviceUser.h"
+#import "RHDeviceUser.h"
//Map Settings
#define mapInsetOriginX 10
@@ -157,7 +157,7 @@ - (void) placeInGalleryMode{
- (void) setupGalleryScrollView{
- for(RhusDocument * document in activeDocuments){
+ for(RHDocument * document in activeDocuments){
UIButton * thumbnailButton = [UIButton buttonWithType:UIButtonTypeCustom];
int index = [activeDocuments indexOfObject:document];
@@ -220,7 +220,7 @@ - (void) addAnnotations {
//Once we switch to liveQuery this will be changed
//TODO: Change when switch to live query
for (int i =0; i < [mapView.annotations count]; i++) {
- if ([[mapView.annotations objectAtIndex:i] isKindOfClass:[RhusMapAnnotation class]]) {
+ if ([[mapView.annotations objectAtIndex:i] isKindOfClass:[RHMapAnnotation class]]) {
[mapView removeAnnotation:[mapView.annotations objectAtIndex:i]];
}
}
@@ -229,22 +229,22 @@ - (void) addAnnotations {
NSArray * documents;
if(self.userDataOnly){
- documents = [MapDataModel getDeviceUserGalleryDocumentsWithStartKey:nil andLimit:nil];
+ documents = [RHDataModel getDeviceUserGalleryDocumentsWithStartKey:nil andLimit:nil];
} else {
- documents = [MapDataModel getGalleryDocumentsWithStartKey:nil andLimit:nil];
+ documents = [RHDataModel getGalleryDocumentsWithStartKey:nil andLimit:nil];
}
self.galleryHeading2.text = [NSString stringWithFormat:@"%i Images", [documents count]];
- for( RhusDocument * document in documents){
+ for( RHDocument * document in documents){
CLLocationCoordinate2D coordinate;
coordinate.latitude = [ (NSString*) [document objectForKey:@"latitude"] floatValue];
coordinate.longitude = [ (NSString*) [document objectForKey:@"longitude"] floatValue];
if(coordinate.latitude == 0 && coordinate.longitude==0){
continue;
}
// NSLog(@"%f %f", coordinate.latitude, coordinate.longitude );
- RhusMapAnnotation * rhusMapAnnotation = (RhusMapAnnotation *) [RhusMapAnnotation
+ RHMapAnnotation * rhusMapAnnotation = (RHMapAnnotation *) [RHMapAnnotation
mapAnnotationWithCoordinate: coordinate
title: [document getDateString]
subtitle: [document getReporter]
@@ -353,7 +353,7 @@ -(void) transitionFromMapToTimeline {
-(void)centerMapAtCurrentDocument {
- RhusDocument * document = [activeDocuments objectAtIndex:currentDetailIndex];
+ RHDocument * document = [activeDocuments objectAtIndex:currentDetailIndex];
[self centerMapAtLatitude:[document getLatitude] andLongitude:[document getLongitude]];
}
@@ -455,7 +455,7 @@ - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnno
//http://stackoverflow.com/questions/8018841/customize-the-mkannotationview-callout
- RhusMapAnnotation * rhusMapAnnotation = (RhusMapAnnotation *) annotation;
+ RHMapAnnotation * rhusMapAnnotation = (RHMapAnnotation *) annotation;
//ask database for the image file..
NSString * rhusMapAnnotationIdentifier = @"rhusMapAnnotationIdentifier";
@@ -465,7 +465,7 @@ - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnno
}
NSString * documentDeviceUserIdentifier = [[activeDocuments objectAtIndex:rhusMapAnnotation.tag] objectForKey:@"deviceuser_identifier"];
- NSString * deviceUserIdentifier = [DeviceUser uniqueIdentifier];
+ NSString * deviceUserIdentifier = [RHDeviceUser uniqueIdentifier];
if([deviceUserIdentifier isEqualToString: documentDeviceUserIdentifier] ){
annotationView.image = [UIImage imageNamed:@"mapDeviceUserPoint"];
} else {
@@ -540,7 +540,7 @@ - (void)showDetailViewForIndex: (NSInteger) index{
//TODO: currently this reruns the layout every time you click a thumb/callout
for(int i=0; i<[activeDocuments count]; i++){
- RhusDocument * document = [activeDocuments objectAtIndex:i];
+ RHDocument * document = [activeDocuments objectAtIndex:i];
if([document objectForKey:@"medium"] == nil){
continue;
}
@@ -582,7 +582,7 @@ - (void)hideDetailView{
}
- (void)showInfoViewForIndex: (NSInteger) index{
- RhusDocument * document = [activeDocuments objectAtIndex:index];
+ RHDocument * document = [activeDocuments objectAtIndex:index];
CGRect frame = self.infoView.frame;
frame.origin.x = (480 - frame.size.width) / 2;
@@ -731,7 +731,7 @@ - (void) asyncLoadNextGalleryPage{
#pragma mark - UIScrollViewDelegate Functions
- (void) updateTimestampView {
- RhusDocument * document = [activeDocuments objectAtIndex:currentDetailIndex];
+ RHDocument * document = [activeDocuments objectAtIndex:currentDetailIndex];
self.detailDate.text = [document objectForKey:@"created_at"];
}
@@ -749,7 +749,7 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
//async load next gallery page of data!
currentGalleryPage = page;
- RhusDocument * document = [activeDocuments objectAtIndex:currentDetailIndex];
+ RHDocument * document = [activeDocuments objectAtIndex:currentDetailIndex];
[self centerMapAtLatitude:[document getLatitude] andLongitude:[document getLongitude]];
if(!launchInGalleryMode){
// self.heading2.text = [document objectForKey:
Oops, something went wrong.

0 comments on commit 1f321fd

Please sign in to comment.