Skip to content

Commit

Permalink
#327: This code needs to removed in the future. Fix a problem with so…
Browse files Browse the repository at this point in the history
…me specific photos where the geo position was converted to NSDecimal instead of NSString
  • Loading branch information
patricksan committed Oct 18, 2013
1 parent 6c02e6e commit 69780fe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Photo/Synced+Methods.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#import "Synced+Methods.h"

@implementation Synced (Methods)
@implementation Synced (Methods)

//
// Constast for sync uploaded
Expand Down
24 changes: 20 additions & 4 deletions Photo/Timeline+Methods.m
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,30 @@ + (void) insertIntoCoreData:(NSArray *) rawNewestPhotos InManagedObjectContext:(
photo.permission = [NSNumber numberWithBool:NO];

// latitude
// TODO: API does not return the number in float sometimes,
// in this case the framework will convert the NSString to NSDecimal
// https://github.com/photo/frontend/issues/1402
NSString *latitude = [raw objectForKey:@"latitude"];
if ([latitude class] != [NSNull class] && ![latitude isEqualToString:@""])
photo.latitude = latitude;
if ([latitude class] != [NSNull class]){
if ( [latitude isKindOfClass: [NSString class]] && ![latitude isEqualToString:@""]) {
photo.latitude = latitude;
}else if ( [latitude isKindOfClass: [NSNumber class]] ) {

This comment has been minimized.

Copy link
@patricksan

patricksan Oct 18, 2013

Author Member

Remove this code in future

photo.latitude = [((NSNumber*)latitude) stringValue];
}
}

// longitude
// TODO: API does not return the number in float sometimes,
// in this case the framework will convert the NSString to NSDecimal
// https://github.com/photo/frontend/issues/1402
NSString *longitude = [raw objectForKey:@"longitude"];
if ([longitude class] != [NSNull class] && ![longitude isEqualToString:@""])
photo.longitude = longitude;
if ([longitude class] != [NSNull class]){
if ( [longitude isKindOfClass: [NSString class]] && ![longitude isEqualToString:@""]) {
photo.longitude = longitude;
}else if ( [longitude isKindOfClass: [NSNumber class]] ) {

This comment has been minimized.

Copy link
@patricksan

patricksan Oct 18, 2013

Author Member

Remove this code in future

photo.longitude = [((NSNumber*)longitude) stringValue];
}
}

// get the date since 1970
double dUpload = [[raw objectForKey:@"dateUploaded"] doubleValue];
Expand Down

0 comments on commit 69780fe

Please sign in to comment.