cordova-plugin-firebase
Advanced tools
Comparing version 1.0.5 to 1.1.0
@@ -11,3 +11,3 @@ { | ||
"name": "cordova-plugin-firebase", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "Cordova plugin for Google Firebase", | ||
@@ -14,0 +14,0 @@ "cordova": { |
@@ -57,3 +57,3 @@ [![Build Status](https://travis-ci.org/arnesson/cordova-plugin-firebase.svg?branch=master)](https://travis-ci.org/arnesson/cordova-plugin-firebase) | ||
### 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. | ||
Hooks do 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`. | ||
@@ -65,3 +65,3 @@ ### Google Play Services | ||
### Android | ||
Download your container-config json file from Tag Manager and add a resource-file node in your config.xml. | ||
Download your container-config json file from Tag Manager and add a resource-file node in your `config.xml`. | ||
``` | ||
@@ -76,9 +76,9 @@ .... | ||
## Changing Notification Icon | ||
The plugin will use notification_icon from drawable resources if it exists, otherwise the default app icon will is used. | ||
The plugin will use notification_icon from drawable resources if it exists, otherwise the default app icon is used. | ||
To set a big icon and small icon for notifications, define them through drawable nodes. | ||
Create the required styles.xml files and add the icons to the | ||
Create the required `styles.xml` files and add the icons to the | ||
`<projectroot>/res/native/android/res/<drawable-DPI>` folders. | ||
The example below uses a png named "ic_silhouette.png", the app Icon (@mipmap/icon) and sets a base theme. | ||
From android version 21 (Lollipop) notifications were changed, needing a seperate setting. | ||
The example below uses a png named `ic_silhouette.png`, the app Icon (@mipmap/icon) and sets a base theme. | ||
From android version 21 (Lollipop) notifications were changed, needing a separate setting. | ||
If you only target Lollipop and above, you don't need to setup both. | ||
@@ -180,3 +180,3 @@ Thankfully using the version dependant asset selections, we can make one build/apk supporting all target platforms. | ||
Grant permission to recieve push notifications (will trigger prompt): | ||
Grant permission to receive push notifications (will trigger prompt): | ||
``` | ||
@@ -187,3 +187,3 @@ window.FirebasePlugin.grantPermission(); | ||
Check permission to recieve push notifications: | ||
Check permission to receive push notifications: | ||
``` | ||
@@ -216,2 +216,9 @@ window.FirebasePlugin.hasPermission(function(data){ | ||
### clearAllNotifications | ||
Clear all pending notifications from the drawer: | ||
``` | ||
window.FirebasePlugin.clearAllNotifications(); | ||
``` | ||
### subscribe | ||
@@ -273,3 +280,3 @@ | ||
**NOTE: This will only works on physical devices.** | ||
**NOTE: This will only work on physical devices.** | ||
@@ -283,3 +290,3 @@ iOS will return: credential (string) | ||
IMPORTANT NOTE: Android supports auto-verify and instant device verification. Therefore in that cases it doesn't make sense to ask for sms code as you won't receive any. Also, **verificationId** will be *false* in this case. In order to sign the user in you need to check **credential.instantVerification**, if it's true, skip the SMS Code entry, call your backend server (sorry, the only way to succeed with this plugin) and pass over the phonenumber as param to identify the user (via ajax for example, using any endpoint to your backend). | ||
IMPORTANT NOTE: Android supports auto-verify and instant device verification. Therefore in that case it doesn't make sense to ask for an sms code as you won't receive one. Also, **verificationId** will be *false* in this case. In order to sign the user in you need to check **credential.instantVerification**, if it's true, skip the SMS Code entry, call your backend server (sorry, it is the only way to succeed with this plugin) and pass the phone number as param to identify the user (via ajax for example, using any endpoint to your backend). | ||
@@ -297,7 +304,7 @@ When using node.js Firebase Admin-SDK, follow this tutorial: | ||
``` | ||
**YOU HAVE TO COVER THIS PROCESS, OR YOU WILL HAVE ABOUT 5% OF USERS STUCKING AT YOUR SCREEN, NO RECEIVING ANYTHING** | ||
**YOU HAVE TO COVER THIS PROCESS, OR YOU WILL HAVE ABOUT 5% OF USERS STICKING ON YOUR SCREEN, NOT RECEIVING ANYTHING** | ||
If this process is too complex for you, use this awesome plugin | ||
- https://github.com/chemerisuk/cordova-plugin-firebase-authentication | ||
It's not perfect but it fits for the most usecases and doesn't require to call your endpoint, as it has native phone auth support. | ||
It's not perfect but it fits for the most use cases and doesn't require calling your endpoint, as it has native phone auth support. | ||
@@ -330,7 +337,7 @@ ``` | ||
#### Android | ||
To use this auth you need to configure your app SHA hash in the android app configuration on firebase console. | ||
To use this auth you need to configure your app SHA hash in the android app configuration in the firebase console. | ||
See https://developers.google.com/android/guides/client-auth to know how to get SHA app hash. | ||
#### iOS | ||
Setup your push notifications first, and verify that they are arriving to your physical device before you test this method. Use the APNs auth key to generate the .p8 file and upload it to firebase. When you call this method, FCM sends a silent push to the device to verify it. | ||
Setup your push notifications first, and verify that they are arriving on your physical device before you test this method. Use the APNs auth key to generate the .p8 file and upload it to firebase. When you call this method, FCM sends a silent push to the device to verify it. | ||
@@ -337,0 +344,0 @@ ### fetch |
#!/usr/bin/env node | ||
'use strict'; | ||
@@ -13,11 +14,11 @@ | ||
fs.ensureDirSync = function (dir) { | ||
if (!fs.existsSync(dir)) { | ||
dir.split(path.sep).reduce(function (currentPath, folder) { | ||
currentPath += folder + path.sep; | ||
if (!fs.existsSync(currentPath)) { | ||
fs.mkdirSync(currentPath); | ||
} | ||
return currentPath; | ||
}, ''); | ||
} | ||
if (!fs.existsSync(dir)) { | ||
dir.split(path.sep).reduce(function (currentPath, folder) { | ||
currentPath += folder + path.sep; | ||
if (!fs.existsSync(currentPath)) { | ||
fs.mkdirSync(currentPath); | ||
} | ||
return currentPath; | ||
}, ''); | ||
} | ||
}; | ||
@@ -32,112 +33,91 @@ | ||
var PLATFORM = { | ||
IOS: { | ||
dest: [ | ||
IOS_DIR + '/' + name + '/Resources/GoogleService-Info.plist', | ||
IOS_DIR + '/' + name + '/Resources/Resources/GoogleService-Info.plist' | ||
], | ||
src: [ | ||
'GoogleService-Info.plist', | ||
IOS_DIR + '/www/GoogleService-Info.plist', | ||
'www/GoogleService-Info.plist' | ||
] | ||
}, | ||
ANDROID: { | ||
dest: [ | ||
ANDROID_DIR + '/google-services.json' | ||
], | ||
src: [ | ||
'google-services.json', | ||
ANDROID_DIR + '/assets/www/google-services.json', | ||
'www/google-services.json' | ||
], | ||
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' | ||
} | ||
IOS: { | ||
dest: [ | ||
IOS_DIR + '/' + name + '/Resources/GoogleService-Info.plist', | ||
IOS_DIR + '/' + name + '/Resources/Resources/GoogleService-Info.plist' | ||
], | ||
src: [ | ||
'GoogleService-Info.plist', | ||
IOS_DIR + '/www/GoogleService-Info.plist', | ||
'www/GoogleService-Info.plist' | ||
] | ||
}, | ||
ANDROID: { | ||
dest: [ | ||
ANDROID_DIR + '/google-services.json', | ||
ANDROID_DIR + '/app/google-services.json' | ||
], | ||
src: [ | ||
'google-services.json', | ||
ANDROID_DIR + '/assets/www/google-services.json', | ||
'www/google-services.json' | ||
], | ||
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' | ||
} | ||
}; | ||
function updateStringsXml(contents) { | ||
var json = JSON.parse(contents); | ||
var strings = fs.readFileSync(PLATFORM.ANDROID.stringsXml).toString(); | ||
function copyKey (platform, callback) { | ||
for (var i = 0; i < platform.src.length; i++) { | ||
var file = platform.src[i]; | ||
if (fileExists(file)) { | ||
try { | ||
var contents = fs.readFileSync(file).toString(); | ||
// strip non-default value | ||
strings = strings.replace(new RegExp('<string name="google_app_id">([^\@<]+?)</string>', 'i'), ''); | ||
try { | ||
platform.dest.forEach(function (destinationPath) { | ||
var folder = destinationPath.substring(0, destinationPath.lastIndexOf('/')); | ||
fs.ensureDirSync(folder); | ||
fs.writeFileSync(destinationPath, contents); | ||
}); | ||
} catch (e) { | ||
// skip | ||
} | ||
// strip non-default value | ||
strings = strings.replace(new RegExp('<string name="google_api_key">([^\@<]+?)</string>', 'i'), ''); | ||
callback && callback(contents); | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
// strip empty lines | ||
strings = strings.replace(new RegExp('(\r\n|\n|\r)[ \t]*(\r\n|\n|\r)', 'gm'), '$1'); | ||
// replace the default value | ||
strings = strings.replace(new RegExp('<string name="google_app_id">([^<]+?)</string>', 'i'), '<string name="google_app_id">' + json.client[0].client_info.mobilesdk_app_id + '</string>'); | ||
// replace the default value | ||
strings = strings.replace(new RegExp('<string name="google_api_key">([^<]+?)</string>', 'i'), '<string name="google_api_key">' + json.client[0].api_key[0].current_key + '</string>'); | ||
fs.writeFileSync(PLATFORM.ANDROID.stringsXml, strings); | ||
} | ||
function copyKey(platform, callback) { | ||
for (var i = 0; i < platform.src.length; i++) { | ||
var file = platform.src[i]; | ||
if (fileExists(file)) { | ||
try { | ||
var contents = fs.readFileSync(file).toString(); | ||
try { | ||
platform.dest.forEach(function (destinationPath) { | ||
var folder = destinationPath.substring(0, destinationPath.lastIndexOf('/')); | ||
fs.ensureDirSync(folder); | ||
fs.writeFileSync(destinationPath, contents); | ||
}); | ||
} catch (e) { | ||
// skip | ||
} | ||
callback && callback(contents); | ||
} catch (err) { | ||
console.log(err) | ||
} | ||
break; | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
function getValue(config, name) { | ||
var value = config.match(new RegExp('<' + name + '>(.*?)</' + name + '>', 'i')); | ||
if (value && value[1]) { | ||
return value[1] | ||
} else { | ||
return null | ||
} | ||
function getValue (config, name) { | ||
var value = config.match(new RegExp('<' + name + '>(.*?)</' + name + '>', 'i')); | ||
if (value && value[1]) { | ||
return value[1]; | ||
} else { | ||
return null; | ||
} | ||
} | ||
function fileExists(path) { | ||
try { | ||
return fs.statSync(path).isFile(); | ||
} catch (e) { | ||
return false; | ||
} | ||
function fileExists (path) { | ||
try { | ||
return fs.statSync(path).isFile(); | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
function directoryExists(path) { | ||
try { | ||
return fs.statSync(path).isDirectory(); | ||
} catch (e) { | ||
return false; | ||
} | ||
function directoryExists (path) { | ||
try { | ||
return fs.statSync(path).isDirectory(); | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
module.exports = function(context) { | ||
//get platform from the context supplied by cordova | ||
var platforms = context.opts.platforms; | ||
// Copy key files to their platform specific folders | ||
if (platforms.indexOf('ios') !== -1 && directoryExists(IOS_DIR)) { | ||
console.log('Preparing Firebase on iOS'); | ||
copyKey(PLATFORM.IOS); | ||
} | ||
if (platforms.indexOf('android') !== -1 && directoryExists(ANDROID_DIR)) { | ||
console.log('Preparing Firebase on Android'); | ||
copyKey(PLATFORM.ANDROID, updateStringsXml) | ||
} | ||
}; | ||
module.exports = function (context) { | ||
//get platform from the context supplied by cordova | ||
var platforms = context.opts.platforms; | ||
// Copy key files to their platform specific folders | ||
if (platforms.indexOf('ios') !== -1 && directoryExists(IOS_DIR)) { | ||
console.log('Preparing Firebase on iOS'); | ||
copyKey(PLATFORM.IOS); | ||
} | ||
if (platforms.indexOf('android') !== -1 && directoryExists(ANDROID_DIR)) { | ||
console.log('Preparing Firebase on Android'); | ||
copyKey(PLATFORM.ANDROID); | ||
} | ||
}; |
@@ -0,143 +1,183 @@ | ||
exports.initFirebase = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.initCrashlytics = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.initAnalytics = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.initPerformance = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.initRemoteConfig = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.getVerificationID = function (number, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.getInstanceId = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.getToken = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.getId = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.onNotificationOpen = function (success, error) { | ||
}; | ||
exports.onNotificationOpen = function (success, error) {}; | ||
exports.onTokenRefresh = function (success, error) { | ||
}; | ||
exports.onTokenRefresh = function (success, error) {}; | ||
exports.grantPermission = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.setBadgeNumber = function (number, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.getBadgeNumber = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.subscribe = function (topic, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.unsubscribe = function (topic, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.logEvent = function (name, params, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.logError = function (message, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.setScreenName = function (name, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.setUserId = function (id, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.setUserProperty = function (name, value, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.activateFetched = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.fetch = function (cacheExpirationSeconds, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.getByteArray = function (key, namespace, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.getValue = function (key, namespace, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.getInfo = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.setConfigSettings = function (settings, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.setDefaults = function (defaults, namespace, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.verifyPhoneNumber = function (number, timeOutDuration, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.setAnalyticsCollectionEnabled = function (enabled, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.setPerformanceCollectionEnabled = function (enabled, success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; | ||
exports.clearAllNotifications = function (success, error) { | ||
if (typeof success === 'function') { | ||
success(); | ||
} | ||
}; |
var exec = require('cordova/exec'); | ||
exports.initFirebase = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "initFirebase", []); | ||
}; | ||
exports.initCrashlytics = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "initCrashlytics", []); | ||
}; | ||
exports.initAnalytics = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "initAnalytics", []); | ||
}; | ||
exports.initPerformance = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "initPerformance", []); | ||
}; | ||
exports.initRemoteConfig = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "initRemoteConfig", []); | ||
}; | ||
exports.getVerificationID = function (number, success, error) { | ||
exec(success, error, "FirebasePlugin", "getVerificationID", [number]); | ||
exec(success, error, "FirebasePlugin", "getVerificationID", [number]); | ||
}; | ||
exports.getInstanceId = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "getInstanceId", []); | ||
exec(success, error, "FirebasePlugin", "getInstanceId", []); | ||
}; | ||
exports.getId = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "getId", []); | ||
exec(success, error, "FirebasePlugin", "getId", []); | ||
}; | ||
exports.getToken = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "getToken", []); | ||
exec(success, error, "FirebasePlugin", "getToken", []); | ||
}; | ||
exports.onNotificationOpen = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "onNotificationOpen", []); | ||
exec(success, error, "FirebasePlugin", "onNotificationOpen", []); | ||
}; | ||
exports.onTokenRefresh = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "onTokenRefresh", []); | ||
exec(success, error, "FirebasePlugin", "onTokenRefresh", []); | ||
}; | ||
exports.grantPermission = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "grantPermission", []); | ||
exec(success, error, "FirebasePlugin", "grantPermission", []); | ||
}; | ||
exports.hasPermission = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "hasPermission", []); | ||
exec(success, error, "FirebasePlugin", "hasPermission", []); | ||
}; | ||
exports.setBadgeNumber = function (number, success, error) { | ||
exec(success, error, "FirebasePlugin", "setBadgeNumber", [number]); | ||
exec(success, error, "FirebasePlugin", "setBadgeNumber", [number]); | ||
}; | ||
exports.getBadgeNumber = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "getBadgeNumber", []); | ||
exec(success, error, "FirebasePlugin", "getBadgeNumber", []); | ||
}; | ||
exports.subscribe = function (topic, success, error) { | ||
exec(success, error, "FirebasePlugin", "subscribe", [topic]); | ||
exec(success, error, "FirebasePlugin", "subscribe", [topic]); | ||
}; | ||
exports.unsubscribe = function (topic, success, error) { | ||
exec(success, error, "FirebasePlugin", "unsubscribe", [topic]); | ||
exec(success, error, "FirebasePlugin", "unsubscribe", [topic]); | ||
}; | ||
exports.unregister = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "unregister", []); | ||
exec(success, error, "FirebasePlugin", "unregister", []); | ||
}; | ||
exports.logEvent = function (name, params, success, error) { | ||
exec(success, error, "FirebasePlugin", "logEvent", [name, params]); | ||
exec(success, error, "FirebasePlugin", "logEvent", [name, params]); | ||
}; | ||
exports.logError = function (message, success, error) { | ||
exec(success, error, "FirebasePlugin", "logError", [message]); | ||
exec(success, error, "FirebasePlugin", "logError", [message]); | ||
}; | ||
exports.setScreenName = function (name, success, error) { | ||
exec(success, error, "FirebasePlugin", "setScreenName", [name]); | ||
exec(success, error, "FirebasePlugin", "setScreenName", [name]); | ||
}; | ||
exports.setUserId = function (id, success, error) { | ||
exec(success, error, "FirebasePlugin", "setUserId", [id]); | ||
exec(success, error, "FirebasePlugin", "setUserId", [id]); | ||
}; | ||
exports.setUserProperty = function (name, value, success, error) { | ||
exec(success, error, "FirebasePlugin", "setUserProperty", [name, value]); | ||
exec(success, error, "FirebasePlugin", "setUserProperty", [name, value]); | ||
}; | ||
exports.activateFetched = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "activateFetched", []); | ||
exec(success, error, "FirebasePlugin", "activateFetched", []); | ||
}; | ||
exports.fetch = function (cacheExpirationSeconds, success, error) { | ||
var args = []; | ||
if (typeof cacheExpirationSeconds === 'number') { | ||
args.push(cacheExpirationSeconds); | ||
} else { | ||
error = success; | ||
success = cacheExpirationSeconds; | ||
} | ||
exec(success, error, "FirebasePlugin", "fetch", args); | ||
var args = []; | ||
if (typeof cacheExpirationSeconds === 'number') { | ||
args.push(cacheExpirationSeconds); | ||
} else { | ||
error = success; | ||
success = cacheExpirationSeconds; | ||
} | ||
exec(success, error, "FirebasePlugin", "fetch", args); | ||
}; | ||
exports.getByteArray = function (key, namespace, success, error) { | ||
var args = [key]; | ||
if (typeof namespace === 'string') { | ||
args.push(namespace); | ||
} else { | ||
error = success; | ||
success = namespace; | ||
} | ||
exec(success, error, "FirebasePlugin", "getByteArray", args); | ||
var args = [key]; | ||
if (typeof namespace === 'string') { | ||
args.push(namespace); | ||
} else { | ||
error = success; | ||
success = namespace; | ||
} | ||
exec(success, error, "FirebasePlugin", "getByteArray", args); | ||
}; | ||
exports.getValue = function (key, namespace, success, error) { | ||
var args = [key]; | ||
if (typeof namespace === 'string') { | ||
args.push(namespace); | ||
} else { | ||
error = success; | ||
success = namespace; | ||
} | ||
exec(success, error, "FirebasePlugin", "getValue", args); | ||
var args = [key]; | ||
if (typeof namespace === 'string') { | ||
args.push(namespace); | ||
} else { | ||
error = success; | ||
success = namespace; | ||
} | ||
exec(success, error, "FirebasePlugin", "getValue", args); | ||
}; | ||
exports.getInfo = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "getInfo", []); | ||
exec(success, error, "FirebasePlugin", "getInfo", []); | ||
}; | ||
exports.setConfigSettings = function (settings, success, error) { | ||
exec(success, error, "FirebasePlugin", "setConfigSettings", [settings]); | ||
exec(success, error, "FirebasePlugin", "setConfigSettings", [settings]); | ||
}; | ||
exports.setDefaults = function (defaults, namespace, success, error) { | ||
var args = [defaults]; | ||
if (typeof namespace === 'string') { | ||
args.push(namespace); | ||
} else { | ||
error = success; | ||
success = namespace; | ||
} | ||
exec(success, error, "FirebasePlugin", "setDefaults", args); | ||
var args = [defaults]; | ||
if (typeof namespace === 'string') { | ||
args.push(namespace); | ||
} else { | ||
error = success; | ||
success = namespace; | ||
} | ||
exec(success, error, "FirebasePlugin", "setDefaults", args); | ||
}; | ||
exports.startTrace = function (name, success, error) { | ||
exec(success, error, "FirebasePlugin", "startTrace", [name]); | ||
exec(success, error, "FirebasePlugin", "startTrace", [name]); | ||
}; | ||
exports.incrementCounter = function (name, counterNamed, success, error) { | ||
exec(success, error, "FirebasePlugin", "incrementCounter", [name, counterNamed]); | ||
exec(success, error, "FirebasePlugin", "incrementCounter", [name, counterNamed]); | ||
}; | ||
exports.stopTrace = function (name, success, error) { | ||
exec(success, error, "FirebasePlugin", "stopTrace", [name]); | ||
exec(success, error, "FirebasePlugin", "stopTrace", [name]); | ||
}; | ||
exports.setAnalyticsCollectionEnabled = function (enabled, success, error) { | ||
exec(success, error, "FirebasePlugin", "setAnalyticsCollectionEnabled", [enabled]); | ||
exec(success, error, "FirebasePlugin", "setAnalyticsCollectionEnabled", [enabled]); | ||
}; | ||
exports.setPerformanceCollectionEnabled = function (enabled, success, error) { | ||
exec(success, error, "FirebasePlugin", "setPerformanceCollectionEnabled", [enabled]); | ||
}; | ||
exports.verifyPhoneNumber = function (number, timeOutDuration, success, error) { | ||
if (typeof timeOutDuration === 'function') { | ||
// method being called with old signature: function(number, success, error) | ||
// timeOutDuration is the success callback, success is the error callback | ||
exec(timeOutDuration, success, "FirebasePlugin", "verifyPhoneNumber", [number]); | ||
} else { | ||
// method being called with new signature: function(number, timeOutDuration, success, error) | ||
// callbacks are correctly named | ||
exec(success, error, "FirebasePlugin", "verifyPhoneNumber", [number, timeOutDuration]); | ||
} | ||
if (typeof timeOutDuration === 'function') { | ||
// method being called with old signature: function(number, success, error) | ||
// timeOutDuration is the success callback, success is the error callback | ||
exec(timeOutDuration, success, "FirebasePlugin", "verifyPhoneNumber", [number]); | ||
} else { | ||
// method being called with new signature: function(number, timeOutDuration, success, error) | ||
// callbacks are correctly named | ||
exec(success, error, "FirebasePlugin", "verifyPhoneNumber", [number, timeOutDuration]); | ||
} | ||
}; | ||
exports.clearAllNotifications = function (success, error) { | ||
exec(success, error, "FirebasePlugin", "clearAllNotifications", []); | ||
}; |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
315436344
610
637
490
5