Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 9f60854

Browse files
committed
Merge remote-tracking branch 'refs/remotes/EddyVerbruggen/master'
2 parents 159a74a + e7a8746 commit 9f60854

18 files changed

+1303
-312
lines changed

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
platforms/android/libraryproject/
1+
platforms/android/libraryproject/
2+
docs

CHANGELOG.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<img src="docs/images/firebase-logo.png" width="116px" height="32px" alt="Firebase"/>
2+
3+
## 3.4.4 (2016, July 17)
4+
5+
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.4.3...3.4.4)
6+
7+
### SDK versions
8+
If version numbers changed clean your platform folders to avoid build errors.
9+
10+
- iOS: 3.3.x
11+
- Android: 9.2.0
12+
13+
### New
14+
- [#75](#75) [Nathan Walker](https://github.com/NathanWalker) added the ability to remove files from Firebase Storage, thanks Nathan!
15+
16+
17+
18+
## 3.4.3 (2016, July 16)
19+
20+
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.4.2...3.4.3)
21+
22+
### SDK versions
23+
If version numbers changed clean your platform folders to avoid build errors.
24+
25+
- iOS: 3.3.x
26+
- Android: 9.2.0
27+
28+
### New
29+
- [#74](#74) Facebook login for Android.
30+
31+
32+
33+
## 3.4.2 (2016, July 14)
34+
35+
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.4.0...3.4.2)
36+
37+
### SDK versions
38+
If version numbers changed clean your platform folders to avoid build errors.
39+
40+
- iOS: 3.3.x
41+
- Android: 9.2.0
42+
43+
### New
44+
- [#61](#61) Added `keepInSync` for enhanced offline support.
45+
- [#65](#65) Crash Reporting, which is automatically enabled for you.
46+
47+
### Fixes
48+
- [#68](#68) Fix an issue where you'd log in on Android before `application.start()`.
49+
- [#70](#70) Added a TypeScript definition for `getCurrentUser()`.
50+
- [#71](#71) Added a TypeScript definition for LoginResult.email.
51+
52+
53+
54+
## 3.4.0 (2016, July 7)
55+
56+
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.3.0...3.4.0)
57+
58+
### SDK versions
59+
If version numbers changed clean your platform folders to avoid build errors.
60+
61+
- iOS: 3.3.x
62+
- Android: 9.2.0
63+
64+
### New
65+
- [#43](#43) Storage ([docs](docs/STORAGE.md))
66+
- [#66](#66) Added `iOSSimulatorFlush` for a known iOS emulator issue with `invalid_token`
67+
68+
### Fixes
69+
- [#69](#69) Fix `onAuthStateChanged` feature on `init`
70+
71+
72+
## 3.3.0 (2016, June 26)
73+
74+
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.2.0...3.3.0)
75+
76+
### SDK versions
77+
If version numbers changed clean your platform folders to avoid build errors.
78+
79+
- iOS: 3.2.x
80+
- Android: 9.0.2
81+
82+
### New
83+
- [#54](#54) FCM Messaging / Push Notifications ([docs](docs/MESSAGING.md))
84+
85+
86+
## 3.2.0 (2016, June 19)
87+
88+
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.1.0...3.2.0)
89+
90+
### SDK versions
91+
If version numbers changed clean your platform folders to avoid build errors.
92+
93+
- iOS: 3.2.0
94+
- Android: 9.0.2
95+
96+
### New
97+
- [#56](#56) Remote Config ([docs](docs/REMOTECONFIG.md))
98+
99+
100+
## 3.1.0 (2016, June 17)
101+
102+
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.0.0...3.1.0)
103+
104+
### SDK versions
105+
If version numbers changed clean your platform folders to avoid build errors.
106+
107+
- iOS: 3.2.0
108+
- Android: 9.0.0
109+
110+
### New
111+
- [#49](#49) Custom Authentication ([docs](docs/AUTHENTICATION.md#custom-login))
112+
113+
114+
## 3.0.0 (2016, May 26)
115+
116+
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/2.1.8...3.0.0)
117+
118+
### SDK versions
119+
If version numbers changed clean your platform folders to avoid build errors.
120+
121+
- iOS: 3.2.0
122+
- Android: 9.0.0
123+
124+
### New
125+
- [#34](#34) Support new Firebase 3 release

README.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# NativeScript Firebase plugin
22

3-
<img src="docs/images/firebase.png" width="154px" height="43px" alt="Firebase"/><br/>
3+
<img src="docs/images/firebase-logo.png" width="116px" height="32px" alt="Firebase"/><br/>
44
Google's realtime app platform (Database, Authentication, Configuration, Notifications) [firebase.google.com](https://firebase.google.com/)
55

6-
### Use when
7-
* you need to store JSON data in the cloud (but don't want to loose data when the device is offline),
8-
* you want to sync that data to other devices and platforms,
9-
* you want to optionally protect that data by having users log in,
10-
* you want to update clients at the moment the data changes (think chat and multiplayer games),
11-
* you want an easy way to remotely configure app features,
12-
* you want push notifications.
6+
## Features
7+
For readability the supported features have been moved to their own README's:
8+
9+
* Setup and troubleshooting (continue reading below)
10+
* [Realtime Database](docs/DATABASE.md)
11+
* [Authentication](docs/AUTHENTICATION.md)
12+
* [Remote Config](docs/REMOTECONFIG.md)
13+
* [Cloud Messaging](docs/MESSAGING.md)
14+
* [Storage](docs/STORAGE.md)
15+
* [Crash Reporting](docs/CRASHREPORTING.md)
1316

1417
## Prerequisites
1518
Head on over to [https://console.firebase.google.com/](https://console.firebase.google.com/) and sign up for a free account.
@@ -112,15 +115,6 @@ firebase.init({
112115
);
113116
```
114117

115-
## Features
116-
For readability the supported features have been moved to their own README's:
117-
118-
* [Realtime Database](docs/DATABASE.md)
119-
* [Authentication](docs/AUTHENTICATION.md)
120-
* [Remote Config](docs/REMOTECONFIG.md)
121-
* [Cloud Messaging](docs/MESSAGING.md)
122-
123-
124118
## Known issues on iOS
125119
On the simulator you may see this message if you have more than one app with the Firebase SDK ever installed:
126120

docs/AUTHENTICATION.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
<table>
2-
<tr>
3-
<td><img src="images/firebase.png" width="154px" height="43px" alt="Firebase"/></td>
4-
<td>Authentication</td>
5-
</tr>
6-
</table>
1+
<img src="images/firebase-logo.png" width="116px" height="32px" alt="Firebase"/>
72

83
## Enabling Authentication
94
Version 1.1.0 of this plugin added the capability to log your users in, either
105

116
* anonymously,
127
* by email and password,
138
* using a custom token,
14-
* using Facebook (iOS: solid, Android: experimental).
9+
* using Facebook.
1510

1611
Each of these login mechanisms need to be enabled in your Firebase console at the 'Login & Auth' tab.
1712

@@ -185,13 +180,15 @@ Use this login type to authenticate against firebase using a token generated by
185180
```
186181

187182
### Facebook login
188-
On iOS this is rock solid, but on Android it's work in progress. If you want to use it for iOS open the `Podfile` in the plugin's `platforms/ios` folder and uncomment the Facebook line (you can't miss it).
189183

190-
Don't forget to enable Facebook login in your firebase instance.
184+
First, enable Facebook login in your firebase instance and add the App-ID and App-Secret.
185+
186+
Then add the following lines to your code and check for setup instructions for your platform below.
191187

192188
```js
193189
firebase.login({
194-
type: firebase.LoginType.FACEBOOK
190+
type: firebase.LoginType.FACEBOOK,
191+
scope: ['public_profile', 'email'] // optional: defaults
195192
}).then(
196193
function (result) {
197194
JSON.stringify(result);
@@ -202,6 +199,38 @@ Don't forget to enable Facebook login in your firebase instance.
202199
)
203200
```
204201

202+
For a complete list of the available scope permissions, visit Facebook's documentation: https://developers.facebook.com/docs/facebook-login/permissions.
203+
204+
#### iOS
205+
If you want to use it for iOS open the `Podfile` in the plugin's `platforms/ios` folder and uncomment the Facebook line (you can't miss it).
206+
207+
#### Android
208+
209+
1. Uncomment the facebook SDK in `node_modules\nativescript-plugin-firebase\platforms\android\include.gradle`
210+
2. Add `<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>` to the `manifest/application tag` in `app\App_Resources\Android\AndroidManifest.xml`, so it becomes similar to this:
211+
212+
```xml
213+
<application
214+
android:name="com.tns.NativeScriptApplication"
215+
..>
216+
217+
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
218+
219+
<activity
220+
android:name="com.tns.NativeScriptActivity"
221+
..>
222+
```
223+
3. Create a file `app\App_Resources\Android\values\facebooklogin.xml` and add this (replace the id):
224+
225+
```xml
226+
<?xml version='1.0' encoding='utf-8'?>
227+
<resources>
228+
<string name="facebook_app_id">126035687816994</string>
229+
</resources>
230+
```
231+
4. In your Facebook dev console, go to the Basic settings and add the Android platform if you haven't already. Then set the 'Google Play Packagename' to your applicationId (see your `package.json`) and set 'Classname' to `com.tns.NativeScriptActivity`.
232+
5. Set the Key-Hash as well. If you don't know it you can try Facebook login in your app and observe the `adb logcat` output for something like `Key hash <......> does not match any stored key hashes.`
233+
205234
### logout
206235
Shouldn't be more complicated than:
207236

docs/CRASHREPORTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<img src="images/firebase-logo.png" width="116px" height="32px" alt="Firebase"/>
2+
3+
## Enabling Crash Reporting
4+
Nothing to do - since plugin version 3.4.2 this plugin automatically uploads
5+
crashes to your Firebase Console. Just check the 'Crash' menu item every now and then.
6+
7+
## Making sense of the stacktraces
8+
Please read [the official docs](https://firebase.google.com/docs/crash/)
9+
on what Crash reporting is and what you can do to have a better experience.
10+
11+
## Future work
12+
There's an option to send logs to Firebase along with the crash in order
13+
to add some context. This is however currently problematic on iOS but we'll keep an eye out.

docs/DATABASE.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
<table>
2-
<tr>
3-
<td><img src="images/firebase.png" width="154px" height="43px" alt="Firebase"/></td>
4-
<td>Database</td>
5-
</tr>
6-
</table>
1+
<img src="images/firebase-logo.png" width="116px" height="32px" alt="Firebase"/>
72

83
If you can spare 41 seconds, check (an older version of) this plugin's [demo app](https://github.com/EddyVerbruggen/nativescript-plugin-firebase-demo) in action:
94
[![YouTube demo, 41 sec](images/yt-thumb-database.png)](https://youtu.be/7zYU5e0Djkw "YouTube demo, 41 sec")
@@ -163,4 +158,25 @@ but if you only want to wipe everything at `/users`, do this:
163158

164159
```js
165160
firebase.remove("/users");
166-
```
161+
```
162+
163+
### keepInSync
164+
The Firebase Realtime Database synchronizes and stores a local copy of the data for active listeners (see the methods above). In addition, you can keep specific locations in sync.
165+
166+
The client will automatically download the data at these locations and keep it in sync even if the reference has no active listeners.
167+
168+
```js
169+
firebase.keepInSync(
170+
"/users", // which path in your Firebase needs to be kept in sync?
171+
true // set to false to disable this feature again
172+
).then(
173+
function () {
174+
console.log("firebase.keepInSync is ON for /users");
175+
},
176+
function (error) {
177+
console.log("firebase.keepInSync error: " + error);
178+
}
179+
);
180+
```
181+
182+
By default, 10MB of previously synced data will be cached. If the cache outgrows its configured size, the Firebase Realtime Database will purge data that has been used least recently. Data that is kept in sync, will not be purged from the cache. _(From the official doc for [iOS](https://firebase.google.com/docs/database/ios/offline-capabilities) and [Android](https://firebase.google.com/docs/database/android/offline-capabilities))._

docs/MESSAGING.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
<table>
2-
<tr>
3-
<td><img src="images/firebase.png" width="154px" height="43px" alt="Firebase"/></td>
4-
<td>Cloud Messaging</td>
5-
</tr>
6-
</table>
1+
<img src="images/firebase-logo.png" width="116px" height="32px" alt="Firebase"/>
72

83
## Enabling Firebase Cloud Messaging (FCM)
94
Version 3.3.0 of this plugin added FCM support (which is the successor of GCM).

docs/REMOTECONFIG.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
<table>
2-
<tr>
3-
<td><img src="images/firebase.png" width="154px" height="43px" alt="Firebase"/></td>
4-
<td>Remote Config</td>
5-
</tr>
6-
</table>
1+
<img src="images/firebase-logo.png" width="116px" height="32px" alt="Firebase"/>
72

83
## Enabling Remote Config
94
Since plugin version 3.2.0 you can retrieve _Remote Config_ properties.

0 commit comments

Comments
 (0)