Merge branch 'v2' of github.com:invertase/react-native-firebase into v2

This commit is contained in:
Elliot Hesp 2017-06-20 13:22:24 +01:00
commit 7e3042cc92
7 changed files with 113 additions and 90 deletions

View File

@ -42,19 +42,30 @@ The native SDKs also allow us to hook into device sdk's which are not possible w
| Firebase Features | v1 | [v2](https://github.com/invertase/react-native-firebase/pull/130) | Web SDK |
| ---------------------- | :---: | :---: | :---: |
| AdMob | ❌ | ✅ | ❌ |
| Analytics             | ✅ | ✅ | ❌ |
| Cloud Messaging | ✅ | ✅ | ❌ |
| Authentication | ✅ | ✅ | ✅ |
| Realtime Database | ✅ | ✅ | ✅ |
| - Offline Persistance | ✅ | ✅ | ❌ |
| Storage | ✅ | ✅ | ❌ |
| Performance Monitoring | ✅ | ✅ | ❌ |
| Crash Reporting | ✅ | ✅ | ❌ |
| Remote Config | ✅ | ✅ | ❌ |
| App Indexing           | ❌ | ❌ | ❌ |
| Authentication | ✅ | ✅ | ✅ |
| Cloud Messaging | ✅ | ✅ | ❌ |
| Crash Reporting | ✅ | ✅ | ❌ |
| Dynamic Links | ❌ | ❌ | ❌ |
| Invites | ❌ | ❌ | ❌ |
| AdMob | ❌ | ✅ | ❌ |
| Performance Monitoring | ✅ | ✅ | ❌ |
| Realtime Database | ✅ | ✅ | ✅ |
| - Offline Persistance | ✅ | ✅ | ❌ |
| Remote Config | ✅ | ✅ | ❌ |
| Storage | ✅ | ✅ | ❌ |
---
### Supported versions - Firebase / React Native
> The table below shows the minimum supported versions of the Firebase SDKs and React Native
| | v1 | [v2](https://github.com/invertase/react-native-firebase/pull/130)
| ---------------------- | :---: | :---: |
| React Native | 0.36.0+ | 0.40.0 + |
| Firebase Android SDK | 10.2.0+ | 11.0.0 + |
| Firebase iOS SDK | 3.15.0+ | 4.0.0 + |
---

View File

@ -32,17 +32,27 @@ The native SDKs also allow us to hook into device sdk's which are not possible w
| Firebase Features | v1 | [v2](https://github.com/invertase/react-native-firebase/pull/130) | Web SDK |
| ---------------------- | :---: | :---: | :---: |
| AdMob | ❌ | ✅ | ❌ |
| Analytics             | ✅ | ✅ | ❌ |
| Cloud Messaging | ✅ | ✅ | ❌ |
| Authentication | ✅ | ✅ | ✅ |
| Realtime Database | ✅ | ✅ | ✅ |
| - Offline Persistance | ✅ | ✅ | ❌ |
| Storage | ✅ | ✅ | ❌ |
| Performance Monitoring | ✅ | ✅ | ❌ |
| Crash Reporting | ✅ | ✅ | ❌ |
| Remote Config | ✅ | ✅ | ❌ |
| App Indexing           | ❌ | ❌ | ❌ |
| Authentication | ✅ | ✅ | ✅ |
| Cloud Messaging | ✅ | ✅ | ❌ |
| Crash Reporting | ✅ | ✅ | ❌ |
| Dynamic Links | ❌ | ❌ | ❌ |
| Invites | ❌ | ❌ | ❌ |
| AdMob | ❌ | ✅ | ❌ |
| Performance Monitoring | ✅ | ✅ | ❌ |
| Realtime Database | ✅ | ✅ | ✅ |
| - Offline Persistance | ✅ | ✅ | ❌ |
| Remote Config | ✅ | ✅ | ❌ |
| Storage | ✅ | ✅ | ❌ |
---
### Supported versions - Firebase / React Native
> The table below shows the minimum supported versions of the Firebase SDKs and React Native
| | v1 | [v2](https://github.com/invertase/react-native-firebase/pull/130)
| ---------------------- | :---: | :---: |
| React Native | 0.36.0+ | 0.40.0 + |
| Firebase Android SDK | 10.2.0+ | 11.0.0 + |
| Firebase iOS SDK | 3.15.0+ | 4.0.0 + |

View File

@ -77,18 +77,18 @@ dependencies {
compile(project(':react-native-firebase')) {
transitive = false
}
compile "com.google.firebase:firebase-core:10.2.6"
compile "com.google.firebase:firebase-core:11.0.0"
# RNFirebase optional dependencies
compile "com.google.firebase:firebase-ads:10.2.6"
compile "com.google.firebase:firebase-analytics:10.2.6"
compile "com.google.firebase:firebase-auth:10.2.6"
compile "com.google.firebase:firebase-config:10.2.6"
compile "com.google.firebase:firebase-crash:10.2.6"
compile "com.google.firebase:firebase-database:10.2.6"
compile "com.google.firebase:firebase-messaging:10.2.6"
compile "com.google.firebase:firebase-perf:10.2.6"
compile "com.google.firebase:firebase-storage:10.2.6"
compile "com.google.firebase:firebase-ads:11.0.0"
compile "com.google.firebase:firebase-analytics:11.0.0"
compile "com.google.firebase:firebase-auth:11.0.0"
compile "com.google.firebase:firebase-config:11.0.0"
compile "com.google.firebase:firebase-crash:11.0.0"
compile "com.google.firebase:firebase-database:11.0.0"
compile "com.google.firebase:firebase-messaging:11.0.0"
compile "com.google.firebase:firebase-perf:11.0.0"
compile "com.google.firebase:firebase-storage:11.0.0"
}
```
@ -175,6 +175,6 @@ In the same file, add the `firebase-perf` module to your dependencies:
```
dependencies {
...
compile "com.google.firebase:firebase-perf:10.2.6"
compile "com.google.firebase:firebase-perf:11.0.0"
}
```

View File

@ -12,9 +12,9 @@ and this to the `didFinishLaunchingWithOptions:(NSDictionary *)launchOptions` me
`[FIRApp configure];`
## 2) Link RNFirebase
## 2) Setup RNFirebase
Unfortunately, due to the fact that Firebase is much easier to setup using Cocoapods, `react-native link` is not recommended as it is not customisable enough for our needs and we have had numerous problems reported.
Unfortunately, due to the fact that Firebase is much easier to setup using Cocoapods, *we do not recommend* `react-native link` as it is not customisable enough for our needs and we have had numerous problems reported.
### 2.0) If you don't already have Cocoapods set up
Follow the instructions to install Cocoapods and create your Podfile [here](https://firebase.google.com/docs/ios/setup#add_the_sdk).

4
index.d.ts vendored
View File

@ -573,14 +573,14 @@ declare module "react-native-firebase" {
* On the event a devices FCM token is refreshed by Google,
* the new token is returned in a callback listener.
*/
onTokenRefresh(listener: (token: string) => any): void
onTokenRefresh(listener: (token: string) => any): () => any
/**
* On a new message,
* the payload object is passed to the listener callback.
* This method is only triggered when the app is running.
* Use getInitialNotification for notifications which cause the app to open.
*/
onMessage(listener: (message: any) => any): void
onMessage(listener: (message: any) => any): () => any
/**
* Create a local notification from the device itself.
*/

View File

@ -203,8 +203,8 @@ export default class Messaging extends Base {
* @param listener
* @returns {*}
*/
onMessage(listener: Function) {
return FirebaseMessagingEvt.addListener(
onMessage(listener: Function): () => any {
const rnListener = FirebaseMessagingEvt.addListener(
EVENT_TYPE.Notification,
async(event) => {
const data = {
@ -217,7 +217,8 @@ export default class Messaging extends Base {
data.finish();
}
}
).remove;
);
return () => rnListener.remove();
}
/**
@ -225,8 +226,9 @@ export default class Messaging extends Base {
* @param listener
* @returns {*}
*/
onTokenRefresh(listener: Function) {
return FirebaseMessagingEvt.addListener(EVENT_TYPE.RefreshToken, listener).remove;
onTokenRefresh(listener: Function): () => any {
const rnListener = FirebaseMessagingEvt.addListener(EVENT_TYPE.RefreshToken, listener);
return () => rnListener.remove();
}
/**

View File

@ -1,6 +1,6 @@
{
"name": "react-native-firebase",
"version": "1.1.0",
"version": "1.1.1",
"author": "Invertase <contact@invertase.io> (http://invertase.io)",
"description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Auth, Database, Messaging, Remote Config, Storage, Admob, Analytics, Crash Reporting, and Performance.",
"main": "index",