diff --git a/GeoFire.podspec b/GeoFire.podspec index 2467727..c205401 100644 --- a/GeoFire.podspec +++ b/GeoFire.podspec @@ -9,9 +9,7 @@ Pod::Spec.new do |s| s.source_files = "GeoFire/**/*.{h,m}" s.docset_url = "https://geofire-ios.firebaseapp.com/docs/" s.ios.deployment_target = '7.0' - s.osx.deployment_target = '10.10' - s.ios.dependency 'Firebase', '~> 2.2' - s.osx.dependency 'FirebaseOSX', '~> 2.4' + s.ios.dependency 'Firebase', '~> 3.2' s.framework = 'CoreLocation' s.requires_arc = true end diff --git a/GeoFire.xcodeproj/project.pbxproj b/GeoFire.xcodeproj/project.pbxproj index 7a04f5f..13148ef 100644 --- a/GeoFire.xcodeproj/project.pbxproj +++ b/GeoFire.xcodeproj/project.pbxproj @@ -22,19 +22,17 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 38FC6CB01CFBE57C002AB722 /* GeoFireTest.m in Sources */ = {isa = PBXBuildFile; fileRef = FB8C8845196D55630061AC0F /* GeoFireTest.m */; }; + 38FC6CB71CFBF907002AB722 /* GFQueryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = FB8C884B196D93E10061AC0F /* GFQueryTest.m */; }; FB3B32BF196FF07000E47633 /* GFCircleQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = FB3B32BD196FF07000E47633 /* GFCircleQuery.h */; settings = {ATTRIBUTES = (Public, ); }; }; FB3B32C4197001C500E47633 /* GFRegionQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = FB3B32C1196FF27600E47633 /* GFRegionQuery.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FB8C8830196D51040061AC0F /* Firebase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB8C882F196D51040061AC0F /* Firebase.framework */; }; - FB8C8831196D51040061AC0F /* Firebase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB8C882F196D51040061AC0F /* Firebase.framework */; }; FB8C8832196D52200061AC0F /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FBA358E91965659A00A86282 /* CoreLocation.framework */; }; FB8C8834196D522F0061AC0F /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FB8C8833196D522F0061AC0F /* libicucore.dylib */; }; FB8C8836196D52460061AC0F /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FB8C8835196D52460061AC0F /* libc++.dylib */; }; FB8C8838196D52500061AC0F /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB8C8837196D52500061AC0F /* CFNetwork.framework */; }; FB8C883A196D52550061AC0F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB8C8839196D52550061AC0F /* Security.framework */; }; FB8C883C196D525E0061AC0F /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB8C883B196D525E0061AC0F /* SystemConfiguration.framework */; }; - FB8C8846196D55630061AC0F /* GeoFireTest.m in Sources */ = {isa = PBXBuildFile; fileRef = FB8C8845196D55630061AC0F /* GeoFireTest.m */; }; FB8C8849196D561D0061AC0F /* TestHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = FB8C8848196D561D0061AC0F /* TestHelpers.m */; }; - FB8C884C196D93E10061AC0F /* GFQueryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = FB8C884B196D93E10061AC0F /* GFQueryTest.m */; }; FB8C884F196D96180061AC0F /* GFRealDataTest.m in Sources */ = {isa = PBXBuildFile; fileRef = FB8C884E196D96180061AC0F /* GFRealDataTest.m */; }; FBA358C019655FED00A86282 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FBA358BF19655FED00A86282 /* Foundation.framework */; }; FBA358C519655FED00A86282 /* GeoFire.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = FBA358C419655FED00A86282 /* GeoFire.h */; }; @@ -92,7 +90,6 @@ /* Begin PBXFileReference section */ FB3B32BD196FF07000E47633 /* GFCircleQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GFCircleQuery.h; sourceTree = ""; }; FB3B32C1196FF27600E47633 /* GFRegionQuery.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GFRegionQuery.h; sourceTree = ""; }; - FB8C882F196D51040061AC0F /* Firebase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Firebase.framework; path = sdk/Firebase.framework; sourceTree = ""; }; FB8C8833196D522F0061AC0F /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; }; FB8C8835196D52460061AC0F /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "usr/lib/libc++.dylib"; sourceTree = SDKROOT; }; FB8C8837196D52500061AC0F /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; @@ -112,7 +109,6 @@ FBA358CC19655FED00A86282 /* GeoFireTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GeoFireTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; FBA358CD19655FED00A86282 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; FBA358D019655FED00A86282 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; - FBA358D719655FED00A86282 /* GeoFireTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GeoFireTests-Info.plist"; sourceTree = ""; }; FBA358D919655FED00A86282 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; FBA358E91965659A00A86282 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; FBA358EB1965683400A86282 /* GFQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GFQuery.h; sourceTree = ""; }; @@ -135,7 +131,6 @@ buildActionMask = 2147483647; files = ( FBA358EA1965659A00A86282 /* CoreLocation.framework in Frameworks */, - FB8C8830196D51040061AC0F /* Firebase.framework in Frameworks */, FBA358C019655FED00A86282 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -150,7 +145,6 @@ FB8C8836196D52460061AC0F /* libc++.dylib in Frameworks */, FB8C8834196D522F0061AC0F /* libicucore.dylib in Frameworks */, FB8C8832196D52200061AC0F /* CoreLocation.framework in Frameworks */, - FB8C8831196D51040061AC0F /* Firebase.framework in Frameworks */, FBA358CE19655FED00A86282 /* XCTest.framework in Frameworks */, FBA358D119655FED00A86282 /* UIKit.framework in Frameworks */, FBA358CF19655FED00A86282 /* Foundation.framework in Frameworks */, @@ -216,7 +210,6 @@ FB8C8837196D52500061AC0F /* CFNetwork.framework */, FB8C8835196D52460061AC0F /* libc++.dylib */, FB8C8833196D522F0061AC0F /* libicucore.dylib */, - FB8C882F196D51040061AC0F /* Firebase.framework */, FBA358E91965659A00A86282 /* CoreLocation.framework */, FBA358BF19655FED00A86282 /* Foundation.framework */, FBA358CD19655FED00A86282 /* XCTest.framework */, @@ -262,7 +255,6 @@ FBA358D619655FED00A86282 /* Supporting Files */ = { isa = PBXGroup; children = ( - FBA358D719655FED00A86282 /* GeoFireTests-Info.plist */, FBA358D819655FED00A86282 /* InfoPlist.strings */, ); name = "Supporting Files"; @@ -417,11 +409,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - FB8C884C196D93E10061AC0F /* GFQueryTest.m in Sources */, FBA358F51965797C00A86282 /* GFGeoHashTest.m in Sources */, FB8C884F196D96180061AC0F /* GFRealDataTest.m in Sources */, - FB8C8846196D55630061AC0F /* GeoFireTest.m in Sources */, FBA3591C196AAB6500A86282 /* GFGeoHashQueryTest.m in Sources */, + 38FC6CB71CFBF907002AB722 /* GFQueryTest.m in Sources */, + 38FC6CB01CFBE57C002AB722 /* GeoFireTest.m in Sources */, FB8C8849196D561D0061AC0F /* TestHelpers.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -548,6 +540,7 @@ "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", "$(PROJECT_DIR)/sdk", + "$(PROJECT_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "GeoFire/GeoFire-Prefix.pch"; @@ -572,6 +565,7 @@ "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", "$(PROJECT_DIR)/sdk", + "$(PROJECT_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "GeoFire/GeoFire-Prefix.pch"; diff --git a/GeoFire/API/GeoFire.h b/GeoFire/API/GeoFire.h index d929d18..d9fc4e2 100644 --- a/GeoFire/API/GeoFire.h +++ b/GeoFire/API/GeoFire.h @@ -34,7 +34,7 @@ #import "GFCircleQuery.h" #import "GFRegionQuery.h" -@class Firebase; +@class FIRDatabaseReference; typedef void (^GFCompletionBlock) (NSError *error); typedef void (^GFCallbackBlock) (CLLocation *location, NSError *error); @@ -47,7 +47,7 @@ typedef void (^GFCallbackBlock) (CLLocation *location, NSError *error); /** * The Firebase reference this GeoFire instance uses. */ -@property (nonatomic, strong, readonly) Firebase *firebaseRef; +@property (nonatomic, strong, readonly) FIRDatabaseReference *firebaseRef; /** * The dispatch queue this GeoFire object and all its GFQueries use for callbacks. @@ -61,7 +61,7 @@ typedef void (^GFCallbackBlock) (CLLocation *location, NSError *error); * @param firebase The Firebase location to attach this GeoFire instance to * @return The new GeoFire instance */ -- (id)initWithFirebaseRef:(Firebase *)firebase; +- (id)initWithFirebaseRef:(FIRDatabaseReference *)firebase; /** @name Setting and Updating Locations */ diff --git a/GeoFire/Implementation/GFQuery.m b/GeoFire/Implementation/GFQuery.m index 540c718..f5f6e1e 100644 --- a/GeoFire/Implementation/GFQuery.m +++ b/GeoFire/Implementation/GFQuery.m @@ -13,7 +13,7 @@ #import "GeoFire.h" #import "GeoFire+Private.h" #import "GFGeoHashQuery.h" -#import +@import Firebase; @interface GFQueryLocationInfo : NSObject @@ -195,7 +195,7 @@ - (id)initWithGeoFire:(GeoFire *)geoFire return self; } -- (FQuery *)firebaseForGeoHashQuery:(GFGeoHashQuery *)query +- (FIRDatabaseQuery *)firebaseForGeoHashQuery:(GFGeoHashQuery *)query { return [[[self.geoFire.firebaseRef queryOrderedByChild:@"g"] queryStartingAtValue:query.startValue] queryEndingAtValue:query.endValue]; @@ -257,7 +257,7 @@ - (BOOL)queriesContainGeoHash:(GFGeoHash *)geoHash return NO; } -- (void)childAdded:(FDataSnapshot *)snapshot +- (void)childAdded:(FIRDataSnapshot *)snapshot { @synchronized(self) { CLLocation *location = [GeoFire locationFromValue:snapshot.value]; @@ -269,7 +269,7 @@ - (void)childAdded:(FDataSnapshot *)snapshot } } -- (void)childChanged:(FDataSnapshot *)snapshot +- (void)childChanged:(FIRDataSnapshot *)snapshot { @synchronized(self) { CLLocation *location = [GeoFire locationFromValue:snapshot.value]; @@ -281,13 +281,13 @@ - (void)childChanged:(FDataSnapshot *)snapshot } } -- (void)childRemoved:(FDataSnapshot *)snapshot +- (void)childRemoved:(FIRDataSnapshot *)snapshot { @synchronized(self) { NSString *key = snapshot.key; GFQueryLocationInfo *info = self.locationInfos[snapshot.key]; if (info != nil) { - [[self.geoFire firebaseRefForLocationKey:snapshot.key] observeSingleEventOfType:FEventTypeValue withBlock:^(FDataSnapshot *snapshot) { + [[self.geoFire firebaseRefForLocationKey:snapshot.key] observeSingleEventOfType:FIRDataEventTypeValue withBlock:^(FIRDataSnapshot *snapshot) { @synchronized(self) { CLLocation *location = [GeoFire locationFromValue:snapshot.value]; GFGeoHash *geoHash = (location) ? [[GFGeoHash alloc] initWithLocation:location.coordinate] : nil; @@ -356,7 +356,7 @@ - (void)updateQueries [NSException raise:NSInternalInconsistencyException format:@"Wanted to remove a geohash query that was not registered!"]; } - FQuery *queryFirebase = [self firebaseForGeoHashQuery:query]; + FIRDatabaseQuery *queryFirebase = [self firebaseForGeoHashQuery:query]; [queryFirebase removeObserverWithHandle:handle.childAddedHandle]; [queryFirebase removeObserverWithHandle:handle.childChangedHandle]; [queryFirebase removeObserverWithHandle:handle.childRemovedHandle]; @@ -366,21 +366,21 @@ - (void)updateQueries [toAdd enumerateObjectsUsingBlock:^(GFGeoHashQuery *query, BOOL *stop) { [self.outstandingQueries addObject:query]; GFGeoHashQueryHandle *handle = [[GFGeoHashQueryHandle alloc] init]; - FQuery *queryFirebase = [self firebaseForGeoHashQuery:query]; - handle.childAddedHandle = [queryFirebase observeEventType:FEventTypeChildAdded - withBlock:^(FDataSnapshot *snapshot) { + FIRDatabaseQuery *queryFirebase = [self firebaseForGeoHashQuery:query]; + handle.childAddedHandle = [queryFirebase observeEventType:FIRDataEventTypeChildAdded + withBlock:^(FIRDataSnapshot *snapshot) { [self childAdded:snapshot]; }]; - handle.childChangedHandle = [queryFirebase observeEventType:FEventTypeChildChanged - withBlock:^(FDataSnapshot *snapshot) { + handle.childChangedHandle = [queryFirebase observeEventType:FIRDataEventTypeChildChanged + withBlock:^(FIRDataSnapshot *snapshot) { [self childChanged:snapshot]; }]; - handle.childRemovedHandle = [queryFirebase observeEventType:FEventTypeChildRemoved - withBlock:^(FDataSnapshot *snapshot) { + handle.childRemovedHandle = [queryFirebase observeEventType:FIRDataEventTypeChildRemoved + withBlock:^(FIRDataSnapshot *snapshot) { [self childRemoved:snapshot]; }]; - [queryFirebase observeSingleEventOfType:FEventTypeValue - withBlock:^(FDataSnapshot *snapshot) { + [queryFirebase observeSingleEventOfType:FIRDataEventTypeValue + withBlock:^(FIRDataSnapshot *snapshot) { @synchronized(self) { [self.outstandingQueries removeObject:query]; [self checkAndFireReadyEvent]; @@ -411,7 +411,7 @@ - (void)reset [NSException raise:NSInternalInconsistencyException format:@"Wanted to remove a geohash query that was not registered!"]; } - FQuery *queryFirebase = [self firebaseForGeoHashQuery:query]; + FIRDatabaseQuery *queryFirebase = [self firebaseForGeoHashQuery:query]; [queryFirebase removeObserverWithHandle:handle.childAddedHandle]; [queryFirebase removeObserverWithHandle:handle.childChangedHandle]; [queryFirebase removeObserverWithHandle:handle.childRemovedHandle]; diff --git a/GeoFire/Implementation/GeoFire+Private.h b/GeoFire/Implementation/GeoFire+Private.h index 8bec8d2..94da85b 100644 --- a/GeoFire/Implementation/GeoFire+Private.h +++ b/GeoFire/Implementation/GeoFire+Private.h @@ -11,7 +11,7 @@ @interface GeoFire (Private) -- (Firebase *)firebaseRefForLocationKey:(NSString *)key; +- (FIRDatabaseReference *)firebaseRefForLocationKey:(NSString *)key; + (CLLocation *)locationFromValue:(id)dict; + (NSDictionary *)dictFromLocation:(CLLocation *)location; diff --git a/GeoFire/Implementation/GeoFire.m b/GeoFire/Implementation/GeoFire.m index 8fe5599..44d7d37 100644 --- a/GeoFire/Implementation/GeoFire.m +++ b/GeoFire/Implementation/GeoFire.m @@ -10,7 +10,7 @@ #import "GeoFire+Private.h" #import "GFGeoHash.h" #import "GFQuery+Private.h" -#import +@import Firebase; NSString * const kGeoFireErrorDomain = @"com.firebase.geofire"; @@ -20,7 +20,7 @@ @interface GeoFire () -@property (nonatomic, strong, readwrite) Firebase *firebaseRef; +@property (nonatomic, strong, readwrite) FIRDatabaseReference *firebaseRef; @end @@ -34,7 +34,7 @@ - (id)init return nil; } -- (id)initWithFirebaseRef:(Firebase *)firebaseRef +- (id)initWithFirebaseRef:(FIRDatabaseReference *)firebaseRef { self = [super init]; if (self != nil) { @@ -66,7 +66,7 @@ - (void)setLocation:(CLLocation *)location withBlock:block]; } -- (Firebase *)firebaseRefForLocationKey:(NSString *)key +- (FIRDatabaseReference *)firebaseRefForLocationKey:(NSString *)key { static NSCharacterSet *illegalCharacters; static dispatch_once_t onceToken; @@ -77,7 +77,7 @@ - (Firebase *)firebaseRefForLocationKey:(NSString *)key [NSException raise:NSInvalidArgumentException format:@"Not a valid GeoFire key: \"%@\". Characters .#$][/ not allowed in key!", key]; } - return [self.firebaseRef childByAppendingPath:key]; + return [self.firebaseRef child:key]; } - (void)setLocationValue:(CLLocation *)location @@ -98,7 +98,7 @@ - (void)setLocationValue:(CLLocation *)location } [[self firebaseRefForLocationKey:key] setValue:value andPriority:priority - withCompletionBlock:^(NSError *error, Firebase *ref) { + withCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) { if (block != nil) { dispatch_async(self.callbackQueue, ^{ block(error); @@ -140,8 +140,8 @@ + (CLLocation *)locationFromValue:(id)value - (void)getLocationForKey:(NSString *)key withCallback:(GFCallbackBlock)callback { [[self firebaseRefForLocationKey:key] - observeSingleEventOfType:FEventTypeValue - withBlock:^(FDataSnapshot *snapshot) { + observeSingleEventOfType:FIRDataEventTypeValue + withBlock:^(FIRDataSnapshot *snapshot) { dispatch_async(self.callbackQueue, ^{ if (snapshot.value == nil || [snapshot.value isMemberOfClass:[NSNull class]]) { callback(nil, nil); diff --git a/GeoFireTests/GFRealDataTest.h b/GeoFireTests/GFRealDataTest.h index 96ec546..d2ab09f 100644 --- a/GeoFireTests/GFRealDataTest.h +++ b/GeoFireTests/GFRealDataTest.h @@ -9,7 +9,7 @@ #import #import "GeoFire.h" -#import +@import Firebase; #define TEST_TIMEOUT_SECONDS 10 @@ -51,6 +51,6 @@ do { \ @interface GFRealDataTest : XCTestCase @property (nonatomic, strong) GeoFire *geoFire; -@property (nonatomic, strong) Firebase *firebaseRef; +@property (nonatomic, strong) FIRDatabaseReference *firebaseRef; @end diff --git a/GeoFireTests/GFRealDataTest.m b/GeoFireTests/GFRealDataTest.m index 56123fa..2705eb9 100644 --- a/GeoFireTests/GFRealDataTest.m +++ b/GeoFireTests/GFRealDataTest.m @@ -10,6 +10,8 @@ #import "TestHelpers.h" +@import Firebase; + @implementation GFRealDataTest - (void)setUp @@ -17,9 +19,26 @@ - (void)setUp [super setUp]; NSString *randomFirebaseURL = [NSString stringWithFormat:@"https://%@.firebaseio-demo.com", [TestHelpers randomAlphaNumericStringWithLength:16]]; + + NSString *appname = [TestHelpers randomAlphaNumericStringWithLength:16]; + NSLog(@"Test url %@", randomFirebaseURL); + FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:@"googleAPI" + bundleID:@"com.test.app" + GCMSenderID:@"testid" + APIKey:nil + clientID:nil + trackingID:nil + androidClientID:nil + databaseURL:randomFirebaseURL + storageBucket:nil + deepLinkURLScheme:nil]; + + + [FIRApp configureWithName:appname options:options]; + dispatch_queue_t backgroundQueue = dispatch_queue_create("com.firebase.test", NULL); - [Firebase setDispatchQueue:backgroundQueue]; - self.firebaseRef = [[Firebase alloc] initWithUrl:randomFirebaseURL]; + [[FIRDatabase databaseForApp:[FIRApp appNamed:appname]] setCallbackQueue:backgroundQueue]; + self.firebaseRef = [[FIRDatabase databaseForApp:[FIRApp appNamed:appname]] reference]; self.geoFire = [[GeoFire alloc] initWithFirebaseRef:self.firebaseRef]; self.geoFire.callbackQueue = backgroundQueue; } @@ -28,9 +47,11 @@ - (void)tearDown { [super tearDown]; dispatch_semaphore_t wait = dispatch_semaphore_create(0); - [self.firebaseRef setValue:nil withCompletionBlock:^(NSError *error, Firebase *ref) { + + [self.firebaseRef setValue:nil withCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) { dispatch_semaphore_signal(wait); }]; + dispatch_semaphore_wait(wait, dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC)); } diff --git a/GeoFireTests/GeoFireTest.m b/GeoFireTests/GeoFireTest.m index 78f9623..33b4bf9 100644 --- a/GeoFireTests/GeoFireTest.m +++ b/GeoFireTests/GeoFireTest.m @@ -18,9 +18,11 @@ @implementation GeoFireTest #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-retain-cycles" + - (void)testGeoFireSetsLocations { - WAIT_SIGNALS(3, ^(dispatch_semaphore_t barrier) { + WAIT_SIGNALS(3, ^(dispatch_semaphore_t barrier) { + [self.geoFire setLocation:L(0, 0) forKey:@"loc1" withCompletionBlock:^(NSError *error) { @@ -42,18 +44,21 @@ - (void)testGeoFireSetsLocations }); WAIT_SIGNALS(1, (^(dispatch_semaphore_t barrier) { - [self.firebaseRef observeSingleEventOfType:FEventTypeValue withBlock:^(FDataSnapshot *snapshot) { + [self.firebaseRef observeSingleEventOfType:FIRDataEventTypeValue withBlock:^(FIRDataSnapshot *snapshot) { id expected = @{ @"loc1": @{ @"l": @[@0, @0], @"g": @"7zzzzzzzzz" }, @"loc2": @{ @"l": @[@50, @50], @"g": @"v0gs3y0zh7" }, @"loc3": @{ @"l": @[@-90, @-90], @"g": @"1bpbpbpbpb" } }; + XCTAssertEqualObjects(snapshot.value, expected); XCTAssertEqualObjects([snapshot childSnapshotForPath:@"loc1"].priority, @"7zzzzzzzzz"); XCTAssertEqualObjects([snapshot childSnapshotForPath:@"loc2"].priority, @"v0gs3y0zh7"); XCTAssertEqualObjects([snapshot childSnapshotForPath:@"loc3"].priority, @"1bpbpbpbpb"); dispatch_semaphore_signal(barrier); }]; + + })); } @@ -107,14 +112,14 @@ - (void)testGeoFireGetLocation - (void)testErrorOnInvalidData { NSMutableArray *actual = [NSMutableArray array]; - Firebase *firebase1 = [self.geoFire.firebaseRef childByAppendingPath:@"loc1"]; - Firebase *firebase2 = [self.geoFire.firebaseRef childByAppendingPath:@"loc2"]; + FIRDatabaseReference *firebase1 = [self.geoFire.firebaseRef child:@"loc1"]; + FIRDatabaseReference *firebase2 = [self.geoFire.firebaseRef child:@"loc2"]; WAIT_SIGNALS(2, (^(dispatch_semaphore_t barrier) { - [firebase1 setValue:@"NaN" withCompletionBlock:^(NSError *error, Firebase *ref) { + [firebase1 setValue:@"NaN" withCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) { XCTAssertNil(error); dispatch_semaphore_signal(barrier); }]; - [firebase2 setValue:@{ @"l": @10, @"g": @"abc" } withCompletionBlock:^(NSError *error, Firebase *ref) { + [firebase2 setValue:@{ @"l": @10, @"g": @"abc" } withCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) { XCTAssertNil(error); dispatch_semaphore_signal(barrier); }];