Skip to content

Commit 0ad1159

Browse files
authored
Merge branch 'v3' into v3-exists-fn
2 parents a6566f3 + b395e26 commit 0ad1159

Some content is hidden

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

47 files changed

+1657
-989
lines changed

Diff for: README.md

+18
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).

Diff for: android/.idea/gradle.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: android/build.gradle

+8-8
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

Diff for: android/src/main/java/io/fullstack/firestack/FirestackMessagingService.java

+2-2
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);

Diff for: android/src/main/java/io/fullstack/firestack/FirestackModule.java

+12-18
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, Context context) {
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
}

Diff for: android/src/main/java/io/fullstack/firestack/FirestackPackage.java

+1-1
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));

Diff for: android/src/main/java/io/fullstack/firestack/Utils.java

+7-2
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)