Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5cc3a6f

Browse files
committed
Updated with #226
2 parents 087c9ca + 4886136 commit 5cc3a6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1695
-1047
lines changed

‎Firestack.podspec

Lines changed: 24 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,28 @@
11
require 'json'
2-
package = JSON.parse(File.read('package.json'))
3-
version = package["version"]
4-
repo = package['repository']
5-
author = package['author']
62

7-
all_pods = [
8-
'FirebaseAnalytics', 'FirebaseAuth', 'FirebaseRemoteConfig',
9-
'FirebaseDatabase', 'FirebaseStorage', 'FirebaseInstanceID',
10-
'GoogleInterchangeUtilities', 'GoogleIPhoneUtilities',
11-
'GoogleNetworkingUtilities', 'GoogleParsingUtilities',
12-
'GoogleSymbolUtilities'
13-
]
3+
package = JSON.parse(File.read('package.json'))
144

155
Pod::Spec.new do |s|
16-
17-
s.name = "Firestack"
18-
s.version = version
19-
s.summary = "Firestack makes working with Firebase v3 easy"
20-
21-
s.description = <<-DESC
22-
Wanna integrate firebase into your app using React Native?
23-
DESC
24-
25-
s.homepage = "http://fullstackreact.com"
26-
27-
s.license = { :type => "MIT", :file => "LICENSE" }
28-
s.author = { "Ari Lerner" => author }
29-
s.social_media_url = 'http://twitter.com/fullstackio'
30-
31-
# When using multiple platforms
32-
s.ios.deployment_target = "8.0"
33-
# s.osx.deployment_target = "10.7"
34-
# s.watchos.deployment_target = "2.0"
35-
# s.tvos.deployment_target = "9.0"
36-
37-
s.source = { :git => repo['url'], :tag => "v#{version}" }
38-
s.public_header_files = "ios/Firestack/*.h"
39-
40-
s.source_files = 'ios/Firestack/*.{h,m}'
41-
s.preserve_paths = 'README.md', 'package.json', '*.js'
42-
43-
s.ios.frameworks = [
44-
'CFNetwork', 'Security', 'SystemConfiguration'
45-
]
46-
s.ios.libraries = ['icucore', 'c++', 'sqlite3', 'z']
47-
48-
s.xcconfig = {
49-
'HEADER_SEARCH_PATHS' => [
50-
"$(inherited)",
51-
"${SRCROOT}/../../React/**",
52-
"${SRCROOT}/../../node_modules/react-native/**"
53-
].join(' '),
54-
'FRAMEWORK_SEARCH_PATHS' => [
55-
"$(inherited)",
56-
"${PODS_ROOT}/Firebase/**",
57-
"${PODS_ROOT}/FirebaseStorage/**",
58-
].join(' '),
59-
'OTHER_LDFLAGS' => '$(inherited) -ObjC'
60-
}
61-
end
6+
s.name = "Firestack"
7+
s.version = package["version"]
8+
s.summary = package["description"]
9+
s.description = <<-DESC
10+
Wanna integrate firebase into your app using React Native?
11+
DESC
12+
s.homepage = "http://fullstackreact.com"
13+
s.license = package['license']
14+
s.author = "Ari Lerner"
15+
s.source = { :git => "https://github.com/fullstackreact/react-native-firestack.git", :tag => "v#{s.version}" }
16+
s.social_media_url = 'http://twitter.com/fullstackio'
17+
s.platform = :ios, "8.0"
18+
s.header_dir = 'ios/Firestack'
19+
s.preserve_paths = 'README.md', 'package.json', '*.js'
20+
s.source_files = 'ios/Firestack/*.{h,m}'
21+
s.dependency 'React'
22+
s.dependency 'Firebase/Auth'
23+
s.dependency 'Firebase/Core'
24+
s.dependency 'Firebase/Database'
25+
s.dependency 'Firebase/Messaging'
26+
s.dependency 'Firebase/RemoteConfig'
27+
s.dependency 'Firebase/Storage'
28+
end

