Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #44 from TimKreger-IA/master
Browse files Browse the repository at this point in the history
Updated to Firebase 3.2.0

Note: still need to update setup.sh, xcodeproj, and podspec major version bump.
  • Loading branch information
asciimike committed Jun 9, 2016
2 parents f7b2398 + 0c0a758 commit a714c5a
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 55 deletions.
4 changes: 1 addition & 3 deletions GeoFire.podspec
Expand Up @@ -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
18 changes: 6 additions & 12 deletions GeoFire.xcodeproj/project.pbxproj
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -92,7 +90,6 @@
/* Begin PBXFileReference section */
FB3B32BD196FF07000E47633 /* GFCircleQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GFCircleQuery.h; sourceTree = "<group>"; };
FB3B32C1196FF27600E47633 /* GFRegionQuery.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GFRegionQuery.h; sourceTree = "<group>"; };
FB8C882F196D51040061AC0F /* Firebase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Firebase.framework; path = sdk/Firebase.framework; sourceTree = "<group>"; };
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; };
Expand All @@ -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 = "<group>"; };
FBA358D919655FED00A86282 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
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 = "<group>"; };
Expand All @@ -135,7 +131,6 @@
buildActionMask = 2147483647;
files = (
FBA358EA1965659A00A86282 /* CoreLocation.framework in Frameworks */,
FB8C8830196D51040061AC0F /* Firebase.framework in Frameworks */,
FBA358C019655FED00A86282 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -262,7 +255,6 @@
FBA358D619655FED00A86282 /* Supporting Files */ = {
isa = PBXGroup;
children = (
FBA358D719655FED00A86282 /* GeoFireTests-Info.plist */,
FBA358D819655FED00A86282 /* InfoPlist.strings */,
);
name = "Supporting Files";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand All @@ -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";
Expand Down
6 changes: 3 additions & 3 deletions GeoFire/API/GeoFire.h
Expand Up @@ -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);
Expand All @@ -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.
Expand All @@ -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 */

Expand Down
34 changes: 17 additions & 17 deletions GeoFire/Implementation/GFQuery.m
Expand Up @@ -13,7 +13,7 @@
#import "GeoFire.h"
#import "GeoFire+Private.h"
#import "GFGeoHashQuery.h"
#import <Firebase/Firebase.h>
@import Firebase;

@interface GFQueryLocationInfo : NSObject

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand All @@ -269,7 +269,7 @@ - (void)childAdded:(FDataSnapshot *)snapshot
}
}

- (void)childChanged:(FDataSnapshot *)snapshot
- (void)childChanged:(FIRDataSnapshot *)snapshot
{
@synchronized(self) {
CLLocation *location = [GeoFire locationFromValue:snapshot.value];
Expand All @@ -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;
Expand Down Expand Up @@ -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];
Expand All @@ -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];
Expand Down Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion GeoFire/Implementation/GeoFire+Private.h
Expand Up @@ -11,7 +11,7 @@

@interface GeoFire (Private)

- (Firebase *)firebaseRefForLocationKey:(NSString *)key;
- (FIRDatabaseReference *)firebaseRefForLocationKey:(NSString *)key;

+ (CLLocation *)locationFromValue:(id)dict;
+ (NSDictionary *)dictFromLocation:(CLLocation *)location;
Expand Down
16 changes: 8 additions & 8 deletions GeoFire/Implementation/GeoFire.m
Expand Up @@ -10,7 +10,7 @@
#import "GeoFire+Private.h"
#import "GFGeoHash.h"
#import "GFQuery+Private.h"
#import <Firebase/Firebase.h>
@import Firebase;

NSString * const kGeoFireErrorDomain = @"com.firebase.geofire";

Expand All @@ -20,7 +20,7 @@

@interface GeoFire ()

@property (nonatomic, strong, readwrite) Firebase *firebaseRef;
@property (nonatomic, strong, readwrite) FIRDatabaseReference *firebaseRef;

@end

Expand All @@ -34,7 +34,7 @@ - (id)init
return nil;
}

- (id)initWithFirebaseRef:(Firebase *)firebaseRef
- (id)initWithFirebaseRef:(FIRDatabaseReference *)firebaseRef
{
self = [super init];
if (self != nil) {
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions GeoFireTests/GFRealDataTest.h
Expand Up @@ -9,7 +9,7 @@
#import <XCTest/XCTest.h>

#import "GeoFire.h"
#import <Firebase/Firebase.h>
@import Firebase;

#define TEST_TIMEOUT_SECONDS 10

Expand Down Expand Up @@ -51,6 +51,6 @@ do { \
@interface GFRealDataTest : XCTestCase

@property (nonatomic, strong) GeoFire *geoFire;
@property (nonatomic, strong) Firebase *firebaseRef;
@property (nonatomic, strong) FIRDatabaseReference *firebaseRef;

@end

0 comments on commit a714c5a

Please sign in to comment.