Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions GeoFire/Implementation/GeoFire.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,16 @@ - (void)setLocationValue:(CLLocation *)location
withBlock:(GFCompletionBlock)block
{
NSDictionary *value;
NSString *priority;
if (location != nil) {
NSNumber *lat = [NSNumber numberWithDouble:location.coordinate.latitude];
NSNumber *lng = [NSNumber numberWithDouble:location.coordinate.longitude];
NSString *geoHash = [GFGeoHash newWithLocation:location.coordinate].geoHashValue;
value = @{ @"l": @[ lat, lng ], @"g": geoHash };
priority = geoHash;
} else {
value = nil;
priority = nil;
}
[[self firebaseRefForLocationKey:key] setValue:value
andPriority:priority
withCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) {
[[self firebaseRefForLocationKey:key] updateChildValues:value
withCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) {
if (block != nil) {
dispatch_async(self.callbackQueue, ^{
block(error);
Expand Down
3 changes: 0 additions & 3 deletions GeoFireTests/GeoFireTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ - (void)testGeoFireSetsLocations
};

XCTAssertEqualObjects(snapshot.value, expected);
XCTAssertEqualObjects([snapshot childSnapshotForPath:@"loc1"].priority, @"7zzzzzzzzz");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please instead test g rather than priority. We'd like to make sure everything still works :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it already tested on the previous line when comparing the whole value of the snapshot?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Derp, yes.

XCTAssertEqualObjects([snapshot childSnapshotForPath:@"loc2"].priority, @"v0gs3y0zh7");
XCTAssertEqualObjects([snapshot childSnapshotForPath:@"loc3"].priority, @"1bpbpbpbpb");
dispatch_semaphore_signal(barrier);
}];

Expand Down