Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move ANDraftAnnotation into ANAnnotation.h

  • Loading branch information...
commit 060e16a697e8cf0e5d2b5a9a48dc9a928aac0808 1 parent 2a6808f
Brent Royal-Gordon authored
Showing with 58 additions and 66 deletions.
  1. +16 −0 ANAnnotation.h
  2. +42 −0 ANAnnotation.m
  3. +0 −21 ANDraft.h
  4. +0 −45 ANDraft.m
View
16 ANAnnotation.h
@@ -34,6 +34,15 @@ extern NSString * const ANAnnotationTypeGeolocation;
@end
+@interface ANDraftAnnotation : NSObject
+
+@property (strong) NSString * type;
+@property (strong) id value;
+
+@property (copy) NSDictionary * representation;
+
+@end
+
#import "ANDefines.h"
#if APPNETKIT_USE_CORE_LOCATION
@@ -44,4 +53,11 @@ extern NSString * const ANAnnotationTypeGeolocation;
@property (readonly) CLLocation * geolocationValue;
@end
+
+@interface ANDraftAnnotation (CLLocation)
+
++ (ANDraftAnnotation*)draftAnnotationWithGeolocationValue:(CLLocation*)location;
+
+@end
+
#endif
View
42 ANAnnotation.m
@@ -85,6 +85,22 @@ - (ANDraftAnnotation *)draftAnnotation {
@end
+@implementation ANDraftAnnotation
+
+- (NSDictionary *)representation {
+ return [NSDictionary dictionaryWithObjectsAndKeys:
+ self.type, @"type",
+ self.value, @"value",
+ nil];
+}
+
+- (void)setRepresentation:(NSDictionary *)dict {
+ self.type = [dict objectForKey:@"type"];
+ self.value = [dict objectForKey:@"value"];
+}
+
+@end
+
#if APPNETKIT_USE_CORE_LOCATION
@implementation ANAnnotation (CLLocation)
@@ -138,4 +154,30 @@ - (CLLocation *)geolocationValue {
}
@end
+
+@implementation ANDraftAnnotation (CLLocation)
+
++ (ANDraftAnnotation *)draftAnnotationWithGeolocationValue:(CLLocation *)location {
+ NSMutableDictionary * dict = [NSMutableDictionary new];
+ [dict setObject:[NSNumber numberWithDouble:location.coordinate.latitude] forKey:@"latitude"];
+ [dict setObject:[NSNumber numberWithDouble:location.coordinate.longitude] forKey:@"longitude"];
+
+ if(location.verticalAccuracy >= 0) {
+ [dict setObject:[NSNumber numberWithDouble:location.altitude] forKey:@"altitude"];
+ }
+ if(location.verticalAccuracy > 0) {
+ [dict setObject:[NSNumber numberWithDouble:location.verticalAccuracy] forKey:@"vertical_accuracy"];
+ }
+ if(location.horizontalAccuracy > 0) {
+ [dict setObject:[NSNumber numberWithDouble:location.horizontalAccuracy] forKey:@"horizontal_accuracy"];
+ }
+
+ ANDraftAnnotation * annotation = [ANDraftAnnotation new];
+ annotation.type = ANAnnotationTypeGeolocation;
+ annotation.value = dict.copy;
+ return annotation;
+}
+
+@end
+
#endif
View
21 ANDraft.h
@@ -22,24 +22,3 @@
- (void)createPostViaSession:(ANSession*)session completion:(ANPostRequestCompletion)completion;
@end
-
-@interface ANDraftAnnotation : NSObject
-
-@property (strong) NSString * type;
-@property (strong) id value;
-
-@property (copy) NSDictionary * representation;
-
-@end
-
-#import "ANDefines.h"
-#if APPNETKIT_USE_CORE_LOCATION
-#import <CoreLocation/CoreLocation.h>
-
-@interface ANDraftAnnotation (CLLocation)
-
-+ (ANDraftAnnotation*)draftAnnotationWithGeolocationValue:(CLLocation*)location;
-
-@end
-
-#endif
View
45 ANDraft.m
@@ -61,48 +61,3 @@ - (void)createPostViaSession:(ANSession*)session completion:(ANPostRequestComple
}
@end
-
-@implementation ANDraftAnnotation
-
-- (NSDictionary *)representation {
- return [NSDictionary dictionaryWithObjectsAndKeys:
- self.type, @"type",
- self.value, @"value",
- nil];
-}
-
-- (void)setRepresentation:(NSDictionary *)dict {
- self.type = [dict objectForKey:@"type"];
- self.value = [dict objectForKey:@"value"];
-}
-
-@end
-
-#if APPNETKIT_USE_CORE_LOCATION
-
-@implementation ANDraftAnnotation (CLLocation)
-
-+ (ANDraftAnnotation *)draftAnnotationWithGeolocationValue:(CLLocation *)location {
- NSMutableDictionary * dict = [NSMutableDictionary new];
- [dict setObject:[NSNumber numberWithDouble:location.coordinate.latitude] forKey:@"latitude"];
- [dict setObject:[NSNumber numberWithDouble:location.coordinate.longitude] forKey:@"longitude"];
-
- if(location.verticalAccuracy >= 0) {
- [dict setObject:[NSNumber numberWithDouble:location.altitude] forKey:@"altitude"];
- }
- if(location.verticalAccuracy > 0) {
- [dict setObject:[NSNumber numberWithDouble:location.verticalAccuracy] forKey:@"vertical_accuracy"];
- }
- if(location.horizontalAccuracy > 0) {
- [dict setObject:[NSNumber numberWithDouble:location.horizontalAccuracy] forKey:@"horizontal_accuracy"];
- }
-
- ANDraftAnnotation * annotation = [ANDraftAnnotation new];
- annotation.type = ANAnnotationTypeGeolocation;
- annotation.value = dict.copy;
- return annotation;
-}
-
-@end
-
-#endif
Please sign in to comment.
Something went wrong with that request. Please try again.