Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add podspec and fix iOS database null pointer #268

Merged
merged 3 commits into from
Jan 30, 2017
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
81 changes: 24 additions & 57 deletions Firestack.podspec
Original file line number Diff line number Diff line change
@@ -1,61 +1,28 @@
require 'json'
package = JSON.parse(File.read('package.json'))
version = package["version"]
repo = package['repository']
author = package['author']

all_pods = [
'FirebaseAnalytics', 'FirebaseAuth', 'FirebaseRemoteConfig',
'FirebaseDatabase', 'FirebaseStorage', 'FirebaseInstanceID',
'GoogleInterchangeUtilities', 'GoogleIPhoneUtilities',
'GoogleNetworkingUtilities', 'GoogleParsingUtilities',
'GoogleSymbolUtilities'
]
package = JSON.parse(File.read('package.json'))

Pod::Spec.new do |s|

s.name = "Firestack"
s.version = version
s.summary = "Firestack makes working with Firebase v3 easy"

s.description = <<-DESC
Wanna integrate firebase into your app using React Native?
DESC

s.homepage = "http://fullstackreact.com"

s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Ari Lerner" => author }
s.social_media_url = 'http://twitter.com/fullstackio'

# When using multiple platforms
s.ios.deployment_target = "8.0"
# s.osx.deployment_target = "10.7"
# s.watchos.deployment_target = "2.0"
# s.tvos.deployment_target = "9.0"

s.source = { :git => repo['url'], :tag => "v#{version}" }
s.public_header_files = "ios/Firestack/*.h"

s.source_files = 'ios/Firestack/*.{h,m}'
s.preserve_paths = 'README.md', 'package.json', '*.js'

s.ios.frameworks = [
'CFNetwork', 'Security', 'SystemConfiguration'
]
s.ios.libraries = ['icucore', 'c++', 'sqlite3', 'z']

s.xcconfig = {
'HEADER_SEARCH_PATHS' => [
"$(inherited)",
"${SRCROOT}/../../React/**",
"${SRCROOT}/../../node_modules/react-native/**"
].join(' '),
'FRAMEWORK_SEARCH_PATHS' => [
"$(inherited)",
"${PODS_ROOT}/Firebase/**",
"${PODS_ROOT}/FirebaseStorage/**",
].join(' '),
'OTHER_LDFLAGS' => '$(inherited) -ObjC'
}
end
s.name = "Firestack"
s.version = package["version"]
s.summary = package["description"]
s.description = <<-DESC
Wanna integrate firebase into your app using React Native?
DESC
s.homepage = "http://fullstackreact.com"
s.license = package['license']
s.author = "Ari Lerner"
s.source = { :git => "https://github.com/fullstackreact/react-native-firestack.git", :tag => "v#{s.version}" }
s.social_media_url = 'http://twitter.com/fullstackio'
s.platform = :ios, "8.0"
s.header_dir = 'ios/Firestack'
s.preserve_paths = 'README.md', 'package.json', '*.js'
s.source_files = 'ios/Firestack/*.{h,m}'
s.dependency 'React'
s.dependency 'Firebase/Auth'
s.dependency 'Firebase/Core'
s.dependency 'Firebase/Database'
s.dependency 'Firebase/Messaging'
s.dependency 'Firebase/RemoteConfig'
s.dependency 'Firebase/Storage'
end
8 changes: 6 additions & 2 deletions ios/Firestack/FirestackDatabase.m
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,11 @@ - (id) init
callback:(RCTResponseSenderBlock) callback)
{
NSString *key = [self getDBListenerKey:path withModifiers:modifiersString];
NSArray *listenerKeys;
FirestackDBReference *ref = [_dbReferences objectForKey:key];
if (ref != nil) {
if (ref == nil) {
listenerKeys = @[];
} else {
if (eventName == nil || [eventName isEqualToString:@""]) {
[ref cleanup];
[_dbReferences removeObjectForKey:key];
Expand All @@ -604,12 +607,13 @@ - (id) init
[_dbReferences removeObjectForKey:key];
}
}
listenerKeys = [ref listenerKeys];
}
callback(@[[NSNull null], @{
@"result": @"success",
@"handle": path,
@"modifiersString": modifiersString,
@"remainingListeners": [ref listenerKeys],
@"remainingListeners": listenerKeys,
}]);
}

Expand Down