‎README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,24 @@ We have a working application example available in at [fullstackreact/FirestackA
4444
* [Events](docs/api/events.md)
4545
* [Redux](docs/redux.md)
4646

47+
## Feature overview
48+
Feature | Firestack | Firebase
49+
------------ | ------------- | -------------
50+
Real time database | -- | YES
51+
Authentication | -- | YES
52+
Cloud messaging | -- | YES
53+
Storage | -- | YES
54+
Crash reporting | -- | YES
55+
Notifications | -- | YES
56+
Remote config | -- | YES
57+
Dynamic links | -- | YES
58+
AdMob | -- | YES
59+
Analytics | -- | YES
60+
App indexing | -- | YES
61+
Hosting | -- | YES
62+
AdWords | -- | YES
63+
Invites | -- | YES
64+
4765
## Contributing
4866

4967
For a detailed discussion of how Firestack works as well as how to contribute, check out our [contribution guide](https://github.com/fullstackreact/react-native-firestack/blob/master/Contributing.md).

‎android/.idea/gradle.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎android/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ allprojects {
4444

4545
dependencies {
4646
compile 'com.facebook.react:react-native:0.20.+'
47-
compile 'com.google.android.gms:play-services-base:9.8.0'
48-
compile 'com.google.firebase:firebase-core:9.8.0'
49-
compile 'com.google.firebase:firebase-config:9.8.0'
50-
compile 'com.google.firebase:firebase-auth:9.8.0'
51-
compile 'com.google.firebase:firebase-analytics:9.8.0'
52-
compile 'com.google.firebase:firebase-database:9.8.0'
53-
compile 'com.google.firebase:firebase-storage:9.8.0'
54-
compile 'com.google.firebase:firebase-messaging:9.8.0'
47+
compile 'com.google.android.gms:play-services-base:+'
48+
compile 'com.google.firebase:firebase-core:10.0.1'
49+
compile 'com.google.firebase:firebase-config:10.0.1'
50+
compile 'com.google.firebase:firebase-auth:10.0.1'
51+
compile 'com.google.firebase:firebase-analytics:10.0.1'
52+
compile 'com.google.firebase:firebase-database:10.0.1'
53+
compile 'com.google.firebase:firebase-storage:10.0.1'
54+
compile 'com.google.firebase:firebase-messaging:10.0.1'
5555
}
5656

‎android/src/main/java/io/fullstack/firestack/FirestackMessagingService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ public void onMessageReceived(RemoteMessage remoteMessage) {
1818
Log.d(TAG, "Remote message received");
1919
// debug
2020
Log.d(TAG, "From: " + remoteMessage.getFrom());
21+
2122
if (remoteMessage.getData().size() > 0) {
2223
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
2324
}
25+
2426
if (remoteMessage.getNotification() != null) {
2527
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
2628
}
27-
if (remoteMessage.getNotification() != null) {
2829

29-
}
3030
Intent i = new Intent(FirestackMessaging.INTENT_NAME_NOTIFICATION);
3131
i.putExtra("data", remoteMessage);
3232
sendOrderedBroadcast(i, null);

‎android/src/main/java/io/fullstack/firestack/FirestackModule.java

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
package io.fullstack.firestack;
22

3-
import java.util.Date;
4-
import java.util.HashMap;
53
import java.util.Map;
4+
import java.util.HashMap;
65

76
import android.util.Log;
87
import android.content.Context;
98
import android.support.annotation.Nullable;
109

10+
import com.facebook.react.bridge.Callback;
1111
import com.facebook.react.bridge.Arguments;
12+
import com.facebook.react.bridge.ReadableMap;
13+
import com.facebook.react.bridge.WritableMap;
14+
import com.facebook.react.bridge.ReactMethod;
1215
import com.facebook.react.bridge.LifecycleEventListener;
1316
import com.facebook.react.bridge.ReactApplicationContext;
1417
import com.facebook.react.bridge.ReactContextBaseJavaModule;
15-
import com.facebook.react.bridge.ReactMethod;
16-
import com.facebook.react.bridge.Callback;
17-
import com.facebook.react.bridge.WritableMap;
18-
import com.facebook.react.bridge.ReadableMap;
19-
import com.facebook.react.bridge.ReactContext;
2018

2119
import com.google.android.gms.common.ConnectionResult;
2220
import com.google.android.gms.common.GoogleApiAvailability;
@@ -32,16 +30,10 @@ interface KeySetterFn {
3230
@SuppressWarnings("WeakerAccess")
3331
public class FirestackModule extends ReactContextBaseJavaModule implements LifecycleEventListener {
3432
private static final String TAG = "Firestack";
35-
private Context context;
36-
private ReactContext mReactContext;
3733
private FirebaseApp app;
3834

39-
public FirestackModule(ReactApplicationContext reactContext, Contextcontext) {
35+
public FirestackModule(ReactApplicationContext reactContext) {
4036
super(reactContext);
41-
this.context = context;
42-
mReactContext = reactContext;
43-
44-
Log.d(TAG, "New instance");
4537
}
4638

4739
@Override
@@ -69,7 +61,7 @@ public void configureWithOptions(final ReadableMap params, @Nullable final Callb
6961
Log.i(TAG, "configureWithOptions");
7062

7163
FirebaseOptions.Builder builder = new FirebaseOptions.Builder();
72-
FirebaseOptions defaultOptions = FirebaseOptions.fromResource(this.context);
64+
FirebaseOptions defaultOptions = FirebaseOptions.fromResource(getReactApplicationContext().getBaseContext());
7365

7466
if (defaultOptions == null) {
7567
defaultOptions = new FirebaseOptions.Builder().build();
@@ -154,7 +146,7 @@ public String setKeyOrDefault(
154146
try {
155147
Log.i(TAG, "Configuring app");
156148
if (app == null) {
157-
app = FirebaseApp.initializeApp(this.context, builder.build());
149+
app = FirebaseApp.initializeApp(getReactApplicationContext().getBaseContext(), builder.build());
158150
}
159151
Log.i(TAG, "Configured");
160152

@@ -189,14 +181,14 @@ public void serverValue(@Nullable final Callback onComplete) {
189181
public void onHostResume() {
190182
WritableMap params = Arguments.createMap();
191183
params.putBoolean("isForground", true);
192-
Utils.sendEvent(mReactContext, "FirestackAppState", params);
184+
Utils.sendEvent(getReactApplicationContext(), "FirestackAppState", params);
193185
}
194186

195187
@Override
196188
public void onHostPause() {
197189
WritableMap params = Arguments.createMap();
198190
params.putBoolean("isForground", false);
199-
Utils.sendEvent(mReactContext, "FirestackAppState", params);
191+
Utils.sendEvent(getReactApplicationContext(), "FirestackAppState", params);
200192
}
201193

202194
@Override
@@ -208,6 +200,8 @@ public void onHostDestroy() {
208200
public Map<String, Object> getConstants() {
209201
final Map<String, Object> constants = new HashMap<>();
210202
constants.put("googleApiAvailability", getPlayServicesStatus());
203+
204+
// TODO remove once this has been moved on ios
211205
constants.put("serverValueTimestamp", ServerValue.TIMESTAMP);
212206
return constants;
213207
}

‎android/src/main/java/io/fullstack/firestack/FirestackPackage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public FirestackPackage() {
3232
@Override
3333
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
3434
List<NativeModule> modules = new ArrayList<>();
35-
modules.add(new FirestackModule(reactContext, reactContext.getBaseContext()));
35+
modules.add(new FirestackModule(reactContext));
3636
modules.add(new FirestackAuth(reactContext));
3737
modules.add(new FirestackDatabase(reactContext));
3838
modules.add(new FirestackAnalytics(reactContext));

‎android/src/main/java/io/fullstack/firestack/Utils.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.facebook.react.bridge.ReadableMap;
1414
import com.facebook.react.bridge.ReactContext;
1515
import com.facebook.react.bridge.WritableArray;
16+
import com.facebook.react.bridge.WritableNativeArray;
1617
import com.facebook.react.modules.core.DeviceEventManagerModule;
1718

1819
import com.facebook.react.bridge.ReadableType;
@@ -82,8 +83,12 @@ public static WritableMap dataSnapshotToMap(
8283
data.putString("value", null);
8384
}
8485
} else {
85-
WritableMap valueMap = Utils.castSnapshotValue(dataSnapshot);
86-
data.putMap("value", valueMap);
86+
Object value = Utils.castSnapshotValue(dataSnapshot);
87+
if (value instanceof WritableNativeArray) {
88+
data.putArray("value", (WritableArray) value);
89+
} else {
90+
data.putMap("value", (WritableMap) value);
91+
}
8792
}
8893

8994
// Child keys

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /