Socket
Socket
Sign inDemoInstall

cordova-plugin-firebase

Package Overview
Dependencies
0
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.25 to 1.0.0

.travis.yml

7

package.json

@@ -11,3 +11,3 @@ {

"name": "cordova-plugin-firebase",
"version": "0.1.25",
"version": "1.0.0",
"description": "Cordova plugin for Google Firebase",

@@ -31,3 +31,6 @@ "cordova": {

"phone auth"
]
],
"scripts": {
"postversion": "git push && git push --tags && npm publish"
}
}

@@ -0,1 +1,3 @@

[![Build Status](https://travis-ci.org/arnesson/cordova-plugin-firebase.svg?branch=master)](https://travis-ci.org/arnesson/cordova-plugin-firebase)
# cordova-plugin-firebase

@@ -5,47 +7,27 @@ This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project!

Donations are welcome and will go towards further development of this project. Use the wallet address below to donate.
Donations are welcome and will go towards further development of this project. Use the addresses below to donate.
```
BTC: 1JuXhHMCPHXT2fDfSRUTef9TpE2D67sc9f
ETH: 0x74B5eDEce465fDd360b3b03C6984784140ac742e
BCH: qzu5ffphkcgajn7kd7d90etq82maylz34uqg4uj5jf
LTC: LKnFugRfczVH7qfBrmhzZDknhqxCzz6wJB
XMR: 43ZMMEh5x4miZLMZF3W3faAL5Y44fPBXrFWBVXYePBjwXCvxLuo84Cof8ufXgb4sZLEpSDE3eKr5X7jNPfd4kppr8oMX9uM
Paypal: https://paypal.me/arnesson
```
Thank you for your support!
## in this fork
### verifyPhoneNumber (Android only)
Request a verificationId and send a SMS with a verificatioCode.
Use them to construct a credenial to sign in the user (in your app).
https://firebase.google.com/docs/auth/android/phone-auth
https://firebase.google.com/docs/reference/js/firebase.auth.Auth#signInWithCredential
NOTE: To use this auth you need to configure your app SHA hash in the android app configuration on firebase console.
See https://developers.google.com/android/guides/client-auth to know how to get SHA app hash.
NOTE: This will only works on physical devices.
```
window.FirebasePlugin.verifyPhoneNumber(number, timeOutDuration, function(credential) {
console.log(credential);
// ask user to input verificationCode:
var code = inputField.value.toString();
var verificationId = credential.verificationId;
var signInCredential = firebase.auth.PhoneAuthProvider.credential(verificationId, code);
firebase.auth().signInWithCredential(signInCredential);
}, function(error) {
console.error(error);
});
```
## Installation
See npm package for versions - https://www.npmjs.com/package/cordova-plugin-firebase
Great installation and setup guide by Medium.com - [https://medium.com/@felipepucinelli/how-to-add-push...](https://medium.com/@felipepucinelli/how-to-add-push-notifications-in-your-cordova-application-using-firebase-69fac067e821)
Install the plugin by adding it your project's config.xml:
```
<plugin name="cordova-plugin-firebase" spec="0.1.25" />
<plugin name="cordova-plugin-firebase" spec="1.0.0" />
```
or by running:
```
cordova plugin add cordova-plugin-firebase@0.1.25 --save
cordova plugin add cordova-plugin-firebase@1.0.0 --save
```

@@ -71,2 +53,8 @@ Download your Firebase configuration files, GoogleService-Info.plist for ios and google-services.json for android, and place them in the root folder of your cordova project:

### Notes about PhoneGap Build
Hooks does not work with PhoneGap Build. This means you will have to manually make sure the configuration files are included. One way to do that is to make a private fork of this plugin and replace the placeholder config files (see src/ios and src/android) with your actual ones, as well as hard coding your app id and api key in plugin.xml.
## Google Tag Manager

@@ -78,5 +66,5 @@ ### Android

<platform name="android">
<content src="index.html" />
<resource-file src="GTM-5MFXXXX.json" target="assets/containers/GTM-5MFXXXX.json" />
...
<content src="index.html" />
<resource-file src="GTM-5MFXXXX.json" target="assets/containers/GTM-5MFXXXX.json" />
...
```

@@ -135,7 +123,2 @@

### Notes about PhoneGap Build
Hooks does not work with PhoneGap Build. This means you will have to manually make sure the configuration files are included. One way to do that is to make a private fork of this plugin and replace the placeholder config files (see src/ios and src/android) with your actual ones, as well as hard coding your app id and api key in plugin.xml.
## Methods

@@ -277,2 +260,30 @@

### verifyPhoneNumber (Android only)
Request a verificationId and send a SMS with a verificationCode.
Use them to construct a credenial to sign in the user (in your app).
https://firebase.google.com/docs/auth/android/phone-auth
https://firebase.google.com/docs/reference/js/firebase.auth.Auth#signInWithCredential
NOTE: To use this auth you need to configure your app SHA hash in the android app configuration on firebase console.
See https://developers.google.com/android/guides/client-auth to know how to get SHA app hash.
NOTE: This will only works on physical devices.
```
window.FirebasePlugin.verifyPhoneNumber(number, timeOutDuration, function(credential) {
console.log(credential);
// ask user to input verificationCode:
var code = inputField.value.toString();
var verificationId = credential.verificationId;
var signInCredential = firebase.auth.PhoneAuthProvider.credential(verificationId, code);
firebase.auth().signInWithCredential(signInCredential);
}, function(error) {
console.error(error);
});
```
### fetch

@@ -358,2 +369,6 @@

// the status of the most recent fetch attempt (int)
// 0 = Config has never been fetched.
// 1 = Config fetch succeeded.
// 2 = Config fetch failed.
// 3 = Config fetch was throttled.
console.log(info.lastFetchStatus);

@@ -398,8 +413,42 @@ }, function(error) {

### startTrace
Start a trace.
```
window.FirebasePlugin.startTrace("test trace", success, error);
```
### incrementCounter
To count the performance-related events that occur in your app (such as cache hits or retries), add a line of code similar to the following whenever the event occurs, using a string other than retry to name that event if you are counting a different type of event:
```
window.FirebasePlugin.incrementCounter("test trace", "retry", success, error);
```
### stopTrace
Stop the trace
```
window.FirebasePlugin.stopTrace("test trace");
```
### setAnalyticsCollectionEnabled
Enable/disable analytics collection
```
window.FirebasePlugin.setAnalyticsCollectionEnabled(true); // Enables analytics collection
window.FirebasePlugin.setAnalyticsCollectionEnabled(false); // Disables analytics collection
```
### Phone Authentication
**BASED ON THE CONTRIBUTIONS OF**
IOS
IOS
https://github.com/silverio/cordova-plugin-firebase
ANDROID
ANDROID
https://github.com/apptum/cordova-plugin-firebase

@@ -414,7 +463,6 @@

window.FirebasePlugin.getVerificationID("+573123456789",function(id) {
console.log("verificationID: "+id);
}, function(error) {
console.error(error);
});
console.log("verificationID: "+id);
}, function(error) {
console.error(error);
});
```

@@ -424,8 +472,8 @@

```
(<any>window).FirebasePlugin.getVerificationID("+573123456789", id => {
console.log("verificationID: " + id);
this.verificationId = id;
}, error => {
console.log("error: " + error);
});
(<any>window).FirebasePlugin.getVerificationID("+573123456789", id => {
console.log("verificationID: " + id);
this.verificationId = id;
}, error => {
console.log("error: " + error);
});
```

@@ -432,0 +480,0 @@ Get the intermediate AuthCredential object

@@ -51,3 +51,3 @@ #!/usr/bin/env node

],
stringsXml: ANDROID_DIR + '/res/values/strings.xml'
stringsXml: fileExists(ANDROID_DIR + '/app/src/main/res/values/strings.xml') ? ANDROID_DIR + '/app/src/main/res/values/strings.xml' : ANDROID_DIR + '/res/values/strings.xml'
}

@@ -54,0 +54,0 @@ };

@@ -1,2 +0,2 @@

exports.getVerificationID = function(number, success, error) {
exports.getVerificationID = function (number, success, error) {
if (typeof success === 'function') {

@@ -7,3 +7,3 @@ success();

exports.getInstanceId = function(success, error) {
exports.getInstanceId = function (success, error) {
if (typeof success === 'function') {

@@ -14,3 +14,3 @@ success();

exports.getToken = function(success, error) {
exports.getToken = function (success, error) {
if (typeof success === 'function') {

@@ -21,9 +21,15 @@ success();

exports.onNotificationOpen = function(success, error) {
exports.getId = function (success, error) {
if (typeof success === 'function') {
success();
}
};
exports.onTokenRefresh = function(success, error) {
exports.onNotificationOpen = function (success, error) {
};
exports.grantPermission = function(success, error) {
exports.onTokenRefresh = function (success, error) {
};
exports.grantPermission = function (success, error) {
if (typeof success === 'function') {

@@ -34,3 +40,3 @@ success();

exports.setBadgeNumber = function(number, success, error) {
exports.setBadgeNumber = function (number, success, error) {
if (typeof success === 'function') {

@@ -41,3 +47,3 @@ success();

exports.getBadgeNumber = function(success, error) {
exports.getBadgeNumber = function (success, error) {
if (typeof success === 'function') {

@@ -48,3 +54,3 @@ success();

exports.subscribe = function(topic, success, error) {
exports.subscribe = function (topic, success, error) {
if (typeof success === 'function') {

@@ -55,3 +61,3 @@ success();

exports.unsubscribe = function(topic, success, error) {
exports.unsubscribe = function (topic, success, error) {
if (typeof success === 'function') {

@@ -62,3 +68,3 @@ success();

exports.logEvent = function(name, params, success, error) {
exports.logEvent = function (name, params, success, error) {
if (typeof success === 'function') {

@@ -69,3 +75,3 @@ success();

exports.logError = function(message, success, error) {
exports.logError = function (message, success, error) {
if (typeof success === 'function') {

@@ -76,3 +82,3 @@ success();

exports.setScreenName = function(name, success, error) {
exports.setScreenName = function (name, success, error) {
if (typeof success === 'function') {

@@ -83,3 +89,3 @@ success();

exports.setUserId = function(id, success, error) {
exports.setUserId = function (id, success, error) {
if (typeof success === 'function') {

@@ -90,3 +96,3 @@ success();

exports.setUserProperty = function(name, value, success, error) {
exports.setUserProperty = function (name, value, success, error) {
if (typeof success === 'function') {

@@ -139,3 +145,3 @@ success();

exports.verifyPhoneNumber = function(number, timeOutDuration, success, error) {
exports.verifyPhoneNumber = function (number, timeOutDuration, success, error) {
if (typeof success === 'function') {

@@ -145,1 +151,7 @@ success();

};
exports.setAnalyticsCollectionEnabled = function (enabled, success, error) {
if (typeof success === 'function') {
success();
}
};
var exec = require('cordova/exec');
exports.getVerificationID = function(number, success, error) {
exec(success, error, "FirebasePlugin", "getVerificationID", [number]);
};
exports.getInstanceId = function(success, error) {
exports.getInstanceId = function (success, error) {
exec(success, error, "FirebasePlugin", "getInstanceId", []);
};
exports.getToken = function(success, error) {
exports.getId = function (success, error) {
exec(success, error, "FirebasePlugin", "getId", []);
};
exports.getToken = function (success, error) {
exec(success, error, "FirebasePlugin", "getToken", []);
};
exports.onNotificationOpen = function(success, error) {
exports.onNotificationOpen = function (success, error) {
exec(success, error, "FirebasePlugin", "onNotificationOpen", []);
};
exports.onTokenRefresh = function(success, error) {
exports.onTokenRefresh = function (success, error) {
exec(success, error, "FirebasePlugin", "onTokenRefresh", []);
};
exports.grantPermission = function(success, error) {
exports.grantPermission = function (success, error) {
exec(success, error, "FirebasePlugin", "grantPermission", []);
};
exports.hasPermission = function(success, error) {
exports.hasPermission = function (success, error) {
exec(success, error, "FirebasePlugin", "hasPermission", []);
};
exports.setBadgeNumber = function(number, success, error) {
exports.setBadgeNumber = function (number, success, error) {
exec(success, error, "FirebasePlugin", "setBadgeNumber", [number]);
};
exports.getBadgeNumber = function(success, error) {
exports.getBadgeNumber = function (success, error) {
exec(success, error, "FirebasePlugin", "getBadgeNumber", []);
};
exports.subscribe = function(topic, success, error) {
exports.subscribe = function (topic, success, error) {
exec(success, error, "FirebasePlugin", "subscribe", [topic]);
};
exports.unsubscribe = function(topic, success, error) {
exports.unsubscribe = function (topic, success, error) {
exec(success, error, "FirebasePlugin", "unsubscribe", [topic]);
};
exports.unregister = function(success, error) {
exports.unregister = function (success, error) {
exec(success, error, "FirebasePlugin", "unregister", []);
};
exports.logEvent = function(name, params, success, error) {
exports.logEvent = function (name, params, success, error) {
exec(success, error, "FirebasePlugin", "logEvent", [name, params]);
};
exports.logError = function(message, success, error) {
exports.logError = function (message, success, error) {
exec(success, error, "FirebasePlugin", "logError", [message]);
};
exports.setScreenName = function(name, success, error) {
exports.setScreenName = function (name, success, error) {
exec(success, error, "FirebasePlugin", "setScreenName", [name]);
};
exports.setUserId = function(id, success, error) {
exports.setUserId = function (id, success, error) {
exec(success, error, "FirebasePlugin", "setUserId", [id]);
};
exports.setUserProperty = function(name, value, success, error) {
exports.setUserProperty = function (name, value, success, error) {
exec(success, error, "FirebasePlugin", "setUserProperty", [name, value]);

@@ -126,4 +127,16 @@ };

exports.verifyPhoneNumber = function(number, timeOutDuration, success, error) {
exec(success, error, "FirebasePlugin", "verifyPhoneNumber", [number, timeOutDuration]);
};
exports.startTrace = function (name, success, error) {
exec(success, error, "FirebasePlugin", "startTrace", [name]);
};
exports.incrementCounter = function (name, counterNamed, success, error) {
exec(success, error, "FirebasePlugin", "incrementCounter", [name, counterNamed]);
};
exports.stopTrace = function (name, success, error) {
exec(success, error, "FirebasePlugin", "stopTrace", [name]);
};
exports.setAnalyticsCollectionEnabled = function (enabled, success, error) {
exec(success, error, "FirebasePlugin", "setAnalyticsCollectionEnabled", [enabled]);
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc