diff options
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-firebase')
67 files changed, 5459 insertions, 0 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-firebase/LICENSE b/StoneIsland/plugins/cordova-plugin-firebase/LICENSE new file mode 100644 index 00000000..4a12e4dc --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Robert Arnesson AB + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/StoneIsland/plugins/cordova-plugin-firebase/README.md b/StoneIsland/plugins/cordova-plugin-firebase/README.md new file mode 100644 index 00000000..2fed7ef5 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/README.md @@ -0,0 +1,342 @@ +# cordova-plugin-firebase +This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! +Android and iOS supported. + +Donations are welcome and will go towards further development of this project. Use the wallet address below to donate. + +BTC: 1JuXhHMCPHXT2fDfSRUTef9TpE2D67sc9f + +Thank you for your support! + +## Installation +See npm package for versions - https://www.npmjs.com/package/cordova-plugin-firebase + +Install the plugin by adding it your project's config.xml: +``` +<plugin name="cordova-plugin-firebase" spec="0.1.24" /> +``` +or by running: +``` +cordova plugin add cordova-plugin-firebase@0.1.24 --save +``` +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: + +``` +- My Project/ + platforms/ + plugins/ + www/ + config.xml + google-services.json <-- + GoogleService-Info.plist <-- + ... +``` + +See https://support.google.com/firebase/answer/7015592 for details how to download the files from firebase. + +This plugin uses a hook (after prepare) that copies the configuration files to the right place, namely platforms/ios/\<My Project\>/Resources for ios and platforms/android for android. + +**Note that the Firebase SDK requires the configuration files to be present and valid, otherwise your app will crash on boot or Firebase features won't work.** + +## Changing Notification Icon +The plugin will use notification_icon from drawable resources if it exists, otherwise the default app icon will 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 +`<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. +If you only target Lollipop and above, you don't need to setup both. +Thankfully using the version dependant asset selections, we can make one build/apk supporting all target platforms. +`<projectroot>/res/native/android/res/values/styles.xml` +``` +<?xml version="1.0" encoding="utf-8" ?> +<resources> + <!-- inherit from the holo theme --> + <style name="AppTheme" parent="android:Theme.Light"> + <item name="android:windowDisablePreview">true</item> + </style> + <drawable name="notification_big">@mipmap/icon</drawable> + <drawable name="notification_icon">@mipmap/icon</drawable> +</resources> +``` +and +`<projectroot>/res/native/android/res/values-v21/styles.xml` +``` +<?xml version="1.0" encoding="utf-8" ?> +<resources> + <!-- inherit from the material theme --> + <style name="AppTheme" parent="android:Theme.Material"> + <item name="android:windowDisablePreview">true</item> + </style> + <drawable name="notification_big">@mipmap/icon</drawable> + <drawable name="notification_icon">@drawable/ic_silhouette</drawable> +</resources> +``` + +## Notification Colors + +On Android Lollipop and above you can also set the accent color for the notification by adding a color setting. + +`<projectroot>/res/native/android/res/values/colors.xml` +``` +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="primary">#FFFFFF00</color> + <color name="primary_dark">#FF220022</color> + <color name="accent">#FF00FFFF</color> +</resources> +``` + + +### 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 + +### getToken + +Get the device token (id): +``` +window.FirebasePlugin.getToken(function(token) { + // save this server-side and use it to push notifications to this device + console.log(token); +}, function(error) { + console.error(error); +}); +``` +Note that token will be null if it has not been established yet + +### onTokenRefresh + +Register for token changes: +``` +window.FirebasePlugin.onTokenRefresh(function(token) { + // save this server-side and use it to push notifications to this device + console.log(token); +}, function(error) { + console.error(error); +}); +``` +This is the best way to get a valid token for the device as soon as the token is established + +### onNotificationOpen + +Register notification callback: +``` +window.FirebasePlugin.onNotificationOpen(function(notification) { + console.log(notification); +}, function(error) { + console.error(error); +}); +``` +Notification flow: + +1. App is in foreground: + 1. User receives the notification data in the JavaScript callback without any notification on the device itself (this is the normal behaviour of push notifications, it is up to you, the developer, to notify the user) +2. App is in background: + 1. User receives the notification message in its device notification bar + 2. User taps the notification and the app opens + 3. User receives the notification data in the JavaScript callback + +Notification icon on Android: + +[Changing notification icon](#changing-notification-icon) + +### grantPermission (iOS only) + +Grant permission to recieve push notifications (will trigger prompt): +``` +window.FirebasePlugin.grantPermission(); +``` +### hasPermission + +Check permission to recieve push notifications: +``` +window.FirebasePlugin.hasPermission(function(data){ + console.log(data.isEnabled); +}); +``` + +### setBadgeNumber + +Set a number on the icon badge: +``` +window.FirebasePlugin.setBadgeNumber(3); +``` + +Set 0 to clear the badge +``` +window.FirebasePlugin.setBadgeNumber(0); +``` + +### getBadgeNumber + +Get icon badge number: +``` +window.FirebasePlugin.getBadgeNumber(function(n) { + console.log(n); +}); +``` + +### subscribe + +Subscribe to a topic: +``` +window.FirebasePlugin.subscribe("example"); +``` + +### unsubscribe + +Unsubscribe from a topic: +``` +window.FirebasePlugin.unsubscribe("example"); +``` + +### unregister + +Unregister from firebase, used to stop receiving push notifications. Call this when you logout user from your app. : +``` +window.FirebasePlugin.unregister(); +``` + +### logEvent + +Log an event using Analytics: +``` +window.FirebasePlugin.logEvent("select_content", {content_type: "page_view", item_id: "home"}); +``` + +### setScreenName + +Set the name of the current screen in Analytics: +``` +window.FirebasePlugin.setScreenName("Home"); +``` + +### setUserId + +Set a user id for use in Analytics: +``` +window.FirebasePlugin.setUserId("user_id"); +``` + +### setUserProperty + +Set a user property for use in Analytics: +``` +window.FirebasePlugin.setUserProperty("name", "value"); +``` + +### fetch + +Fetch Remote Config parameter values for your app: +``` +window.FirebasePlugin.fetch(); +// or, specify the cacheExpirationSeconds +window.FirebasePlugin.fetch(600); +``` + +### activateFetched + +Activate the Remote Config fetched config: +``` +window.FirebasePlugin.activateFetched(function(activated) { + // activated will be true if there was a fetched config activated, + // or false if no fetched config was found, or the fetched config was already activated. + console.log(activated); +}, function(error) { + console.error(error); +}); +``` + +### getValue + +Retrieve a Remote Config value: +``` +window.FirebasePlugin.getValue("key", function(value) { + console.log(value); +}, function(error) { + console.error(error); +}); +// or, specify a namespace for the config value +window.FirebasePlugin.getValue("key", "namespace", function(value) { + console.log(value); +}, function(error) { + console.error(error); +}); +``` + +### getByteArray (Android only) +**NOTE: byte array is only available for SDK 19+** +Retrieve a Remote Config byte array: +``` +window.FirebasePlugin.getByteArray("key", function(bytes) { + // a Base64 encoded string that represents the value for "key" + console.log(bytes.base64); + // a numeric array containing the values of the byte array (i.e. [0xFF, 0x00]) + console.log(bytes.array); +}, function(error) { + console.error(error); +}); +// or, specify a namespace for the byte array +window.FirebasePlugin.getByteArray("key", "namespace", function(bytes) { + // a Base64 encoded string that represents the value for "key" + console.log(bytes.base64); + // a numeric array containing the values of the byte array (i.e. [0xFF, 0x00]) + console.log(bytes.array); +}, function(error) { + console.error(error); +}); +``` + +### getInfo (Android only) + +Get the current state of the FirebaseRemoteConfig singleton object: +``` +window.FirebasePlugin.getInfo(function(info) { + // the status of the developer mode setting (true/false) + console.log(info.configSettings.developerModeEnabled); + // the timestamp (milliseconds since epoch) of the last successful fetch + console.log(info.fetchTimeMillis); + // the status of the most recent fetch attempt (int) + console.log(info.lastFetchStatus); +}, function(error) { + console.error(error); +}); +``` + +### setConfigSettings (Android only) + +Change the settings for the FirebaseRemoteConfig object's operations: +``` +var settings = { + developerModeEnabled: true +} +window.FirebasePlugin.setConfigSettings(settings); +``` + +### setDefaults (Android only) + +Set defaults in the Remote Config: +``` +// define defaults +var defaults = { + // map property name to value in Remote Config defaults + mLong: 1000, + mString: 'hello world', + mDouble: 3.14, + mBoolean: true, + // map "mBase64" to a Remote Config byte array represented by a Base64 string + // Note: the Base64 string is in an array in order to differentiate from a string config value + mBase64: ["SGVsbG8gV29ybGQ="], + // map "mBytes" to a Remote Config byte array represented by a numeric array + mBytes: [0xFF, 0x00] +} +// set defaults +window.FirebasePlugin.setDefaults(defaults); +// or, specify a namespace +window.FirebasePlugin.setDefaults(defaults, "namespace"); +``` diff --git a/StoneIsland/plugins/cordova-plugin-firebase/package.json b/StoneIsland/plugins/cordova-plugin-firebase/package.json new file mode 100644 index 00000000..90b5d164 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/package.json @@ -0,0 +1,60 @@ +{ + "_from": "cordova-plugin-firebase", + "_id": "cordova-plugin-firebase@0.1.24", + "_inBundle": false, + "_integrity": "sha1-qZk6XHZxFQJM2IIJDuiBT6TvuYQ=", + "_location": "/cordova-plugin-firebase", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "cordova-plugin-firebase", + "name": "cordova-plugin-firebase", + "escapedName": "cordova-plugin-firebase", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/cordova-plugin-firebase/-/cordova-plugin-firebase-0.1.24.tgz", + "_shasum": "a9993a5c767115024cd882090ee8814fa4efb984", + "_spec": "cordova-plugin-firebase", + "_where": "/Users/user/Sites/stone-island/StoneIsland/node_modules", + "author": { + "name": "Robert Arnesson" + }, + "bugs": { + "url": "https://github.com/arnesson/cordova-plugin-firebase/issues" + }, + "bundleDependencies": false, + "cordova": { + "id": "cordova-plugin-firebase", + "platforms": [ + "android", + "ios", + "browser" + ] + }, + "deprecated": false, + "description": "Cordova plugin for Google Firebase", + "homepage": "https://github.com/arnesson/cordova-plugin-firebase#readme", + "keywords": [ + "ecosystem:cordova", + "cordova-android", + "cordova-ios", + "cordova-browser", + "firebase", + "push", + "notifications" + ], + "license": "MIT", + "name": "cordova-plugin-firebase", + "repository": { + "type": "git", + "url": "git+https://github.com/arnesson/cordova-plugin-firebase.git" + }, + "version": "0.1.24" +} diff --git a/StoneIsland/plugins/cordova-plugin-firebase/plugin.xml b/StoneIsland/plugins/cordova-plugin-firebase/plugin.xml new file mode 100644 index 00000000..c0cacd43 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/plugin.xml @@ -0,0 +1,108 @@ +<?xml version='1.0' encoding='utf-8'?> +<plugin id="cordova-plugin-firebase" version="0.1.24" +xmlns="http://apache.org/cordova/ns/plugins/1.0" +xmlns:android="http://schemas.android.com/apk/res/android"> + <name>Google Firebase Plugin</name> + + <license>MIT</license> + + <engines> + <engine name="cordova" version=">=3.2.0" /> + </engines> + + <platform name="android"> + <js-module name="FirebasePlugin" src="www/firebase.js"> + <clobbers target="FirebasePlugin" /> + </js-module> + <config-file parent="/*" target="res/xml/config.xml"> + <feature name="FirebasePlugin"> + <param name="android-package" value="org.apache.cordova.firebase.FirebasePlugin" /> + <param name="onload" value="true" /> + </feature> + </config-file> + <config-file parent="/resources" target="res/values/strings.xml"> + <string name="google_app_id">@string/google_app_id</string> + </config-file> + <config-file parent="/resources" target="res/values/strings.xml"> + <string name="google_api_key">@string/google_api_key</string> + </config-file> + <config-file target="AndroidManifest.xml" parent="/*"> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> + <uses-permission android:name="android.permission.WAKE_LOCK" /> + </config-file> + <config-file target="AndroidManifest.xml" parent="/manifest/application"> + <service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementService" /> + </config-file> + <config-file target="AndroidManifest.xml" parent="/manifest/application"> + <service android:name="org.apache.cordova.firebase.FirebasePluginMessagingService"> + <intent-filter> + <action android:name="com.google.firebase.MESSAGING_EVENT"/> + </intent-filter> + </service> + <service android:name="org.apache.cordova.firebase.FirebasePluginInstanceIDService"> + <intent-filter> + <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> + </intent-filter> + </service> + <receiver android:name="org.apache.cordova.firebase.OnNotificationOpenReceiver"></receiver> + </config-file> + <source-file src="src/android/google-services.json" target-dir="." /> + <source-file src="src/android/FirebasePlugin.java" target-dir="src/org/apache/cordova/firebase" /> + <source-file src="src/android/OnNotificationOpenReceiver.java" target-dir="src/org/apache/cordova/firebase" /> + <source-file src="src/android/FirebasePluginInstanceIDService.java" target-dir="src/org/apache/cordova/firebase" /> + <source-file src="src/android/FirebasePluginMessagingService.java" target-dir="src/org/apache/cordova/firebase" /> + <source-file src="src/android/colors.xml" target-dir="res/values" /> + + <framework src="src/android/build.gradle" custom="true" type="gradleReference" /> + <framework src="com.google.gms:google-services:+" /> + <framework src="com.google.firebase:firebase-core:+" /> + <framework src="com.google.firebase:firebase-messaging:+" /> + <framework src="com.google.firebase:firebase-crash:+" /> + <framework src="com.google.firebase:firebase-config:+" /> + </platform> + + <platform name="ios"> + <js-module name="FirebasePlugin" src="www/firebase.js"> + <clobbers target="FirebasePlugin" /> + </js-module> + <config-file parent="/*" target="config.xml"> + <feature name="FirebasePlugin"> + <param name="ios-package" value="FirebasePlugin" /> + <param name="onload" value="true" /> + </feature> + </config-file> + <config-file parent="aps-environment" target="*/Entitlements-Debug.plist"> + <string>development</string> + </config-file> + <config-file parent="aps-environment" target="*/Entitlements-Release.plist"> + <string>production</string> + </config-file> + + <resource-file src="src/ios/GoogleService-Info.plist" /> + + <header-file src="src/ios/AppDelegate+FirebasePlugin.h" /> + <source-file src="src/ios/AppDelegate+FirebasePlugin.m" /> + <header-file src="src/ios/FirebasePlugin.h" /> + <source-file src="src/ios/FirebasePlugin.m" /> + + <header-file src="src/ios/Firebase/Firebase.h" /> + + <framework custom="true" src="src/ios/Firebase/Analytics/FirebaseAnalytics.framework" /> + <framework custom="true" src="src/ios/Firebase/Analytics/FirebaseCore.framework" /> + <framework custom="true" src="src/ios/Firebase/Analytics/FirebaseInstanceID.framework" /> + <framework custom="true" src="src/ios/Firebase/Analytics/GoogleToolboxForMac.framework" /> + <framework custom="true" src="src/ios/Firebase/Messaging/Protobuf.framework" /> + <framework custom="true" src="src/ios/Firebase/Messaging/FirebaseMessaging.framework" /> + <framework custom="true" src="src/ios/Firebase/Crash/FirebaseCrash.framework" /> + <framework custom="true" src="src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework" /> + </platform> + + <platform name="browser"> + <js-module name="FirebasePlugin" src="www/firebase-browser.js"> + <clobbers target="FirebasePlugin" /> + </js-module> + </platform> + + <hook src="scripts/after_prepare.js" type="after_prepare" /> +</plugin> diff --git a/StoneIsland/plugins/cordova-plugin-firebase/scripts/after_prepare.js b/StoneIsland/plugins/cordova-plugin-firebase/scripts/after_prepare.js new file mode 100755 index 00000000..3f8406c2 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/scripts/after_prepare.js @@ -0,0 +1,134 @@ +#!/usr/bin/env node
+'use strict';
+
+/**
+ * This hook makes sure projects using [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase)
+ * will build properly and have the required key files copied to the proper destinations when the app is build on Ionic Cloud using the package command.
+ * Credits: https://github.com/arnesson.
+ */
+var fs = require('fs');
+var path = require('path');
+
+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;
+ }, '');
+ }
+};
+
+var config = fs.readFileSync('config.xml').toString();
+var name = getValue(config, 'name');
+
+var IOS_DIR = 'platforms/ios';
+var ANDROID_DIR = 'platforms/android';
+
+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: ANDROID_DIR + '/res/values/strings.xml'
+ }
+};
+
+// Copy key files to their platform specific folders
+if (directoryExists(IOS_DIR)) {
+ copyKey(PLATFORM.IOS);
+} else if (directoryExists(ANDROID_DIR)) {
+ copyKey(PLATFORM.ANDROID, updateStringsXml)
+}
+
+function updateStringsXml(contents) {
+ var json = JSON.parse(contents);
+ var strings = fs.readFileSync(PLATFORM.ANDROID.stringsXml).toString();
+
+ // strip non-default value
+ strings = strings.replace(new RegExp('<string name="google_app_id">([^\@<]+?)</string>', 'i'), '');
+
+ // strip non-default value
+ strings = strings.replace(new RegExp('<string name="google_api_key">([^\@<]+?)</string>', 'i'), '');
+
+ // 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;
+ }
+ }
+}
+
+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 directoryExists(path) {
+ try {
+ return fs.statSync(path).isDirectory();
+ } catch (e) {
+ return false;
+ }
+}
diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePlugin.java b/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePlugin.java new file mode 100755 index 00000000..7e4431df --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePlugin.java @@ -0,0 +1,601 @@ +package org.apache.cordova.firebase; + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.support.v4.app.NotificationManagerCompat; +import android.util.Base64; +import android.util.Log; +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.OnFailureListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.analytics.FirebaseAnalytics; +import com.google.firebase.iid.FirebaseInstanceId; +import com.google.firebase.messaging.FirebaseMessaging; +import com.google.firebase.remoteconfig.FirebaseRemoteConfig; +import com.google.firebase.remoteconfig.FirebaseRemoteConfigInfo; +import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; +import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue; +import com.google.firebase.crash.FirebaseCrash; +import me.leolin.shortcutbadger.ShortcutBadger; +import org.apache.cordova.CallbackContext; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.PluginResult; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +public class FirebasePlugin extends CordovaPlugin { + + private FirebaseAnalytics mFirebaseAnalytics; + private final String TAG = "FirebasePlugin"; + protected static final String KEY = "badge"; + + private static boolean inBackground = true; + private static ArrayList<Bundle> notificationStack = null; + private static CallbackContext notificationCallbackContext; + private static CallbackContext tokenRefreshCallbackContext; + + @Override + protected void pluginInitialize() { + final Context context = this.cordova.getActivity().getApplicationContext(); + final Bundle extras = this.cordova.getActivity().getIntent().getExtras(); + this.cordova.getThreadPool().execute(new Runnable() { + public void run() { + Log.d(TAG, "Starting Firebase plugin"); + mFirebaseAnalytics = FirebaseAnalytics.getInstance(context); + mFirebaseAnalytics.setAnalyticsCollectionEnabled(true); + if (extras != null && extras.size() > 1) { + if (FirebasePlugin.notificationStack == null) { + FirebasePlugin.notificationStack = new ArrayList<Bundle>(); + } + if (extras.containsKey("google.message_id")) { + extras.putBoolean("tap", true); + notificationStack.add(extras); + } + } + } + }); + } + + @Override + public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { + if (action.equals("getInstanceId")) { + this.getInstanceId(callbackContext); + return true; + } else if (action.equals("getToken")) { + this.getToken(callbackContext); + return true; + } else if (action.equals("hasPermission")) { + this.hasPermission(callbackContext); + return true; + } else if (action.equals("setBadgeNumber")) { + this.setBadgeNumber(callbackContext, args.getInt(0)); + return true; + } else if (action.equals("getBadgeNumber")) { + this.getBadgeNumber(callbackContext); + return true; + } else if (action.equals("subscribe")) { + this.subscribe(callbackContext, args.getString(0)); + return true; + } else if (action.equals("unsubscribe")) { + this.unsubscribe(callbackContext, args.getString(0)); + return true; + } else if (action.equals("unregister")) { + this.unregister(callbackContext); + return true; + } else if (action.equals("onNotificationOpen")) { + this.onNotificationOpen(callbackContext); + return true; + } else if (action.equals("onTokenRefresh")) { + this.onTokenRefresh(callbackContext); + return true; + } else if (action.equals("logEvent")) { + this.logEvent(callbackContext, args.getString(0), args.getJSONObject(1)); + return true; + } else if (action.equals("logError")) { + this.logError(callbackContext, args.getString(0)); + return true; + } else if (action.equals("setScreenName")) { + this.setScreenName(callbackContext, args.getString(0)); + return true; + } else if (action.equals("setUserId")) { + this.setUserId(callbackContext, args.getString(0)); + return true; + } else if (action.equals("setUserProperty")) { + this.setUserProperty(callbackContext, args.getString(0), args.getString(1)); + return true; + } else if (action.equals("activateFetched")) { + this.activateFetched(callbackContext); + return true; + } else if (action.equals("fetch")) { + if (args.length() > 0) this.fetch(callbackContext, args.getLong(0)); + else this.fetch(callbackContext); + return true; + } else if (action.equals("getByteArray")) { + if (args.length() > 1) this.getByteArray(callbackContext, args.getString(0), args.getString(1)); + else this.getByteArray(callbackContext, args.getString(0), null); + return true; + } else if (action.equals("getValue")) { + if (args.length() > 1) this.getValue(callbackContext, args.getString(0), args.getString(1)); + else this.getValue(callbackContext, args.getString(0), null); + return true; + } else if (action.equals("getInfo")) { + this.getInfo(callbackContext); + return true; + } else if (action.equals("setConfigSettings")) { + this.setConfigSettings(callbackContext, args.getJSONObject(0)); + return true; + } else if (action.equals("setDefaults")) { + if (args.length() > 1) this.setDefaults(callbackContext, args.getJSONObject(0), args.getString(1)); + else this.setDefaults(callbackContext, args.getJSONObject(0), null); + return true; + } + return false; + } + + @Override + public void onPause(boolean multitasking) { + FirebasePlugin.inBackground = true; + } + + @Override + public void onResume(boolean multitasking) { + FirebasePlugin.inBackground = false; + } + + @Override + public void onReset() { + FirebasePlugin.notificationCallbackContext = null; + FirebasePlugin.tokenRefreshCallbackContext = null; + } + + private void onNotificationOpen(final CallbackContext callbackContext) { + FirebasePlugin.notificationCallbackContext = callbackContext; + if (FirebasePlugin.notificationStack != null) { + for (Bundle bundle : FirebasePlugin.notificationStack) { + FirebasePlugin.sendNotification(bundle); + } + FirebasePlugin.notificationStack.clear(); + } + } + + private void onTokenRefresh(final CallbackContext callbackContext) { + FirebasePlugin.tokenRefreshCallbackContext = callbackContext; + + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + String currentToken = FirebaseInstanceId.getInstance().getToken(); + + if (currentToken != null) { + FirebasePlugin.sendToken(currentToken); + } + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + public static void sendNotification(Bundle bundle) { + if (!FirebasePlugin.hasNotificationsCallback()) { + if (FirebasePlugin.notificationStack == null) { + FirebasePlugin.notificationStack = new ArrayList<Bundle>(); + } + notificationStack.add(bundle); + return; + } + final CallbackContext callbackContext = FirebasePlugin.notificationCallbackContext; + if (callbackContext != null && bundle != null) { + JSONObject json = new JSONObject(); + Set<String> keys = bundle.keySet(); + for (String key : keys) { + try { + json.put(key, bundle.get(key)); + } catch (JSONException e) { + callbackContext.error(e.getMessage()); + return; + } + } + + PluginResult pluginresult = new PluginResult(PluginResult.Status.OK, json); + pluginresult.setKeepCallback(true); + callbackContext.sendPluginResult(pluginresult); + } + } + + public static void sendToken(String token) { + if (FirebasePlugin.tokenRefreshCallbackContext == null) { + return; + } + final CallbackContext callbackContext = FirebasePlugin.tokenRefreshCallbackContext; + if (callbackContext != null && token != null) { + PluginResult pluginresult = new PluginResult(PluginResult.Status.OK, token); + pluginresult.setKeepCallback(true); + callbackContext.sendPluginResult(pluginresult); + } + } + + public static boolean inBackground() { + return FirebasePlugin.inBackground; + } + + public static boolean hasNotificationsCallback() { + return FirebasePlugin.notificationCallbackContext != null; + } + + @Override + public void onNewIntent(Intent intent) { + super.onNewIntent(intent); + final Bundle data = intent.getExtras(); + if (data != null && data.containsKey("google.message_id")) { + data.putBoolean("tap", true); + FirebasePlugin.sendNotification(data); + } + } + + // DEPRECTED - alias of getToken + private void getInstanceId(final CallbackContext callbackContext) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + String token = FirebaseInstanceId.getInstance().getToken(); + callbackContext.success(token); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void getToken(final CallbackContext callbackContext) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + String token = FirebaseInstanceId.getInstance().getToken(); + callbackContext.success(token); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void hasPermission(final CallbackContext callbackContext) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + Context context = cordova.getActivity(); + NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context); + boolean areNotificationsEnabled = notificationManagerCompat.areNotificationsEnabled(); + JSONObject object = new JSONObject(); + object.put("isEnabled", areNotificationsEnabled); + callbackContext.success(object); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void setBadgeNumber(final CallbackContext callbackContext, final int number) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + Context context = cordova.getActivity(); + SharedPreferences.Editor editor = context.getSharedPreferences(KEY, Context.MODE_PRIVATE).edit(); + editor.putInt(KEY, number); + editor.apply(); + ShortcutBadger.applyCount(context, number); + callbackContext.success(); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void getBadgeNumber(final CallbackContext callbackContext) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + Context context = cordova.getActivity(); + SharedPreferences settings = context.getSharedPreferences(KEY, Context.MODE_PRIVATE); + int number = settings.getInt(KEY, 0); + callbackContext.success(number); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void subscribe(final CallbackContext callbackContext, final String topic) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + FirebaseMessaging.getInstance().subscribeToTopic(topic); + callbackContext.success(); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void unsubscribe(final CallbackContext callbackContext, final String topic) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + FirebaseMessaging.getInstance().unsubscribeFromTopic(topic); + callbackContext.success(); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void unregister(final CallbackContext callbackContext) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + FirebaseInstanceId.getInstance().deleteInstanceId(); + String currentToken = FirebaseInstanceId.getInstance().getToken(); + if (currentToken != null) { + FirebasePlugin.sendToken(currentToken); + } + callbackContext.success(); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void logEvent(final CallbackContext callbackContext, final String name, final JSONObject params) throws JSONException { + final Bundle bundle = new Bundle(); + Iterator iter = params.keys(); + while (iter.hasNext()) { + String key = (String) iter.next(); + Object value = params.get(key); + + if (value instanceof Integer || value instanceof Double) { + bundle.putFloat(key, ((Number) value).floatValue()); + } else { + bundle.putString(key, value.toString()); + } + } + + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + mFirebaseAnalytics.logEvent(name, bundle); + callbackContext.success(); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void logError(final CallbackContext callbackContext, final String message) throws JSONException { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + FirebaseCrash.report(new Exception(message)); + callbackContext.success(1); + } catch (Exception e) { + FirebaseCrash.log(e.getMessage()); + e.printStackTrace(); + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void setScreenName(final CallbackContext callbackContext, final String name) { + // This must be called on the main thread + cordova.getActivity().runOnUiThread(new Runnable() { + public void run() { + try { + mFirebaseAnalytics.setCurrentScreen(cordova.getActivity(), name, null); + callbackContext.success(); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void setUserId(final CallbackContext callbackContext, final String id) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + mFirebaseAnalytics.setUserId(id); + callbackContext.success(); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void setUserProperty(final CallbackContext callbackContext, final String name, final String value) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + mFirebaseAnalytics.setUserProperty(name, value); + callbackContext.success(); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void activateFetched(final CallbackContext callbackContext) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + final boolean activated = FirebaseRemoteConfig.getInstance().activateFetched(); + callbackContext.success(String.valueOf(activated)); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void fetch(CallbackContext callbackContext) { + fetch(callbackContext, FirebaseRemoteConfig.getInstance().fetch()); + } + + private void fetch(CallbackContext callbackContext, long cacheExpirationSeconds) { + fetch(callbackContext, FirebaseRemoteConfig.getInstance().fetch(cacheExpirationSeconds)); + } + + private void fetch(final CallbackContext callbackContext, final Task<Void> task) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + task.addOnCompleteListener(new OnCompleteListener<Void>() { + @Override + public void onComplete(Task<Void> task) { + callbackContext.success(); + } + }).addOnFailureListener(new OnFailureListener() { + @Override + public void onFailure(Exception e) { + callbackContext.error(e.getMessage()); + } + }); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void getByteArray(final CallbackContext callbackContext, final String key, final String namespace) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + byte[] bytes = namespace == null ? FirebaseRemoteConfig.getInstance().getByteArray(key) + : FirebaseRemoteConfig.getInstance().getByteArray(key, namespace); + JSONObject object = new JSONObject(); + object.put("base64", Base64.encodeToString(bytes, Base64.DEFAULT)); + object.put("array", new JSONArray(bytes)); + callbackContext.success(object); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void getValue(final CallbackContext callbackContext, final String key, final String namespace) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + FirebaseRemoteConfigValue value = namespace == null ? FirebaseRemoteConfig.getInstance().getValue(key) + : FirebaseRemoteConfig.getInstance().getValue(key, namespace); + callbackContext.success(value.asString()); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void getInfo(final CallbackContext callbackContext) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + FirebaseRemoteConfigInfo remoteConfigInfo = FirebaseRemoteConfig.getInstance().getInfo(); + JSONObject info = new JSONObject(); + + JSONObject settings = new JSONObject(); + settings.put("developerModeEnabled", remoteConfigInfo.getConfigSettings().isDeveloperModeEnabled()); + info.put("configSettings", settings); + + info.put("fetchTimeMillis", remoteConfigInfo.getFetchTimeMillis()); + info.put("lastFetchStatus", remoteConfigInfo.getLastFetchStatus()); + + callbackContext.success(info); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void setConfigSettings(final CallbackContext callbackContext, final JSONObject config) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + boolean devMode = config.getBoolean("developerModeEnabled"); + FirebaseRemoteConfigSettings.Builder settings = new FirebaseRemoteConfigSettings.Builder() + .setDeveloperModeEnabled(devMode); + FirebaseRemoteConfig.getInstance().setConfigSettings(settings.build()); + callbackContext.success(); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private void setDefaults(final CallbackContext callbackContext, final JSONObject defaults, final String namespace) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + if (namespace == null) + FirebaseRemoteConfig.getInstance().setDefaults(defaultsToMap(defaults)); + else + FirebaseRemoteConfig.getInstance().setDefaults(defaultsToMap(defaults), namespace); + callbackContext.success(); + } catch (Exception e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + + private static Map<String, Object> defaultsToMap(JSONObject object) throws JSONException { + final Map<String, Object> map = new HashMap<String, Object>(); + + for (Iterator<String> keys = object.keys(); keys.hasNext(); ) { + String key = keys.next(); + Object value = object.get(key); + + if (value instanceof Integer) { + //setDefaults() should take Longs + value = new Long((Integer) value); + } else if (value instanceof JSONArray) { + JSONArray array = (JSONArray) value; + if (array.length() == 1 && array.get(0) instanceof String) { + //parse byte[] as Base64 String + value = Base64.decode(array.getString(0), Base64.DEFAULT); + } else { + //parse byte[] as numeric array + byte[] bytes = new byte[array.length()]; + for (int i = 0; i < array.length(); i++) + bytes[i] = (byte) array.getInt(i); + value = bytes; + } + } + + map.put(key, value); + } + return map; + } +} diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginInstanceIDService.java b/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginInstanceIDService.java new file mode 100755 index 00000000..96140f02 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginInstanceIDService.java @@ -0,0 +1,26 @@ +package org.apache.cordova.firebase; + +import android.util.Log; + +import com.google.firebase.iid.FirebaseInstanceId; +import com.google.firebase.iid.FirebaseInstanceIdService; + + +public class FirebasePluginInstanceIDService extends FirebaseInstanceIdService { + + private static final String TAG = "FirebasePlugin"; + + /** + * Called if InstanceID token is updated. This may occur if the security of + * the previous token had been compromised. Note that this is called when the InstanceID token + * is initially generated so this is where you would retrieve the token. + */ + @Override + public void onTokenRefresh() { + // Get updated InstanceID token. + String refreshedToken = FirebaseInstanceId.getInstance().getToken(); + Log.d(TAG, "Refreshed token: " + refreshedToken); + + FirebasePlugin.sendToken(refreshedToken); + } +} diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginMessagingService.java b/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginMessagingService.java new file mode 100755 index 00000000..a42ce60e --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/android/FirebasePluginMessagingService.java @@ -0,0 +1,127 @@ +package org.apache.cordova.firebase; + +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.media.RingtoneManager; +import android.net.Uri; +import android.os.Bundle; +import android.support.v4.app.NotificationCompat; +import android.util.Log; +import android.app.Notification; +import android.text.TextUtils; + +import com.google.firebase.messaging.FirebaseMessagingService; +import com.google.firebase.messaging.RemoteMessage; + +import java.util.Map; +import java.util.Random; + +public class FirebasePluginMessagingService extends FirebaseMessagingService { + + private static final String TAG = "FirebasePlugin"; + + /** + * Called when message is received. + * + * @param remoteMessage Object representing the message received from Firebase Cloud Messaging. + */ + @Override + public void onMessageReceived(RemoteMessage remoteMessage) { + // [START_EXCLUDE] + // There are two types of messages data messages and notification messages. Data messages are handled + // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type + // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app + // is in the foreground. When the app is in the background an automatically generated notification is displayed. + // When the user taps on the notification they are returned to the app. Messages containing both notification + // and data payloads are treated as notification messages. The Firebase console always sends notification + // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options + // [END_EXCLUDE] + + // TODO(developer): Handle FCM messages here. + // Not getting messages here? See why this may be: https://goo.gl/39bRNJ + String title; + String text; + String id; + if (remoteMessage.getNotification() != null) { + title = remoteMessage.getNotification().getTitle(); + text = remoteMessage.getNotification().getBody(); + id = remoteMessage.getMessageId(); + } else { + title = remoteMessage.getData().get("title"); + text = remoteMessage.getData().get("text"); + id = remoteMessage.getData().get("id"); + } + + if(TextUtils.isEmpty(id)){ + Random rand = new Random(); + int n = rand.nextInt(50) + 1; + id = Integer.toString(n); + } + + Log.d(TAG, "From: " + remoteMessage.getFrom()); + Log.d(TAG, "Notification Message id: " + id); + Log.d(TAG, "Notification Message Title: " + title); + Log.d(TAG, "Notification Message Body/Text: " + text); + + // TODO: Add option to developer to configure if show notification when app on foreground + if (!TextUtils.isEmpty(text) || !TextUtils.isEmpty(title) || (!remoteMessage.getData().isEmpty())) { + boolean showNotification = (FirebasePlugin.inBackground() || !FirebasePlugin.hasNotificationsCallback()) && (!TextUtils.isEmpty(text) || !TextUtils.isEmpty(title)); + sendNotification(id, title, text, remoteMessage.getData(), showNotification); + } + } + + private void sendNotification(String id, String title, String messageBody, Map<String, String> data, boolean showNotification) { + Bundle bundle = new Bundle(); + for (String key : data.keySet()) { + bundle.putString(key, data.get(key)); + } + if (showNotification) { + Intent intent = new Intent(this, OnNotificationOpenReceiver.class); + intent.putExtras(bundle); + PendingIntent pendingIntent = PendingIntent.getBroadcast(this, id.hashCode(), intent, + PendingIntent.FLAG_UPDATE_CURRENT); + + Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) + .setContentTitle(title) + .setContentText(messageBody) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) + .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody)) + .setAutoCancel(true) + .setSound(defaultSoundUri) + .setContentIntent(pendingIntent); + + int resID = getResources().getIdentifier("notification_icon", "drawable", getPackageName()); + if (resID != 0) { + notificationBuilder.setSmallIcon(resID); + } else { + notificationBuilder.setSmallIcon(getApplicationInfo().icon); + } + + if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) + { + int accentID = getResources().getIdentifier("accent", "color", getPackageName()); + notificationBuilder.setColor(getResources().getColor(accentID, null)); + } + + Notification notification = notificationBuilder.build(); + if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP){ + int iconID = android.R.id.icon; + int notiID = getResources().getIdentifier("notification_big", "drawable", getPackageName()); + if (notification.contentView != null) { + notification.contentView.setImageViewResource(iconID, notiID); + } + } + NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + notificationManager.notify(id.hashCode(), notification); + } else { + bundle.putBoolean("tap", false); + bundle.putString("title", title); + bundle.putString("body", messageBody); + FirebasePlugin.sendNotification(bundle); + } + } +} diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/android/OnNotificationOpenReceiver.java b/StoneIsland/plugins/cordova-plugin-firebase/src/android/OnNotificationOpenReceiver.java new file mode 100644 index 00000000..a7f63757 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/android/OnNotificationOpenReceiver.java @@ -0,0 +1,24 @@ +package org.apache.cordova.firebase; + +import android.app.PendingIntent; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.os.Bundle; + +public class OnNotificationOpenReceiver extends BroadcastReceiver { + + @Override + public void onReceive(Context context, Intent intent) { + PackageManager pm = context.getPackageManager(); + Intent launchIntent = pm.getLaunchIntentForPackage(context.getPackageName()); + + launchIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); + Bundle data = intent.getExtras(); + data.putBoolean("tap", true); + FirebasePlugin.sendNotification(data); + launchIntent.putExtras(data); + context.startActivity(launchIntent); + } +} diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/android/build-extras.gradle b/StoneIsland/plugins/cordova-plugin-firebase/src/android/build-extras.gradle new file mode 100755 index 00000000..67b387f5 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/android/build-extras.gradle @@ -0,0 +1 @@ +apply plugin: 'com.google.gms.google-services'
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/android/build.gradle b/StoneIsland/plugins/cordova-plugin-firebase/src/android/build.gradle new file mode 100755 index 00000000..d5cb4edd --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/android/build.gradle @@ -0,0 +1,15 @@ +buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.google.gms:google-services:3.0.0'
+ }
+}
+repositories {
+ mavenCentral()
+}
+dependencies {
+ compile 'me.leolin:ShortcutBadger:1.1.4@aar'
+ compile 'com.google.firebase:firebase-crash:+'
+}
diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/android/colors.xml b/StoneIsland/plugins/cordova-plugin-firebase/src/android/colors.xml new file mode 100644 index 00000000..6f1665a5 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/android/colors.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="primary">#FFFFFF00</color> + <color name="primary_dark">#FF220022</color> + <color name="accent">#FF00FFFF</color> +</resources>
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/android/google-services.json b/StoneIsland/plugins/cordova-plugin-firebase/src/android/google-services.json new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/android/google-services.json diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/AppDelegate+FirebasePlugin.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/AppDelegate+FirebasePlugin.h new file mode 100755 index 00000000..210cbb65 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/AppDelegate+FirebasePlugin.h @@ -0,0 +1,5 @@ +#import "AppDelegate.h"
+
+@interface AppDelegate (FirebasePlugin)
+@property (nonatomic, strong) NSNumber *applicationInBackground;
+@end
diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/AppDelegate+FirebasePlugin.m b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/AppDelegate+FirebasePlugin.m new file mode 100755 index 00000000..c4c45778 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/AppDelegate+FirebasePlugin.m @@ -0,0 +1,132 @@ +#import "AppDelegate+FirebasePlugin.h"
+#import "FirebasePlugin.h"
+#import "Firebase.h"
+#import <objc/runtime.h>
+
+#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+@import UserNotifications;
+#endif
+
+// Implement UNUserNotificationCenterDelegate to receive display notification via APNS for devices
+// running iOS 10 and above. Implement FIRMessagingDelegate to receive data message via FCM for
+// devices running iOS 10 and above.
+#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+@interface AppDelegate () <UNUserNotificationCenterDelegate, FIRMessagingDelegate>
+@end
+#endif
+
+#define kApplicationInBackgroundKey @"applicationInBackground"
+
+@implementation AppDelegate (FirebasePlugin)
+
++ (void)load {
+ Method original = class_getInstanceMethod(self, @selector(application:didFinishLaunchingWithOptions:));
+ Method swizzled = class_getInstanceMethod(self, @selector(application:swizzledDidFinishLaunchingWithOptions:));
+ method_exchangeImplementations(original, swizzled);
+}
+
+- (void)setApplicationInBackground:(NSNumber *)applicationInBackground {
+ objc_setAssociatedObject(self, kApplicationInBackgroundKey, applicationInBackground, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+- (NSNumber *)applicationInBackground {
+ return objc_getAssociatedObject(self, kApplicationInBackgroundKey);
+}
+
+- (BOOL)application:(UIApplication *)application swizzledDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ [self application:application swizzledDidFinishLaunchingWithOptions:launchOptions];
+
+ if(![FIRApp defaultApp]) {
+ [FIRApp configure];
+ }
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tokenRefreshNotification:)
+ name:kFIRInstanceIDTokenRefreshNotification object:nil];
+
+ self.applicationInBackground = @(YES);
+
+ return YES;
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ [self connectToFcm];
+ self.applicationInBackground = @(NO);
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ [[FIRMessaging messaging] disconnect];
+ self.applicationInBackground = @(YES);
+ NSLog(@"Disconnected from FCM");
+}
+
+- (void)tokenRefreshNotification:(NSNotification *)notification {
+ // Note that this callback will be fired everytime a new token is generated, including the first
+ // time. So if you need to retrieve the token as soon as it is available this is where that
+ // should be done.
+ NSString *refreshedToken = [[FIRInstanceID instanceID] token];
+ NSLog(@"InstanceID token: %@", refreshedToken);
+
+ // Connect to FCM since connection may have failed when attempted before having a token.
+ [self connectToFcm];
+
+ [FirebasePlugin.firebasePlugin sendToken:refreshedToken];
+}
+
+- (void)connectToFcm {
+ [[FIRMessaging messaging] connectWithCompletion:^(NSError * _Nullable error) {
+ if (error != nil) {
+ NSLog(@"Unable to connect to FCM. %@", error);
+ } else {
+ NSLog(@"Connected to FCM.");
+ NSString *refreshedToken = [[FIRInstanceID instanceID] token];
+ NSLog(@"InstanceID token: %@", refreshedToken);
+ }
+ }];
+}
+
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
+ NSDictionary *mutableUserInfo = [userInfo mutableCopy];
+
+ [mutableUserInfo setValue:self.applicationInBackground forKey:@"tap"];
+
+ // Pring full message.
+ NSLog(@"%@", mutableUserInfo);
+
+ [FirebasePlugin.firebasePlugin sendNotification:mutableUserInfo];
+}
+
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
+ fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
+
+ NSDictionary *mutableUserInfo = [userInfo mutableCopy];
+
+ [mutableUserInfo setValue:self.applicationInBackground forKey:@"tap"];
+
+ // Pring full message.
+ NSLog(@"%@", mutableUserInfo);
+
+ [FirebasePlugin.firebasePlugin sendNotification:mutableUserInfo];
+}
+
+#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+- (void)userNotificationCenter:(UNUserNotificationCenter *)center
+ willPresentNotification:(UNNotification *)notification
+ withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
+ NSDictionary *mutableUserInfo = [notification.request.content.userInfo mutableCopy];
+
+ [mutableUserInfo setValue:self.applicationInBackground forKey:@"tap"];
+
+ // Pring full message.
+ NSLog(@"%@", mutableUserInfo);
+
+ [FirebasePlugin.firebasePlugin sendNotification:mutableUserInfo];
+}
+
+// Receive data message on iOS 10 devices.
+- (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage {
+ // Print full message
+ NSLog(@"%@", [remoteMessage appData]);
+}
+#endif
+
+@end
diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/FirebaseAnalytics b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/FirebaseAnalytics Binary files differnew file mode 100755 index 00000000..61f61cd1 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/FirebaseAnalytics diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h new file mode 100755 index 00000000..e3ff4c12 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h @@ -0,0 +1,57 @@ +#import <Foundation/Foundation.h> + +#import "FIRAnalytics.h" + +/** + * Provides App Delegate handlers to be used in your App Delegate. + * + * To save time integrating Firebase Analytics in an application, Firebase Analytics does not + * require delegation implementation from the AppDelegate. Instead this is automatically done by + * Firebase Analytics. Should you choose instead to delegate manually, you can turn off the App + * Delegate Proxy by adding FirebaseAppDelegateProxyEnabled into your app's Info.plist and setting + * it to NO, and adding the methods in this category to corresponding delegation handlers. + * + * To handle Universal Links, you must return YES in + * [UIApplicationDelegate application:didFinishLaunchingWithOptions:]. + */ +@interface FIRAnalytics (AppDelegate) + +/** + * Handles events related to a URL session that are waiting to be processed. + * + * For optimal use of Firebase Analytics, call this method from the + * [UIApplicationDelegate application:handleEventsForBackgroundURLSession:completionHandler] + * method of the app delegate in your app. + * + * @param identifier The identifier of the URL session requiring attention. + * @param completionHandler The completion handler to call when you finish processing the events. + * Calling this completion handler lets the system know that your app's user interface is + * updated and a new snapshot can be taken. + */ ++ (void)handleEventsForBackgroundURLSession:(NSString *)identifier + completionHandler:(void (^)(void))completionHandler; + +/** + * Handles the event when the app is launched by a URL. + * + * Call this method from [UIApplicationDelegate application:openURL:options:] (on iOS 9.0 and + * above), or [UIApplicationDelegate application:openURL:sourceApplication:annotation:] (on iOS 8.x + * and below) in your app. + * + * @param url The URL resource to open. This resource can be a network resource or a file. + */ ++ (void)handleOpenURL:(NSURL *)url; + +/** + * Handles the event when the app receives data associated with user activity that includes a + * Universal Link (on iOS 9.0 and above). + * + * Call this method from [UIApplication continueUserActivity:restorationHandler:] in your app + * delegate (on iOS 9.0 and above). + * + * @param userActivity The activity object containing the data associated with the task the user + * was performing. + */ ++ (void)handleUserActivity:(id)userActivity; + +@end diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRAnalytics.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRAnalytics.h new file mode 100755 index 00000000..f5023f57 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRAnalytics.h @@ -0,0 +1,102 @@ +#import <Foundation/Foundation.h> + +#import "FIREventNames.h" +#import "FIRParameterNames.h" +#import "FIRUserPropertyNames.h" + +NS_ASSUME_NONNULL_BEGIN + +/// The top level Firebase Analytics singleton that provides methods for logging events and setting +/// user properties. See <a href="http://goo.gl/gz8SLz">the developer guides</a> for general +/// information on using Firebase Analytics in your apps. +@interface FIRAnalytics : NSObject + +/// Logs an app event. The event can have up to 25 parameters. Events with the same name must have +/// the same parameters. Up to 500 event names are supported. Using predefined events and/or +/// parameters is recommended for optimal reporting. +/// +/// The following event names are reserved and cannot be used: +/// <ul> +/// <li>app_clear_data</li> +/// <li>app_remove</li> +/// <li>app_update</li> +/// <li>error</li> +/// <li>first_open</li> +/// <li>in_app_purchase</li> +/// <li>notification_dismiss</li> +/// <li>notification_foreground</li> +/// <li>notification_open</li> +/// <li>notification_receive</li> +/// <li>os_update</li> +/// <li>session_start</li> +/// <li>user_engagement</li> +/// </ul> +/// +/// @param name The name of the event. Should contain 1 to 40 alphanumeric characters or +/// underscores. The name must start with an alphabetic character. Some event names are +/// reserved. See FIREventNames.h for the list of reserved event names. The "firebase_" prefix +/// is reserved and should not be used. Note that event names are case-sensitive and that +/// logging two events whose names differ only in case will result in two distinct events. +/// @param parameters The dictionary of event parameters. Passing nil indicates that the event has +/// no parameters. Parameter names can be up to 40 characters long and must start with an +/// alphabetic character and contain only alphanumeric characters and underscores. Only NSString +/// and NSNumber (signed 64-bit integer and 64-bit floating-point number) parameter types are +/// supported. NSString parameter values can be up to 100 characters long. The "firebase_" +/// prefix is reserved and should not be used for parameter names. ++ (void)logEventWithName:(NSString *)name + parameters:(nullable NSDictionary<NSString *, NSObject *> *)parameters; + +/// Sets a user property to a given value. Up to 25 user property names are supported. Once set, +/// user property values persist throughout the app lifecycle and across sessions. +/// +/// The following user property names are reserved and cannot be used: +/// <ul> +/// <li>first_open_time</li> +/// <li>last_deep_link_referrer</li> +/// <li>user_id</li> +/// </ul> +/// +/// @param value The value of the user property. Values can be up to 36 characters long. Setting the +/// value to nil removes the user property. +/// @param name The name of the user property to set. Should contain 1 to 24 alphanumeric characters +/// or underscores and must start with an alphabetic character. The "firebase_" prefix is +/// reserved and should not be used for user property names. ++ (void)setUserPropertyString:(nullable NSString *)value forName:(NSString *)name; + +/// Sets the user ID property. This feature must be used in accordance with +/// <a href="https://www.google.com/policies/privacy">Google's Privacy Policy</a> +/// +/// @param userID The user ID to ascribe to the user of this app on this device, which must be +/// non-empty and no more than 36 characters long. Setting userID to nil removes the user ID. ++ (void)setUserID:(nullable NSString *)userID; + +/// Sets the current screen name, which specifies the current visual context in your app. This helps +/// identify the areas in your app where users spend their time and how they interact with your app. +/// +/// Note that screen reporting is enabled automatically and records the class name of the current +/// UIViewController for you without requiring you to call this method. If you implement +/// viewDidAppear in your UIViewController but do not call [super viewDidAppear:], that screen class +/// will not be automatically tracked. The class name can optionally be overridden by calling this +/// method in the viewDidAppear callback of your UIViewController and specifying the +/// screenClassOverride parameter. +/// +/// If your app does not use a distinct UIViewController for each screen, you should call this +/// method and specify a distinct screenName each time a new screen is presented to the user. +/// +/// The screen name and screen class remain in effect until the current UIViewController changes or +/// a new call to setScreenName:screenClass: is made. +/// +/// @param screenName The name of the current screen. Should contain 1 to 100 characters. Set to nil +/// to clear the current screen name. +/// @param screenClassOverride The name of the screen class. Should contain 1 to 100 characters. By +/// default this is the class name of the current UIViewController. Set to nil to revert to the +/// default class name. ++ (void)setScreenName:(nullable NSString *)screenName + screenClass:(nullable NSString *)screenClassOverride; + +/// The unique ID for this instance of the application. ++ (NSString *)appInstanceID; + +@end + +NS_ASSUME_NONNULL_END diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h new file mode 100755 index 00000000..dc227a4c --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h @@ -0,0 +1 @@ +#import <FirebaseCore/FIRAnalyticsConfiguration.h> diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRApp.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRApp.h new file mode 100755 index 00000000..de24da17 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRApp.h @@ -0,0 +1 @@ +#import <FirebaseCore/FIRApp.h> diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRConfiguration.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRConfiguration.h new file mode 100755 index 00000000..be2ff7bf --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRConfiguration.h @@ -0,0 +1 @@ +#import <FirebaseCore/FIRConfiguration.h> diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIREventNames.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIREventNames.h new file mode 100755 index 00000000..3b40eecf --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIREventNames.h @@ -0,0 +1,336 @@ +/// @file FIREventNames.h +/// +/// Predefined event names. +/// +/// An Event is an important occurrence in your app that you want to measure. You can report up to +/// 500 different types of Events per app and you can associate up to 25 unique parameters with each +/// Event type. Some common events are suggested below, but you may also choose to specify custom +/// Event types that are associated with your specific app. Each event type is identified by a +/// unique name. Event names can be up to 40 characters long, may only contain alphanumeric +/// characters and underscores ("_"), and must start with an alphabetic character. The "firebase_" +/// prefix is reserved and should not be used. + +/// Add Payment Info event. This event signifies that a user has submitted their payment information +/// to your app. +static NSString *const kFIREventAddPaymentInfo = @"add_payment_info"; + +/// E-Commerce Add To Cart event. This event signifies that an item was added to a cart for +/// purchase. Add this event to a funnel with kFIREventEcommercePurchase to gauge the effectiveness +/// of your checkout process. Note: If you supply the @c kFIRParameterValue parameter, you must +/// also supply the @c kFIRParameterCurrency parameter so that revenue metrics can be computed +/// accurately. Params: +/// +/// <ul> +/// <li>@c kFIRParameterQuantity (signed 64-bit integer as NSNumber)</li> +/// <li>@c kFIRParameterItemID (NSString)</li> +/// <li>@c kFIRParameterItemName (NSString)</li> +/// <li>@c kFIRParameterItemCategory (NSString)</li> +/// <li>@c kFIRParameterItemLocationID (NSString) (optional)</li> +/// <li>@c kFIRParameterPrice (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> +/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> +/// <li>@c kFIRParameterDestination (NSString) (optional)</li> +/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> +/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> +/// </ul> +static NSString *const kFIREventAddToCart = @"add_to_cart"; + +/// E-Commerce Add To Wishlist event. This event signifies that an item was added to a wishlist. +/// Use this event to identify popular gift items in your app. Note: If you supply the +/// @c kFIRParameterValue parameter, you must also supply the @c kFIRParameterCurrency +/// parameter so that revenue metrics can be computed accurately. Params: +/// +/// <ul> +/// <li>@c kFIRParameterQuantity (signed 64-bit integer as NSNumber)</li> +/// <li>@c kFIRParameterItemID (NSString)</li> +/// <li>@c kFIRParameterItemName (NSString)</li> +/// <li>@c kFIRParameterItemCategory (NSString)</li> +/// <li>@c kFIRParameterItemLocationID (NSString) (optional)</li> +/// <li>@c kFIRParameterPrice (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> +/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> +/// </ul> +static NSString *const kFIREventAddToWishlist = @"add_to_wishlist"; + +/// App Open event. By logging this event when an App is moved to the foreground, developers can +/// understand how often users leave and return during the course of a Session. Although Sessions +/// are automatically reported, this event can provide further clarification around the continuous +/// engagement of app-users. +static NSString *const kFIREventAppOpen = @"app_open"; + +/// E-Commerce Begin Checkout event. This event signifies that a user has begun the process of +/// checking out. Add this event to a funnel with your kFIREventEcommercePurchase event to gauge the +/// effectiveness of your checkout process. Note: If you supply the @c kFIRParameterValue +/// parameter, you must also supply the @c kFIRParameterCurrency parameter so that revenue +/// metrics can be computed accurately. Params: +/// +/// <ul> +/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> +/// <li>@c kFIRParameterTransactionID (NSString) (optional)</li> +/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> +/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> +/// <li>@c kFIRParameterNumberOfNights (signed 64-bit integer as NSNumber) (optional) for +/// hotel bookings</li> +/// <li>@c kFIRParameterNumberOfRooms (signed 64-bit integer as NSNumber) (optional) for +/// hotel bookings</li> +/// <li>@c kFIRParameterNumberOfPassengers (signed 64-bit integer as NSNumber) (optional) +/// for travel bookings</li> +/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> +/// <li>@c kFIRParameterDestination (NSString) (optional)</li> +/// <li>@c kFIRParameterTravelClass (NSString) (optional) for travel bookings</li> +/// </ul> +static NSString *const kFIREventBeginCheckout = @"begin_checkout"; + +/// Campaign Detail event. Log this event to supply the referral details of a re-engagement +/// campaign. Note: you must supply at least one of the required parameters kFIRParameterSource, +/// kFIRParameterMedium or kFIRParameterCampaign. Params: +/// +/// <ul> +/// <li>@c kFIRParameterSource (NSString)</li> +/// <li>@c kFIRParameterMedium (NSString)</li> +/// <li>@c kFIRParameterCampaign (NSString)</li> +/// <li>@c kFIRParameterTerm (NSString) (optional)</li> +/// <li>@c kFIRParameterContent (NSString) (optional)</li> +/// <li>@c kFIRParameterAdNetworkClickID (NSString) (optional)</li> +/// <li>@c kFIRParameterCP1 (NSString) (optional)</li> +/// </ul> +static NSString *const kFIREventCampaignDetails = @"campaign_details"; + +/// Earn Virtual Currency event. This event tracks the awarding of virtual currency in your app. Log +/// this along with @c kFIREventSpendVirtualCurrency to better understand your virtual economy. +/// Params: +/// +/// <ul> +/// <li>@c kFIRParameterVirtualCurrencyName (NSString)</li> +/// <li>@c kFIRParameterValue (signed 64-bit integer or double as NSNumber)</li> +/// </ul> +static NSString *const kFIREventEarnVirtualCurrency = @"earn_virtual_currency"; + +/// E-Commerce Purchase event. This event signifies that an item was purchased by a user. Note: +/// This is different from the in-app purchase event, which is reported automatically for App +/// Store-based apps. Note: If you supply the @c kFIRParameterValue parameter, you must also +/// supply the @c kFIRParameterCurrency parameter so that revenue metrics can be computed +/// accurately. Params: +/// +/// <ul> +/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> +/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterTransactionID (NSString) (optional)</li> +/// <li>@c kFIRParameterTax (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterShipping (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterCoupon (NSString) (optional)</li> +/// <li>@c kFIRParameterLocation (NSString) (optional)</li> +/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> +/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> +/// <li>@c kFIRParameterNumberOfNights (signed 64-bit integer as NSNumber) (optional) for +/// hotel bookings</li> +/// <li>@c kFIRParameterNumberOfRooms (signed 64-bit integer as NSNumber) (optional) for +/// hotel bookings</li> +/// <li>@c kFIRParameterNumberOfPassengers (signed 64-bit integer as NSNumber) (optional) +/// for travel bookings</li> +/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> +/// <li>@c kFIRParameterDestination (NSString) (optional)</li> +/// <li>@c kFIRParameterTravelClass (NSString) (optional) for travel bookings</li> +/// </ul> +static NSString *const kFIREventEcommercePurchase = @"ecommerce_purchase"; + +/// Generate Lead event. Log this event when a lead has been generated in the app to understand the +/// efficacy of your install and re-engagement campaigns. Note: If you supply the +/// @c kFIRParameterValue parameter, you must also supply the @c kFIRParameterCurrency +/// parameter so that revenue metrics can be computed accurately. Params: +/// +/// <ul> +/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> +/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> +/// </ul> +static NSString *const kFIREventGenerateLead = @"generate_lead"; + +/// Join Group event. Log this event when a user joins a group such as a guild, team or family. Use +/// this event to analyze how popular certain groups or social features are in your app. Params: +/// +/// <ul> +/// <li>@c kFIRParameterGroupID (NSString)</li> +/// </ul> +static NSString *const kFIREventJoinGroup = @"join_group"; + +/// Level Up event. This event signifies that a player has leveled up in your gaming app. It can +/// help you gauge the level distribution of your userbase and help you identify certain levels that +/// are difficult to pass. Params: +/// +/// <ul> +/// <li>@c kFIRParameterLevel (signed 64-bit integer as NSNumber)</li> +/// <li>@c kFIRParameterCharacter (NSString) (optional)</li> +/// </ul> +static NSString *const kFIREventLevelUp = @"level_up"; + +/// Login event. Apps with a login feature can report this event to signify that a user has logged +/// in. +static NSString *const kFIREventLogin = @"login"; + +/// Post Score event. Log this event when the user posts a score in your gaming app. This event can +/// help you understand how users are actually performing in your game and it can help you correlate +/// high scores with certain audiences or behaviors. Params: +/// +/// <ul> +/// <li>@c kFIRParameterScore (signed 64-bit integer as NSNumber)</li> +/// <li>@c kFIRParameterLevel (signed 64-bit integer as NSNumber) (optional)</li> +/// <li>@c kFIRParameterCharacter (NSString) (optional)</li> +/// </ul> +static NSString *const kFIREventPostScore = @"post_score"; + +/// Present Offer event. This event signifies that the app has presented a purchase offer to a user. +/// Add this event to a funnel with the kFIREventAddToCart and kFIREventEcommercePurchase to gauge +/// your conversion process. Note: If you supply the @c kFIRParameterValue parameter, you must +/// also supply the @c kFIRParameterCurrency parameter so that revenue metrics can be computed +/// accurately. Params: +/// +/// <ul> +/// <li>@c kFIRParameterQuantity (signed 64-bit integer as NSNumber)</li> +/// <li>@c kFIRParameterItemID (NSString)</li> +/// <li>@c kFIRParameterItemName (NSString)</li> +/// <li>@c kFIRParameterItemCategory (NSString)</li> +/// <li>@c kFIRParameterItemLocationID (NSString) (optional)</li> +/// <li>@c kFIRParameterPrice (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> +/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> +/// </ul> +static NSString *const kFIREventPresentOffer = @"present_offer"; + +/// E-Commerce Purchase Refund event. This event signifies that an item purchase was refunded. +/// Note: If you supply the @c kFIRParameterValue parameter, you must also supply the +/// @c kFIRParameterCurrency parameter so that revenue metrics can be computed accurately. +/// Params: +/// +/// <ul> +/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> +/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterTransactionID (NSString) (optional)</li> +/// </ul> +static NSString *const kFIREventPurchaseRefund = @"purchase_refund"; + +/// Search event. Apps that support search features can use this event to contextualize search +/// operations by supplying the appropriate, corresponding parameters. This event can help you +/// identify the most popular content in your app. Params: +/// +/// <ul> +/// <li>@c kFIRParameterSearchTerm (NSString)</li> +/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> +/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> +/// <li>@c kFIRParameterNumberOfNights (signed 64-bit integer as NSNumber) (optional) for +/// hotel bookings</li> +/// <li>@c kFIRParameterNumberOfRooms (signed 64-bit integer as NSNumber) (optional) for +/// hotel bookings</li> +/// <li>@c kFIRParameterNumberOfPassengers (signed 64-bit integer as NSNumber) (optional) +/// for travel bookings</li> +/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> +/// <li>@c kFIRParameterDestination (NSString) (optional)</li> +/// <li>@c kFIRParameterTravelClass (NSString) (optional) for travel bookings</li> +/// </ul> +static NSString *const kFIREventSearch = @"search"; + +/// Select Content event. This general purpose event signifies that a user has selected some content +/// of a certain type in an app. The content can be any object in your app. This event can help you +/// identify popular content and categories of content in your app. Params: +/// +/// <ul> +/// <li>@c kFIRParameterContentType (NSString)</li> +/// <li>@c kFIRParameterItemID (NSString)</li> +/// </ul> +static NSString *const kFIREventSelectContent = @"select_content"; + +/// Share event. Apps with social features can log the Share event to identify the most viral +/// content. Params: +/// +/// <ul> +/// <li>@c kFIRParameterContentType (NSString)</li> +/// <li>@c kFIRParameterItemID (NSString)</li> +/// </ul> +static NSString *const kFIREventShare = @"share"; + +/// Sign Up event. This event indicates that a user has signed up for an account in your app. The +/// parameter signifies the method by which the user signed up. Use this event to understand the +/// different behaviors between logged in and logged out users. Params: +/// +/// <ul> +/// <li>@c kFIRParameterSignUpMethod (NSString)</li> +/// </ul> +static NSString *const kFIREventSignUp = @"sign_up"; + +/// Spend Virtual Currency event. This event tracks the sale of virtual goods in your app and can +/// help you identify which virtual goods are the most popular objects of purchase. Params: +/// +/// <ul> +/// <li>@c kFIRParameterItemName (NSString)</li> +/// <li>@c kFIRParameterVirtualCurrencyName (NSString)</li> +/// <li>@c kFIRParameterValue (signed 64-bit integer or double as NSNumber)</li> +/// </ul> +static NSString *const kFIREventSpendVirtualCurrency = @"spend_virtual_currency"; + +/// Tutorial Begin event. This event signifies the start of the on-boarding process in your app. Use +/// this in a funnel with kFIREventTutorialComplete to understand how many users complete this +/// process and move on to the full app experience. +static NSString *const kFIREventTutorialBegin = @"tutorial_begin"; + +/// Tutorial End event. Use this event to signify the user's completion of your app's on-boarding +/// process. Add this to a funnel with kFIREventTutorialBegin to gauge the completion rate of your +/// on-boarding process. +static NSString *const kFIREventTutorialComplete = @"tutorial_complete"; + +/// Unlock Achievement event. Log this event when the user has unlocked an achievement in your +/// game. Since achievements generally represent the breadth of a gaming experience, this event can +/// help you understand how many users are experiencing all that your game has to offer. Params: +/// +/// <ul> +/// <li>@c kFIRParameterAchievementID (NSString)</li> +/// </ul> +static NSString *const kFIREventUnlockAchievement = @"unlock_achievement"; + +/// View Item event. This event signifies that some content was shown to the user. This content may +/// be a product, a webpage or just a simple image or text. Use the appropriate parameters to +/// contextualize the event. Use this event to discover the most popular items viewed in your app. +/// Note: If you supply the @c kFIRParameterValue parameter, you must also supply the +/// @c kFIRParameterCurrency parameter so that revenue metrics can be computed accurately. +/// Params: +/// +/// <ul> +/// <li>@c kFIRParameterItemID (NSString)</li> +/// <li>@c kFIRParameterItemName (NSString)</li> +/// <li>@c kFIRParameterItemCategory (NSString)</li> +/// <li>@c kFIRParameterItemLocationID (NSString) (optional)</li> +/// <li>@c kFIRParameterPrice (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterQuantity (signed 64-bit integer as NSNumber) (optional)</li> +/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> +/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> +/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> +/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> +/// <li>@c kFIRParameterFlightNumber (NSString) (optional) for travel bookings</li> +/// <li>@c kFIRParameterNumberOfPassengers (signed 64-bit integer as NSNumber) (optional) +/// for travel bookings</li> +/// <li>@c kFIRParameterNumberOfNights (signed 64-bit integer as NSNumber) (optional) for +/// travel bookings</li> +/// <li>@c kFIRParameterNumberOfRooms (signed 64-bit integer as NSNumber) (optional) for +/// travel bookings</li> +/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> +/// <li>@c kFIRParameterDestination (NSString) (optional)</li> +/// <li>@c kFIRParameterSearchTerm (NSString) (optional) for travel bookings</li> +/// <li>@c kFIRParameterTravelClass (NSString) (optional) for travel bookings</li> +/// </ul> +static NSString *const kFIREventViewItem = @"view_item"; + +/// View Item List event. Log this event when the user has been presented with a list of items of a +/// certain category. Params: +/// +/// <ul> +/// <li>@c kFIRParameterItemCategory (NSString)</li> +/// </ul> +static NSString *const kFIREventViewItemList = @"view_item_list"; + +/// View Search Results event. Log this event when the user has been presented with the results of a +/// search. Params: +/// +/// <ul> +/// <li>@c kFIRParameterSearchTerm (NSString)</li> +/// </ul> +static NSString *const kFIREventViewSearchResults = @"view_search_results"; diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIROptions.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIROptions.h new file mode 100755 index 00000000..126824b0 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIROptions.h @@ -0,0 +1 @@ +#import <FirebaseCore/FIROptions.h> diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRParameterNames.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRParameterNames.h new file mode 100755 index 00000000..a43e3473 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRParameterNames.h @@ -0,0 +1,369 @@ +/// @file FIRParameterNames.h +/// +/// Predefined event parameter names. +/// +/// Params supply information that contextualize Events. You can associate up to 25 unique Params +/// with each Event type. Some Params are suggested below for certain common Events, but you are +/// not limited to these. You may supply extra Params for suggested Events or custom Params for +/// Custom events. Param names can be up to 40 characters long, may only contain alphanumeric +/// characters and underscores ("_"), and must start with an alphabetic character. Param values can +/// be up to 100 characters long. The "firebase_" prefix is reserved and should not be used. + +/// Game achievement ID (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterAchievementID : @"10_matches_won", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterAchievementID = @"achievement_id"; + +/// Ad Network Click ID (NSString). Used for network-specific click IDs which vary in format. +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterAdNetworkClickID : @"1234567", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterAdNetworkClickID = @"aclid"; + +/// The individual campaign name, slogan, promo code, etc. Some networks have pre-defined macro to +/// capture campaign information, otherwise can be populated by developer. Highly Recommended +/// (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterCampaign : @"winter_promotion", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterCampaign = @"campaign"; + +/// Character used in game (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterCharacter : @"beat_boss", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterCharacter = @"character"; + +/// Campaign content (NSString). +static NSString *const kFIRParameterContent = @"content"; + +/// Type of content selected (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterContentType : @"news article", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterContentType = @"content_type"; + +/// Coupon code for a purchasable item (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterCoupon : @"zz123", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterCoupon = @"coupon"; + +/// Campaign custom parameter (NSString). Used as a method of capturing custom data in a campaign. +/// Use varies by network. +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterCP1 : @"custom_data", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterCP1 = @"cp1"; + +/// Purchase currency in 3-letter <a href="http://en.wikipedia.org/wiki/ISO_4217#Active_codes"> +/// ISO_4217</a> format (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterCurrency : @"USD", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterCurrency = @"currency"; + +/// Flight or Travel destination (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterDestination : @"Mountain View, CA", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterDestination = @"destination"; + +/// The arrival date, check-out date or rental end date for the item. This should be in +/// YYYY-MM-DD format (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterEndDate : @"2015-09-14", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterEndDate = @"end_date"; + +/// Flight number for travel events (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterFlightNumber : @"ZZ800", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterFlightNumber = @"flight_number"; + +/// Group/clan/guild ID (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterGroupID : @"g1", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterGroupID = @"group_id"; + +/// Item category (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterItemCategory : @"t-shirts", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterItemCategory = @"item_category"; + +/// Item ID (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterItemID : @"p7654", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterItemID = @"item_id"; + +/// The Google <a href="https://developers.google.com/places/place-id">Place ID</a> (NSString) that +/// corresponds to the associated item. Alternatively, you can supply your own custom Location ID. +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterItemLocationID : @"ChIJiyj437sx3YAR9kUWC8QkLzQ", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterItemLocationID = @"item_location_id"; + +/// Item name (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterItemName : @"abc", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterItemName = @"item_name"; + +/// Level in game (signed 64-bit integer as NSNumber). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterLevel : @(42), +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterLevel = @"level"; + +/// Location (NSString). The Google <a href="https://developers.google.com/places/place-id">Place ID +/// </a> that corresponds to the associated event. Alternatively, you can supply your own custom +/// Location ID. +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterLocation : @"ChIJiyj437sx3YAR9kUWC8QkLzQ", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterLocation = @"location"; + +/// The advertising or marketing medium, for example: cpc, banner, email, push. Highly recommended +/// (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterMedium : @"email", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterMedium = @"medium"; + +/// Number of nights staying at hotel (signed 64-bit integer as NSNumber). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterNumberOfNights : @(3), +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterNumberOfNights = @"number_of_nights"; + +/// Number of passengers traveling (signed 64-bit integer as NSNumber). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterNumberOfPassengers : @(11), +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterNumberOfPassengers = @"number_of_passengers"; + +/// Number of rooms for travel events (signed 64-bit integer as NSNumber). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterNumberOfRooms : @(2), +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterNumberOfRooms = @"number_of_rooms"; + +/// Flight or Travel origin (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterOrigin : @"Mountain View, CA", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterOrigin = @"origin"; + +/// Purchase price (double as NSNumber). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterPrice : @(1.0), +/// kFIRParameterCurrency : @"USD", // e.g. $1.00 USD +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterPrice = @"price"; + +/// Purchase quantity (signed 64-bit integer as NSNumber). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterQuantity : @(1), +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterQuantity = @"quantity"; + +/// Score in game (signed 64-bit integer as NSNumber). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterScore : @(4200), +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterScore = @"score"; + +/// The search string/keywords used (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterSearchTerm : @"periodic table", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterSearchTerm = @"search_term"; + +/// Shipping cost (double as NSNumber). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterShipping : @(9.50), +/// kFIRParameterCurrency : @"USD", // e.g. $9.50 USD +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterShipping = @"shipping"; + +/// Sign up method (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterSignUpMethod : @"google", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterSignUpMethod = @"sign_up_method"; + +/// The origin of your traffic, such as an Ad network (for example, google) or partner (urban +/// airship). Identify the advertiser, site, publication, etc. that is sending traffic to your +/// property. Highly recommended (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterSource : @"InMobi", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterSource = @"source"; + +/// The departure date, check-in date or rental start date for the item. This should be in +/// YYYY-MM-DD format (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterStartDate : @"2015-09-14", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterStartDate = @"start_date"; + +/// Tax amount (double as NSNumber). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterTax : @(1.0), +/// kFIRParameterCurrency : @"USD", // e.g. $1.00 USD +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterTax = @"tax"; + +/// If you're manually tagging keyword campaigns, you should use utm_term to specify the keyword +/// (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterTerm : @"game", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterTerm = @"term"; + +/// A single ID for a ecommerce group transaction (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterTransactionID : @"ab7236dd9823", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterTransactionID = @"transaction_id"; + +/// Travel class (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterTravelClass : @"business", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterTravelClass = @"travel_class"; + +/// A context-specific numeric value which is accumulated automatically for each event type. This is +/// a general purpose parameter that is useful for accumulating a key metric that pertains to an +/// event. Examples include revenue, distance, time and points. Value should be specified as signed +/// 64-bit integer or double as NSNumber. Notes: Values for pre-defined currency-related events +/// (such as @c kFIREventAddToCart) should be supplied using double as NSNumber and must be +/// accompanied by a @c kFIRParameterCurrency parameter. The valid range of accumulated values is +/// [-9,223,372,036,854.77, 9,223,372,036,854.77]. +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterValue : @(3.99), +/// kFIRParameterCurrency : @"USD", // e.g. $3.99 USD +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterValue = @"value"; + +/// Name of virtual currency type (NSString). +/// <pre> +/// NSDictionary *params = @{ +/// kFIRParameterVirtualCurrencyName : @"virtual_currency_name", +/// // ... +/// }; +/// </pre> +static NSString *const kFIRParameterVirtualCurrencyName = @"virtual_currency_name"; diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h new file mode 100755 index 00000000..54cf1c20 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h @@ -0,0 +1,13 @@ +/// @file FIRUserPropertyNames.h +/// +/// Predefined user property names. +/// +/// A UserProperty is an attribute that describes the app-user. By supplying UserProperties, you can +/// later analyze different behaviors of various segments of your userbase. You may supply up to 25 +/// unique UserProperties per app, and you can use the name and value of your choosing for each one. +/// UserProperty names can be up to 24 characters long, may only contain alphanumeric characters and +/// underscores ("_"), and must start with an alphabetic character. UserProperty values can be up to +/// 36 characters long. The "firebase_" prefix is reserved and should not be used. + +/// The method used to sign in. For example, "google", "facebook" or "twitter". +static NSString *const kFIRUserPropertySignUpMethod = @"sign_up_method"; diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h new file mode 100755 index 00000000..3142c97b --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h @@ -0,0 +1,9 @@ +#import "FIRAnalyticsConfiguration.h" +#import "FIRApp.h" +#import "FIRConfiguration.h" +#import "FIROptions.h" +#import "FIRAnalytics+AppDelegate.h" +#import "FIRAnalytics.h" +#import "FIREventNames.h" +#import "FIRParameterNames.h" +#import "FIRUserPropertyNames.h" diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Modules/module.modulemap b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Modules/module.modulemap new file mode 100755 index 00000000..c9bd66bc --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseAnalytics.framework/Modules/module.modulemap @@ -0,0 +1,10 @@ +framework module FirebaseAnalytics { + umbrella header "FirebaseAnalytics.h" + export * + module * { export *} + link "sqlite3" + link "z" + link framework "CoreGraphics" + link framework "Foundation" + link framework "UIKit" +}
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/FirebaseCore b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/FirebaseCore Binary files differnew file mode 100755 index 00000000..364c6d67 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/FirebaseCore diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h new file mode 100755 index 00000000..667d5a4b --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h @@ -0,0 +1,38 @@ +#import <Foundation/Foundation.h> + +/** + * This class provides configuration fields for Firebase Analytics. + */ +@interface FIRAnalyticsConfiguration : NSObject + +/** + * Returns the shared instance of FIRAnalyticsConfiguration. + */ ++ (FIRAnalyticsConfiguration *)sharedInstance; + +/** + * Sets the minimum engagement time in seconds required to start a new session. The default value + * is 10 seconds. + */ +- (void)setMinimumSessionInterval:(NSTimeInterval)minimumSessionInterval; + +/** + * Sets the interval of inactivity in seconds that terminates the current session. The default + * value is 1800 seconds (30 minutes). + */ +- (void)setSessionTimeoutInterval:(NSTimeInterval)sessionTimeoutInterval; + +/** + * Sets whether analytics collection is enabled for this app on this device. This setting is + * persisted across app sessions. By default it is enabled. + */ +- (void)setAnalyticsCollectionEnabled:(BOOL)analyticsCollectionEnabled; + +/** + * Deprecated. Sets whether measurement and reporting are enabled for this app on this device. By + * default they are enabled. + */ +- (void)setIsEnabled:(BOOL)isEnabled + DEPRECATED_MSG_ATTRIBUTE("Use setAnalyticsCollectionEnabled: instead."); + +@end diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRApp.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRApp.h new file mode 100755 index 00000000..263c4bef --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRApp.h @@ -0,0 +1,98 @@ +#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> + +@class FIROptions; + +NS_ASSUME_NONNULL_BEGIN + +/** A block that takes a BOOL and has no return value. */ +typedef void (^FIRAppVoidBoolCallback)(BOOL success); + +/** + * The entry point of Firebase SDKs. + * + * Initialize and configure FIRApp using +[FIRApp configure] + * or other customized ways as shown below. + * + * The logging system has two modes: default mode and debug mode. In default mode, only logs with + * log level Notice, Warning and Error will be sent to device. In debug mode, all logs will be sent + * to device. The log levels that Firebase uses are consistent with the ASL log levels. + * + * Enable debug mode by passing the -FIRDebugEnabled argument to the application. You can add this + * argument in the application's Xcode scheme. When debug mode is enabled via -FIRDebugEnabled, + * further executions of the application will also be in debug mode. In order to return to default + * mode, you must explicitly disable the debug mode with the application argument -FIRDebugDisabled. + * + * It is also possible to change the default logging level in code by calling setLoggerLevel: on + * the FIRConfiguration interface. + */ +@interface FIRApp : NSObject + +/** + * Configures a default Firebase app. Raises an exception if any configuration step fails. The + * default app is named "__FIRAPP_DEFAULT". This method should be called after the app is launched + * and before using Firebase services. This method is thread safe. + */ ++ (void)configure; + +/** + * Configures the default Firebase app with the provided options. The default app is named + * "__FIRAPP_DEFAULT". Raises an exception if any configuration step fails. This method is thread + * safe. + * + * @param options The Firebase application options used to configure the service. + */ ++ (void)configureWithOptions:(FIROptions *)options; + +/** + * Configures a Firebase app with the given name and options. Raises an exception if any + * configuration step fails. This method is thread safe. + * + * @param name The application's name given by the developer. The name should should only contain + Letters, Numbers and Underscore. + * @param options The Firebase application options used to configure the services. + */ ++ (void)configureWithName:(NSString *)name options:(FIROptions *)options; + +/** + * Returns the default app, or nil if the default app does not exist. + */ ++ (nullable FIRApp *)defaultApp NS_SWIFT_NAME(defaultApp()); + +/** + * Returns a previously created FIRApp instance with the given name, or nil if no such app exists. + * This method is thread safe. + */ ++ (nullable FIRApp *)appNamed:(NSString *)name; + +/** + * Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. This + * method is thread safe. + */ ++ (nullable NSDictionary *)allApps; + +/** + * Cleans up the current FIRApp, freeing associated data and returning its name to the pool for + * future use. This method is thread safe. + */ +- (void)deleteApp:(FIRAppVoidBoolCallback)completion; + +/** + * FIRApp instances should not be initialized directly. Call +[FIRApp configure], + * +[FIRApp configureWithOptions:], or +[FIRApp configureWithNames:options:] directly. + */ +- (instancetype)init NS_UNAVAILABLE; + +/** + * Gets the name of this app. + */ +@property(nonatomic, copy, readonly) NSString *name; + +/** + * Gets the options for this app. + */ +@property(nonatomic, readonly) FIROptions *options; + +@end + +NS_ASSUME_NONNULL_END diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRConfiguration.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRConfiguration.h new file mode 100755 index 00000000..a25647b4 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRConfiguration.h @@ -0,0 +1,52 @@ +#import <Foundation/Foundation.h> + +#import "FIRAnalyticsConfiguration.h" +#import "FIRLoggerLevel.h" + +/** + * The log levels used by FIRConfiguration. + */ +typedef NS_ENUM(NSInteger, FIRLogLevel) { + /** Error */ + kFIRLogLevelError __deprecated = 0, + /** Warning */ + kFIRLogLevelWarning __deprecated, + /** Info */ + kFIRLogLevelInfo __deprecated, + /** Debug */ + kFIRLogLevelDebug __deprecated, + /** Assert */ + kFIRLogLevelAssert __deprecated, + /** Max */ + kFIRLogLevelMax __deprecated = kFIRLogLevelAssert +} DEPRECATED_MSG_ATTRIBUTE( + "Use -FIRDebugEnabled and -FIRDebugDisabled or setLoggerLevel. See FIRApp.h for more details."); + +/** + * This interface provides global level properties that the developer can tweak, and the singleton + * of the Firebase Analytics configuration class. + */ +@interface FIRConfiguration : NSObject + +/** Returns the shared configuration object. */ ++ (FIRConfiguration *)sharedInstance; + +/** The configuration class for Firebase Analytics. */ +@property(nonatomic, readwrite) FIRAnalyticsConfiguration *analyticsConfiguration; + +/** Global log level. Defaults to kFIRLogLevelError. */ +@property(nonatomic, readwrite, assign) FIRLogLevel logLevel DEPRECATED_MSG_ATTRIBUTE( + "Use -FIRDebugEnabled and -FIRDebugDisabled or setLoggerLevel. See FIRApp.h for more details."); + +/** + * Sets the logging level for internal Firebase logging. Firebase will only log messages + * that are logged at or below loggerLevel. The messages are logged both to the Xcode + * console and to the device's log. Note that if an app is running from AppStore, it will + * never log above FIRLoggerLevelNotice even if loggerLevel is set to a higher (more verbose) + * setting. + * + * @param loggerLevel The maximum logging level. The default level is set to FIRLoggerLevelNotice. + */ +- (void)setLoggerLevel:(FIRLoggerLevel)loggerLevel; + +@end diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRLoggerLevel.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRLoggerLevel.h new file mode 100755 index 00000000..ddf683f7 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIRLoggerLevel.h @@ -0,0 +1,12 @@ +/** + * The log levels used by internal logging. + */ +typedef NS_ENUM(NSInteger, FIRLoggerLevel) { + FIRLoggerLevelError = 3 /*ASL_LEVEL_ERR*/, + FIRLoggerLevelWarning = 4 /*ASL_LEVEL_WARNING*/, + FIRLoggerLevelNotice = 5 /*ASL_LEVEL_NOTICE*/, + FIRLoggerLevelInfo = 6 /*ASL_LEVEL_INFO*/, + FIRLoggerLevelDebug = 7 /*ASL_LEVEL_DEBUG*/, + FIRLoggerLevelMin = FIRLoggerLevelError, + FIRLoggerLevelMax = FIRLoggerLevelDebug +}; diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIROptions.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIROptions.h new file mode 100755 index 00000000..083082ab --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FIROptions.h @@ -0,0 +1,93 @@ +#import <Foundation/Foundation.h> + +/** + * This class provides constant fields of Google APIs. + */ +@interface FIROptions : NSObject<NSCopying> + +/** + * Returns the default options. + */ ++ (FIROptions *)defaultOptions; + +/** + * An iOS API key used for authenticating requests from your app, e.g. + * @"AIzaSyDdVgKwhZl0sTTTLZ7iTmt1r3N2cJLnaDk", used to identify your app to Google servers. + */ +@property(nonatomic, readonly, copy) NSString *APIKey; + +/** + * The OAuth2 client ID for iOS application used to authenticate Google users, for example + * @"12345.apps.googleusercontent.com", used for signing in with Google. + */ +@property(nonatomic, readonly, copy) NSString *clientID; + +/** + * The tracking ID for Google Analytics, e.g. @"UA-12345678-1", used to configure Google Analytics. + */ +@property(nonatomic, readonly, copy) NSString *trackingID; + +/** + * The Project Number from the Google Developer's console, for example @"012345678901", used to + * configure Google Cloud Messaging. + */ +@property(nonatomic, readonly, copy) NSString *GCMSenderID; + +/** + * The Project ID from the Firebase console, for example @"abc-xyz-123". Currently only populated + * when using [FIROptions defaultOptions]. + */ +@property(nonatomic, readonly, copy) NSString *projectID; + +/** + * The Android client ID used in Google AppInvite when an iOS app has its Android version, for + * example @"12345.apps.googleusercontent.com". + */ +@property(nonatomic, readonly, copy) NSString *androidClientID; + +/** + * The Google App ID that is used to uniquely identify an instance of an app. + */ +@property(nonatomic, readonly, copy) NSString *googleAppID; + +/** + * The database root URL, e.g. @"http://abc-xyz-123.firebaseio.com". + */ +@property(nonatomic, readonly, copy) NSString *databaseURL; + +/** + * The URL scheme used to set up Durable Deep Link service. + */ +@property(nonatomic, readwrite, copy) NSString *deepLinkURLScheme; + +/** + * The Google Cloud Storage bucket name, e.g. @"abc-xyz-123.storage.firebase.com". + */ +@property(nonatomic, readonly, copy) NSString *storageBucket; + +/** + * Initializes a customized instance of FIROptions with keys. googleAppID, bundleID and GCMSenderID + * are required. Other keys may required for configuring specific services. + */ +- (instancetype)initWithGoogleAppID:(NSString *)googleAppID + bundleID:(NSString *)bundleID + GCMSenderID:(NSString *)GCMSenderID + APIKey:(NSString *)APIKey + clientID:(NSString *)clientID + trackingID:(NSString *)trackingID + androidClientID:(NSString *)androidClientID + databaseURL:(NSString *)databaseURL + storageBucket:(NSString *)storageBucket + deepLinkURLScheme:(NSString *)deepLinkURLScheme; + +/** + * Initializes a customized instance of FIROptions from the file at the given plist file path. + * For example, + * NSString *filePath = + * [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]; + * FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath]; + * Returns nil if the plist file does not exist or is invalid. + */ +- (instancetype)initWithContentsOfFile:(NSString *)plistPath; + +@end diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FirebaseCore.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FirebaseCore.h new file mode 100755 index 00000000..52a222f5 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Headers/FirebaseCore.h @@ -0,0 +1,5 @@ +#import "FIRAnalyticsConfiguration.h" +#import "FIRApp.h" +#import "FIRConfiguration.h" +#import "FIRLoggerLevel.h" +#import "FIROptions.h" diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Modules/module.modulemap b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Modules/module.modulemap new file mode 100755 index 00000000..f3db90d8 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseCore.framework/Modules/module.modulemap @@ -0,0 +1,8 @@ +framework module FirebaseCore { + umbrella header "FirebaseCore.h" + export * + module * { export *} + link "z" + link framework "Foundation" + link framework "UIKit" +}
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/FirebaseInstanceID b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/FirebaseInstanceID Binary files differnew file mode 100755 index 00000000..2ebc6e68 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/FirebaseInstanceID diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/Headers/FIRInstanceID.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/Headers/FIRInstanceID.h new file mode 100755 index 00000000..5ff8372e --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/Headers/FIRInstanceID.h @@ -0,0 +1,245 @@ +#import <Foundation/Foundation.h> + +/** + * @memberof FIRInstanceID + * + * The scope to be used when fetching/deleting a token for Firebase Messaging. + */ +FOUNDATION_EXPORT NSString * __nonnull const kFIRInstanceIDScopeFirebaseMessaging; + +/** + * Called when the system determines that tokens need to be refreshed. + * This method is also called if Instance ID has been reset in which + * case, tokens and FCM topic subscriptions also need to be refreshed. + * + * Instance ID service will throttle the refresh event across all devices + * to control the rate of token updates on application servers. + */ +FOUNDATION_EXPORT NSString * __nonnull const kFIRInstanceIDTokenRefreshNotification; + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the InstanceID token returns. If + * the call fails we return the appropriate `error code` as described below. + * + * @param token The valid token as returned by InstanceID backend. + * + * @param error The error describing why generating a new token + * failed. See the error codes below for a more detailed + * description. + */ +typedef void(^FIRInstanceIDTokenHandler)( NSString * __nullable token, NSError * __nullable error); + + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the InstanceID `deleteToken` returns. If + * the call fails we return the appropriate `error code` as described below + * + * @param error The error describing why deleting the token failed. + * See the error codes below for a more detailed description. + */ +typedef void(^FIRInstanceIDDeleteTokenHandler)(NSError * __nullable error); + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the app identity is created. If the + * identity wasn't created for some reason we return the appropriate error code. + * + * @param identity A valid identity for the app instance, nil if there was an error + * while creating an identity. + * @param error The error if fetching the identity fails else nil. + */ +typedef void(^FIRInstanceIDHandler)(NSString * __nullable identity, NSError * __nullable error); + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the app identity and all the tokens associated + * with it are deleted. Returns a valid error object in case of failure else nil. + * + * @param error The error if deleting the identity and all the tokens associated with + * it fails else nil. + */ +typedef void(^FIRInstanceIDDeleteHandler)(NSError * __nullable error); + +/** + * @enum FIRInstanceIDError + */ +typedef NS_ENUM(NSUInteger, FIRInstanceIDError) { + // Http related errors. + + /// Unknown error. + FIRInstanceIDErrorUnknown = 0, + + /// Auth Error -- GCM couldn't validate request from this client. + FIRInstanceIDErrorAuthentication = 1, + + /// NoAccess -- InstanceID service cannot be accessed. + FIRInstanceIDErrorNoAccess = 2, + + /// Timeout -- Request to InstanceID backend timed out. + FIRInstanceIDErrorTimeout = 3, + + /// Network -- No network available to reach the servers. + FIRInstanceIDErrorNetwork = 4, + + /// OperationInProgress -- Another similar operation in progress, + /// bailing this one. + FIRInstanceIDErrorOperationInProgress = 5, + + /// InvalidRequest -- Some parameters of the request were invalid. + FIRInstanceIDErrorInvalidRequest = 7, +}; + +/** + * The APNS token type for the app. If the token type is set to `UNKNOWN` + * InstanceID will implicitly try to figure out what the actual token type + * is from the provisioning profile. + */ +typedef NS_ENUM(NSInteger, FIRInstanceIDAPNSTokenType) { + /// Unknown token type. + FIRInstanceIDAPNSTokenTypeUnknown, + /// Sandbox token type. + FIRInstanceIDAPNSTokenTypeSandbox, + /// Production token type. + FIRInstanceIDAPNSTokenTypeProd, +}; + +/** + * Instance ID provides a unique identifier for each app instance and a mechanism + * to authenticate and authorize actions (for example, sending a GCM message). + * + * Instance ID is long lived but, may be reset if the device is not used for + * a long time or the Instance ID service detects a problem. + * If Instance ID is reset, the app will be notified via + * `kFIRInstanceIDTokenRefreshNotification`. + * + * If the Instance ID has become invalid, the app can request a new one and + * send it to the app server. + * To prove ownership of Instance ID and to allow servers to access data or + * services associated with the app, call + * `[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]`. + */ +@interface FIRInstanceID : NSObject + +/** + * FIRInstanceID. + * + * @return A shared instance of FIRInstanceID. + */ ++ (nonnull instancetype)instanceID NS_SWIFT_NAME(instanceID()); + +/** + * Unavailable. Use +instanceID instead. + */ +- (nonnull instancetype)init __attribute__((unavailable("Use +instanceID instead."))); + +/** + * Set APNS token for the application. This APNS token will be used to register + * with Firebase Messaging using `token` or + * `tokenWithAuthorizedEntity:scope:options:handler`. If the token type is set to + * `FIRInstanceIDAPNSTokenTypeUnknown` InstanceID will read the provisioning profile + * to find out the token type. + * + * @param token The APNS token for the application. + * @param type The APNS token type for the above token. + */ +- (void)setAPNSToken:(nonnull NSData *)token + type:(FIRInstanceIDAPNSTokenType)type; + +#pragma mark - Tokens + +/** + * Returns a Firebase Messaging scoped token for the firebase app. + * + * @return Null Returns null if the device has not yet been registerd with + * Firebase Message else returns a valid token. + */ +- (nullable NSString *)token; + +/** + * Returns a token that authorizes an Entity (example: cloud service) to perform + * an action on behalf of the application identified by Instance ID. + * + * This is similar to an OAuth2 token except, it applies to the + * application instance instead of a user. + * + * This is an asynchronous call. If the token fetching fails for some reason + * we invoke the completion callback with nil `token` and the appropriate + * error. + * + * Note, you can only have one `token` or `deleteToken` call for a given + * authorizedEntity and scope at any point of time. Making another such call with the + * same authorizedEntity and scope before the last one finishes will result in an + * error with code `OperationInProgress`. + * + * @see FIRInstanceID deleteTokenWithAuthorizedEntity:scope:handler: + * + * @param authorizedEntity Entity authorized by the token. + * @param scope Action authorized for authorizedEntity. + * @param options The extra options to be sent with your token request. The + * value for the `apns_token` should be the NSData object + * passed to UIApplication's + * `didRegisterForRemoteNotificationsWithDeviceToken` method. + * All other keys and values in the options dict need to be + * instances of NSString or else they will be discarded. Bundle + * keys starting with 'GCM.' and 'GOOGLE.' are reserved. + * @param handler The callback handler which is invoked when the token is + * successfully fetched. In case of success a valid `token` and + * `nil` error are returned. In case of any error the `token` + * is nil and a valid `error` is returned. The valid error + * codes have been documented above. + */ +- (void)tokenWithAuthorizedEntity:(nonnull NSString *)authorizedEntity + scope:(nonnull NSString *)scope + options:(nullable NSDictionary *)options + handler:(nonnull FIRInstanceIDTokenHandler)handler; + +/** + * Revokes access to a scope (action) for an entity previously + * authorized by `[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]`. + * + * This is an asynchronous call. Call this on the main thread since InstanceID lib + * is not thread safe. In case token deletion fails for some reason we invoke the + * `handler` callback passed in with the appropriate error code. + * + * Note, you can only have one `token` or `deleteToken` call for a given + * authorizedEntity and scope at a point of time. Making another such call with the + * same authorizedEntity and scope before the last one finishes will result in an error + * with code `OperationInProgress`. + * + * @param authorizedEntity Entity that must no longer have access. + * @param scope Action that entity is no longer authorized to perform. + * @param handler The handler that is invoked once the unsubscribe call ends. + * In case of error an appropriate error object is returned + * else error is nil. + */ +- (void)deleteTokenWithAuthorizedEntity:(nonnull NSString *)authorizedEntity + scope:(nonnull NSString *)scope + handler:(nonnull FIRInstanceIDDeleteTokenHandler)handler; + +#pragma mark - Identity + +/** + * Asynchronously fetch a stable identifier that uniquely identifies the app + * instance. If the identifier has been revoked or has expired, this method will + * return a new identifier. + * + * + * @param handler The handler to invoke once the identifier has been fetched. + * In case of error an appropriate error object is returned else + * a valid identifier is returned and a valid identifier for the + * application instance. + */ +- (void)getIDWithHandler:(nonnull FIRInstanceIDHandler)handler; + +/** + * Resets Instance ID and revokes all tokens. + */ +- (void)deleteIDWithHandler:(nonnull FIRInstanceIDDeleteHandler)handler; + +@end diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h new file mode 100755 index 00000000..053ec2b1 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h @@ -0,0 +1 @@ +#import "FIRInstanceID.h" diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/Modules/module.modulemap b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/Modules/module.modulemap new file mode 100755 index 00000000..267c0356 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/FirebaseInstanceID.framework/Modules/module.modulemap @@ -0,0 +1,7 @@ +framework module FirebaseInstanceID { + umbrella header "FirebaseInstanceID.h" + export * + module * { export *} + link framework "Foundation" + link framework "UIKit" +}
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/GoogleToolboxForMac.framework/GoogleToolboxForMac b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/GoogleToolboxForMac.framework/GoogleToolboxForMac Binary files differnew file mode 100644 index 00000000..345b889c --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Analytics/GoogleToolboxForMac.framework/GoogleToolboxForMac diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/FirebaseCrash b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/FirebaseCrash Binary files differnew file mode 100755 index 00000000..7cf08c10 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/FirebaseCrash diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/Headers/FIRCrashLog.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/Headers/FIRCrashLog.h new file mode 100755 index 00000000..ac446a62 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/Headers/FIRCrashLog.h @@ -0,0 +1,164 @@ +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +/** + * @abstract Logs a message to the Firebase Crash Reporter system. + * + * @discussion This method adds a message to the crash reporter + * logging system. The recent logs will be sent with the crash + * report when the application exits abnormally. Note that the + * timestamp of this message and the timestamp of the console + * message may differ by a few milliseconds. + * + * Messages should be brief as the total size of the message payloads + * is limited by the uploader and may change between releases of the + * crash reporter. Excessively long messages will be truncated + * safely but that will introduce a delay in submitting the message. + * + * @warning Raises an NSInvalidArgumentException if @p format is nil. + * + * @param format A format string. + * + * @param ap A variable argument list. + */ +FOUNDATION_EXTERN NS_FORMAT_FUNCTION(1, 0) +void FIRCrashLogv(NSString *format, va_list ap); + +/** + * @abstract Logs a message to the Firebase Crash Reporter system. + * + * @discussion This method adds a message to the crash reporter + * logging system. The recent logs will be sent with the crash + * report when the application exits abnormally. Note that the + * timestamp of this message and the timestamp of the console + * message may differ by a few milliseconds. + * + * Messages should be brief as the total size of the message payloads + * is limited by the uploader and may change between releases of the + * crash reporter. Excessively long messages will be truncated + * safely but that will introduce a delay in submitting the message. + * + * @warning Raises an NSInvalidArgumentException if @p format is nil. + * + * @param format A format string. + * + * @param ... A comma-separated list of arguments to substitute into + * format. + * + * @see FIRCrashLogv(format, ap) + */ +FOUNDATION_STATIC_INLINE NS_FORMAT_FUNCTION(1, 2) +void FIRCrashLog(NSString *format, ...) { + va_list ap; + + va_start(ap, format); + FIRCrashLogv(format, ap); + va_end(ap); +} + +/** + * @abstract Logs a message to the Firebase Crash Reporter system as + * well as <code>NSLog()</code>. + * + * @discussion This method adds a message to the crash reporter + * logging system. The recent logs will be sent with the crash + * report when the application exits abnormally. Note that the + * timestamp of this message and the timestamp of the console + * message may differ by a few milliseconds. + * + * Messages should be brief as the total size of the message payloads + * is limited by the uploader and may change between releases of the + * crash reporter. Excessively long messages will be truncated + * safely but that will introduce a delay in submitting the message. + * + * @warning Raises an NSInvalidArgumentException if @p format is nil. + * + * @param format A format string. + * + * @param ap A variable argument list. + */ +FOUNDATION_STATIC_INLINE NS_FORMAT_FUNCTION(1, 0) +void FIRCrashNSLogv(NSString *format, va_list ap) { + va_list ap2; + + va_copy(ap2, ap); + NSLogv(format, ap); + FIRCrashLogv(format, ap2); + va_end(ap2); +} + +/** + * @abstract Logs a message to the Firebase Crash Reporter system as + * well as <code>NSLog()</code>. + * + * @discussion This method adds a message to the crash reporter + * logging system. The recent logs will be sent with the crash + * report when the application exits abnormally. Note that the + * timestamp of this message and the timestamp of the console + * message may differ by a few milliseconds. + * + * Messages should be brief as the total size of the message payloads + * is limited by the uploader and may change between releases of the + * crash reporter. Excessively long messages will be truncated + * safely but that will introduce a delay in submitting the message. + * + * @warning Raises an NSInvalidArgumentException if @p format is nil. + * + * @param format A format string. + * + * @param ... A comma-separated list of arguments to substitute into + * format. + * + * @see FIRCrashLogv(format, ap) + */ +FOUNDATION_STATIC_INLINE NS_FORMAT_FUNCTION(1, 2) +void FIRCrashNSLog(NSString *format, ...) { + va_list ap; + + va_start(ap, format); + FIRCrashNSLogv(format, ap); + va_end(ap); +} + +/** + * @abstract Logs a message to the Firebase Crash Reporter system in + * a way that is easily called from Swift code. + * + * @discussion This method adds a message to the crash reporter + * logging system. Similar to FIRCrashLog, but with a call signature + * that is more Swift friendly. Unlike FIRCrashLog, callers + * use string interpolation instead of formatting arguments. + * + * @code + * public func mySwiftFunction() { + * let unexpected_number = 10; + * FIRCrashMessage("This number doesn't seem right: \(unexpected_number)"); + * } + * @endcode + * + * Messages should be brief as the total size of the message payloads + * is limited by the uploader and may change between releases of the + * crash reporter. Excessively long messages will be truncated + * safely but that will introduce a delay in submitting the message. + * + * @param Message A log message + * + * @see FIRCrashLog(format, ...) + */ +FOUNDATION_STATIC_INLINE +void FIRCrashMessage(NSString *message) { + FIRCrashLog(@"%@", message); +} + +NS_ASSUME_NONNULL_END + +#ifdef FIRCRASH_REPLACE_NSLOG +#if defined(DEBUG) || defined(FIRCRASH_LOG_TO_CONSOLE) +#define NSLog(...) FIRCrashNSLog(__VA_ARGS__) +#define NSLogv(...) FIRCrashNSLogv(__VA_ARGS__) +#else +#define NSLog(...) FIRCrashLog(__VA_ARGS__) +#define NSLogv(...) FIRCrashLogv(__VA_ARGS__) +#endif +#endif diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/Headers/FirebaseCrash.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/Headers/FirebaseCrash.h new file mode 100755 index 00000000..18659214 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/Headers/FirebaseCrash.h @@ -0,0 +1 @@ +#import "FIRCrashLog.h" diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/Modules/module.modulemap b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/Modules/module.modulemap new file mode 100755 index 00000000..537a790a --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/FirebaseCrash.framework/Modules/module.modulemap @@ -0,0 +1,12 @@ +framework module FirebaseCrash { + umbrella header "FirebaseCrash.h" + export * + module * { export *} + link "sqlite3" + link "z" + link framework "CoreGraphics" + link framework "CoreTelephony" + link framework "Foundation" + link framework "SystemConfiguration" + link framework "UIKit" +}
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/Protobuf.framework/Protobuf b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/Protobuf.framework/Protobuf Binary files differnew file mode 100644 index 00000000..546e02ec --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/Protobuf.framework/Protobuf diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/batch-upload b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/batch-upload new file mode 100755 index 00000000..053a3ee7 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/batch-upload @@ -0,0 +1,416 @@ +#!/bin/bash + +usage () { + echo >&2 "usage: ${0##*/} [-hv] [-p google-service] [-i info] service-account-file {mach-o file|uuid} ..." +} + +help () { + usage + cat >&2 <<EOF + +-h Show this help. +-p Location of GoogleService-Info.plist. +-i Location of Info.plist. +-v Be verbose. + +account JSON file containing account information. +mach-o A path to an executable, dSYM file, library, + or other Mach-O object. +uuid A dSYM file's UUID (searches for the file). + +Processes one or more Mach-O files for use with the Firebase Crash +Reporter. dSYM bundles may be specified by full path to the dSYM +companion file (usually found under "DWARF") or by UUID. + +For applications and frameworks, please use the full path to the +Mach-O file. For frameworks, this will be "Blah.framework/Blah". +For applications, this will be "Blah.app/Blah". + +Useful environment variables: + + SERVICE_PLIST - path to GoogleService-Info.plist (-p command-line option) + INFO_PLIST - path to Info.plist (-i command-line option) + DUMP_SYMS - path to dump_syms executable + FCR_BUNDLE_ID - CFBundleIdentifier (build version) from Info.plist + FCR_PROD_VERS - CFBundleShortVersionString from Info.plist + FIREBASE_API_KEY - API key from GoogleService-Info.plist + FIREBASE_APP_ID - App ID from GoogleService-Info.plist + SWIFT_DEMANGLE - path to swift-demangle executable + +Setting any of the above prevents this script from searching for the +values. Specifically, the SERVICE_PLIST and INFO_PLIST files are not +required if FCR_* and FIREBASE_* environment variables are not empty. + +EOF +} + +KEEP_TEMPORARIES=false # mostly for debugging (not documented) + +while getopts hi:kp:v-: OPT; do + case ${OPT} in + h) help; exit 0;; + i) INFO_PLIST="${OPTARG}";; + k) KEEP_TEMPORARIES=true;; + p) SERVICE_PLIST="${OPTARG}";; + v) ((VERBOSE+=1));; + -) case "${OPTARG}" in + help) help; exit 0;; + info=*) INFO_PLIST="${OPTARG#info=}";; + service=*) SERVICE_PLIST="${OPTARG#service=}";; + verbose) ((VERBOSE+=1));; + *) usage; exit 2;; + esac;; + ?) usage; exit 2;; + esac +done + +shift $((OPTIND - 1)) + +. "$(dirname "$0")/upload-sym-util.bash" + +var_check () { + for VAR; do + if [[ "${!VAR}" =~ \$\(.*\) ]]; then + xcwarning "${VAR} (== \"${!VAR}\") appears to have unexpanded variables." + xcnote "Consider specifying it through an environment variable." + fi + done +} + +SERVICE_ACCOUNT_FILE="$1" + +if [[ ! -f "${SERVICE_ACCOUNT_FILE}" ]]; then + xcwarning "The first argument does not look like a service account file." + xcdebug "Will attempt to extract account file from legacy cache." + unset SERVICE_ACCOUNT_FILE +else + shift +fi + +if (( $# == 0 )); then + usage + exit 2 +fi + +if [[ "${INFO_PLIST}" && -f "${INFO_PLIST%/*}/GoogleService-Info.plist" ]]; then + : "${SERVICE_PLIST:="${INFO_PLIST%/*}/GoogleService-Info.plist"}" +fi + +if [[ "${SERVICE_PLIST}" && -f "${SERVICE_PLIST%/*}/Info.plist" ]]; then + : "${INFO_PLIST:="${SERVICE_PLIST%/*}/Info.plist"}" +fi + +xcdebug "SERVICE_PLIST = ${SERVICE_PLIST:="$(find . -name GoogleService-Info.plist | head -n1)"}" + +xcdebug "INFO_PLIST = ${INFO_PLIST:="$(find . -name Info.plist | head -n1)"}" + +if [[ -f "${SERVICE_PLIST}" ]]; then + xcdebug "FIREBASE_API_KEY = ${FIREBASE_API_KEY:="$(/usr/libexec/PlistBuddy -c 'print API_KEY' "${SERVICE_PLIST}")"}" + xcdebug "FIREBASE_APP_ID = ${FIREBASE_APP_ID:="$(/usr/libexec/PlistBuddy -c 'print GOOGLE_APP_ID' "${SERVICE_PLIST}")"}" + xcdebug "FCR_BUNDLE_ID = ${FCR_BUNDLE_ID:="$(/usr/libexec/PlistBuddy -c 'print BUNDLE_ID' "${SERVICE_PLIST}")"}" +fi + +if [[ -f "${INFO_PLIST}" ]]; then + xcdebug "FCR_PROD_VERS = ${FCR_PROD_VERS:="$(/usr/libexec/PlistBuddy -c 'print CFBundleShortVersionString' "${INFO_PLIST}" 2>/dev/null)"}" +fi + +var_check FCR_PROD_VERS FCR_BUNDLE_ID + +ERROR=$'environment variable empty or unset\n\nExplicitly add to environment or set GoogleService-Info.plist (-p)\nand Info.plist (-i) flags to extract values from the files.\n\nTry "'"$0"' -h" for details.' + +: "${FIREBASE_API_KEY:?"${ERROR}"}" "${FIREBASE_APP_ID:?"${ERROR}"}" +: "${FCR_PROD_VERS:?"${ERROR}"}" "${FCR_BUNDLE_ID:?"${ERROR}"}" + +# Extract key from legacy cache. + +if [[ ! "${SERVICE_ACCOUNT_FILE}" ]]; then + xcwarning "Running extract-keys on desktop." + EXTRACT_KEYS="$(script_dir)/extract-keys" + (cd "${HOME}/Desktop"; "${EXTRACT_KEYS}") || exit $? + SERVICE_ACCOUNT_FILE="${HOME}/Desktop/${FIREBASE_APP_ID}.json" + xcdebug "Using ${SERVICE_ACCOUNT_FILE} as account file. Please move this and all other extracted keys to a safe place." +fi + +if [[ ! -f "${SERVICE_ACCOUNT_FILE}" ]]; then + echo >&2 "Unable to find service account file." + echo >&2 + usage + exit 2 +fi + +# usage: extract_symbols_and_upload *dwarf-file* *arch* *exe-file* +# +# Do NOT use the dSYM bundle path. While it may work on occasion, it +# is not guaranteed to do so; the full path to the DWARF companion +# file will always work. (Discovered by Kerem Erkan.) +# +# If the executable is empty, use the DWARF companion file as a proxy +# for the executable. +extract_symbols_and_upload () { + local DWARF_COMPANION="$1" ARCH="$2" EXECUTABLE="$3" + + if [[ ! "${EXECUTABLE}" ]]; then + xcdebug "No executable; using ${DWARF_COMPANION} as symbol source." + + EXECUTABLE="${DWARF_COMPANION}" + unset DWARF_COMPANION + fi + + [[ "${EXECUTABLE}" ]] || return 1 + + if [[ -x "${SWIFT_DEMANGLE:=$(xcrun --find swift-demangle 2>/dev/null)}" ]]; + then + SWIFT_DEMANGLE_COMMAND="${SWIFT_DEMANGLE} -simplified" + else + SWIFT_DEMANGLE_COMMAND=/bin/cat + fi + fcr_mktemp SYMBOL_FILE + + "${DUMP_SYMS:="$(script_dir)/dump_syms"}" -a "${ARCH}" ${DWARF_COMPANION:+-g "${DWARF_COMPANION}"} "${EXECUTABLE}" | ${SWIFT_DEMANGLE_COMMAND} >|"${SYMBOL_FILE}" || return $? + + fcr_upload_files "${SYMBOL_FILE}" || return $? +} + +# usage: is_executable *path* +# +# Check to see if the file is an executable or a dSYM bundle +is_executable () { + [[ -f "$1" || ( -d "$1" && "${1%/}" == *.dSYM ) ]] +} + +# usage: is_uuid *string* +# +# Verify that the argument is a UUID. +is_uuid () { + [[ "$1" =~ ^[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}$ ]] +} + +# usage: set_uuids_archs *mach-o-file* +# +# side effect: appends to UUIDS, ARCHS +# +# Extract the uuid and architecture information from the given Mach-O +# file and append the information to the UUIDS and ARCHS arrays. +set_uuids_archs () { + eval "$(dwarfdump --uuid "$1" | awk '/^UUID:/ { print "UUIDS+=(" $2 "); ARCHS+=" $3 }')" +} + +# usage: mdls_to_bash +# +# Convert the output of mdls to a string consumable by bash. mdls +# outputs string arrays as quoted strings separated by commas, and +# Unicode characters as '\Uxxxx'. +# +# Note: this is sensitive to the current locale. If the locale is not +# UTF-8, then wide-character warnings will result if the strings +# contain non-ASCII characters. This is actually a desired behavior, +# because bash has issues with non-Unicode encodings for file names. +# (The macOS default is to have UTF-8 enabled, so this should not be a +# problem for the majority of use cases.) +mdls_to_bash () { + perl -C -ple 's/,$//; s/\\U(....)/chr hex $1/ge' +} + +for EXE; do + if is_executable "${EXE}"; then + xcdebug "Assuming ${EXE} is an executable or dSYM bundle." + + # Import architecture UUID information + UUIDS=() ARCHS=() + set_uuids_archs "${EXE}" + + for I in "${!UUIDS[@]}"; do + xcdebug "Found ${UUIDS[$I]} for ${ARCHS[$I]} in ${EXE}" + done + + if ((${#UUIDS[*]} == 0)); then + xcwarning "${EXE} exists, but has no architecture information." + continue + fi + + if [[ "${EXE}" = *.dSYM ]]; then + xcdebug "Removing dSYM bundle as executable target." + unset EXE + fi + + elif is_uuid "${EXE}"; then + xcdebug "${EXE} looks like a UUID to me." + UUIDS=("${EXE}"); unset EXE + + else + xcwarning "${EXE}: not an executable, bundle, or UUID." + continue + fi + + BUNDLES=() + + for UUID in "${UUIDS[@]}"; do + xcdebug "Searching for ${UUID} ..." + + QUERY_UUID="com_apple_xcode_dsym_uuids == '${UUID}'" + QUERY_TYPE="kMDItemContentType == 'com.apple.xcode.dsym' || kMDItemContentType == 'com.apple.xcode.archive'" + QUERY="(${QUERY_UUID}) && (${QUERY_TYPE})" + + if ((VERBOSE > 1)); then + xcnote "Passing query \"${QUERY}\" to mdfind." + fi + + MD_FIND_RESULT=() + + eval "$(mdfind "${QUERY}" -0 | xargs -0 perl -le 'print "MD_FIND_RESULT+=(\Q$_\E)" for @ARGV')" + + xcdebug "mdfind returned (${MD_FIND_RESULT[*]})" + + # BUNDLES should contain no duplicates. + for I in "${!MD_FIND_RESULT[@]}"; do + for BUNDLE in "${BUNDLES[@]}"; do + if [[ "${MD_FIND_RESULT[$I]}" == "$BUNDLE" ]]; then + unset "MD_FIND_RESULT[$I]" + fi + done + done + + BUNDLES+=("${MD_FIND_RESULT[@]}") + done + + if [[ ${#BUNDLES[@]} == 0 && ${#ARCHS[@]} == 0 ]]; then + xcwarning "No executable or bundle found for ${UUIDS[*]}." + xcnote "Try passing in the executable itself instead of a UUID." + continue + fi + + xcdebug "BUNDLES = (${BUNDLES[*]})" + + if [[ ${#BUNDLES[@]} == 0 ]]; then + xcdebug "No dSYM bundle found." + + # The dSYM has to be on a normal volume (not temporary). It + # can, however, be shared among multiple executables. + if [[ ! "${SCRATCH_BUNDLE}" ]]; then + SCRATCH_BUNDLE="${HOME}/com.google.BatchUploadScratchFile.dSYM" + FCR_TEMPORARY_FILES+=("${SCRATCH_BUNDLE}") + fi + + xcdebug "Creating one in ${SCRATCH_BUNDLE}" + + BUNDLES=("${SCRATCH_BUNDLE}") + + # Create the dSYM bundle. This may produce an empty dSYM + # bundle if the executable has no debugging information. + xcrun dsymutil -o "${BUNDLES[0]}" "${EXE}"; STATUS=$? + + if ((STATUS)); then + xcwarning "Command dsymutil failed with exit code ${STATUS}." + continue + fi + + # Import the dSYM bundle. There is a momentary delay between + # creating the bundle and having it indexed; explicitly + # importing guarantees the mds database is up-to-date when we + # ask it for information about UUIDs and paths. + mdimport "${SCRATCH_BUNDLE}"; STATUS=$? + + if ((STATUS)); then + xcwarning "Command mdimport failed with exit code ${STATUS}." + continue + fi + fi + + SEEN_ARCH=() SEEN_PATH=() + + for BUNDLE in "${BUNDLES[@]}"; do + typeset -a BNDL_UUIDS BNDL_PATHS # keeps ShellLint happy + + eval "BNDL_UUIDS=$(mdls -raw -name com_apple_xcode_dsym_uuids "${BUNDLE}" | mdls_to_bash)" + eval "BNDL_PATHS=$(mdls -raw -name com_apple_xcode_dsym_paths "${BUNDLE}" | mdls_to_bash)" + + # Neither of these SHOULD occur, but curious things happen out + # in the field. + if ((${#BNDL_UUIDS[@]} != ${#BNDL_PATHS[@]})); then + xcwarning "${BUNDLE}: Malformed dSYM bundle." + continue + elif ((${#BNDL_UUIDS[@]} == 0)); then + xcwarning "${BUNDLE}: No DWARF information." + continue + fi + + # If no executable was specified, then the UUIDS and ARCHS + # arrays are empty. Populate them with information from the + # bundle. + if [[ ! "${EXE}" ]]; then + # The final UUIDS setting will be the intersection of the + # discovered set and the originally specified UUIDS. This + # is to prevent uploading potentially private information. + SOUGHT_UUIDS=("${UUIDS[@]}") + + UUIDS=() ARCHS=() + for BNDL_PATH in "${BNDL_PATHS[@]}"; do + set_uuids_archs "${BUNDLE}/${BNDL_PATH}" + done + + if ((${#SOUGHT_UUIDS[@]})); then + for I in "${!UUIDS[@]}"; do + for UUID in "${SOUGHT_UUIDS[@]}"; do + if [[ "${UUIDS[$I]}" == "${UUID}" ]]; then + continue 2 + fi + done + + # This is not the DWARF you are looking for... + xcdebug "Rejecting ${UUIDS[$I]} (${ARCHS[$I]}) as candidate DWARF file." + unset "UUIDS[$I]" "ARCHS[$I]" + done + fi + + unset SOUGHT_UUIDS + fi + + for I in "${!BNDL_UUIDS[@]}"; do + # See comment on extract_symbols_and_upload for why the + # full path to the companion file is required. + + BNDL_UUID="${BNDL_UUIDS[$I]}" DWARF_COMPANION="${BUNDLE}/${BNDL_PATHS[$I]}" + + for J in "${!ARCHS[@]}"; do + # A dSYM bundle can contain multiple architectures for + # multiple applications. Make sure we get the right + # one. + if [[ "${BNDL_UUID}" == "${UUIDS[$J]}" ]]; then + ARCH="${ARCHS[$J]}" + break + fi + done + + if [[ ! "${ARCH}" ]]; then + # This is not an error: it is legal for a dSYM bundle + # to contain debugging information for multiple + # executables (such as a framework with multiple + # subframeworks). Just ignore it. + xcdebug "No matching information found in ${DWARF_COMPANION} with UUID ${BNDL_UUID}." + continue + fi + + xcdebug "Found ${UUID} for ${ARCH} in ${DWARF_COMPANION}" + + # Have we already uploaded this file? + for J in "${!SEEN_ARCH[@]}"; do + if [[ "${ARCH}" == "${SEEN_ARCH[$J]}" ]] && cmp -s "${DWARF_COMPANION}" "${SEEN_PATH[$J]}"; then + xcdebug "${DWARF_COMPANION}: copy of ${SEEN_PATH[$J]}; no need to upload." + continue 2 + fi + done + + if [[ -f "${DWARF_COMPANION}" ]]; then + extract_symbols_and_upload "${DWARF_COMPANION}" "${ARCH}" "${EXE}" || exit $? + SEEN_ARCH+=("${ARCH}") SEEN_PATH+=("${DWARF_COMPANION}") + fi + done + done +done + +# For debugging odd cases. +if "${KEEP_TEMPORARIES}"; then + FCR_TEMPORARY_FILES=() +fi + +echo "Done." diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/dump_syms b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/dump_syms Binary files differnew file mode 100755 index 00000000..8d0ef781 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/dump_syms diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/extract-keys b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/extract-keys new file mode 100755 index 00000000..0da57003 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/extract-keys @@ -0,0 +1,12 @@ +#!/bin/bash + +PLIST="${HOME}/Library/Preferences/com.google.SymbolUpload.plist" + +[[ -f $PLIST ]] || exit + +defaults read com.google.SymbolUpload | +perl -nle '/"(app_\d+_\d+_ios_.*)"/ and print $1' | +while read KEY; do + APP_ID="${KEY#app_}"; APP_ID="${APP_ID//_/:}" + plutil -extract "${KEY}" json -o "${APP_ID}.json" "${PLIST}" +done diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/upload-sym b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/upload-sym new file mode 100755 index 00000000..1f8327dc --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/upload-sym @@ -0,0 +1,273 @@ +#!/bin/bash + +usage () { + echo >&2 "usage: $0 [-h] [-v] [-w|-e] service-account-file" +} + +help () { + usage + + cat >&2 <<EOF + + -h This message. + -v Increase verbosity. Multiple -v options will provide + increasing details. Use at least '-vv' when reporting bugs. + -w Treat errors as warnings. Does not change the exit status. + -e Treat warnings as errors. Does not change the exit status. + +The service account private key file is downloaded from the Firebase +console. See + + https://firebase.google.com/docs/crash/ios#upload_symbol_files + +for details on retrieving this file. Older keys may still be in the +registry. Consider using extract-keys.pl to retrieve them. + +Execute this script in the final phase of your build. It will not +work outside of Xcode, and should warn you if you try. See the +batch-upload script included in this distribution to upload symbols +outside of an Xcode build. + +Here is an example Run Script Phase you can add to your project +to invoke this script: + + "\${PODS_ROOT}/FirebaseCrashReporting/upload-sym" \\ + "\${HOME}/Library/Developer/My Project-1fad0d0767b42e.json" + +To avoid stopping the build should the upload fail, + + "\${PODS_ROOT}/FirebaseCrashReporting/upload-sym" -w \\ + "\${HOME}/Library/Developer/My Project-1fad0d0767b42e.json" + exit 0 # claim success no matter what + +EOF +} + +# Parse optional command-line flags. + +VERBOSE=0 WARNINGS_ONLY=0 ERRORS_ONLY=0 + +while getopts ehvw OPT; do + case "${OPT}" in + h) help; exit 0;; + v) VERBOSE=$((VERBOSE + 1));; + w) WARNINGS_ONLY=1;; + e) ERRORS_ONLY=1;; + ?) usage; exit 2;; + esac +done + +shift $((OPTIND - 1)) + +if ((WARNINGS_ONLY && ERRORS_ONLY)); then + echo >&2 "Either -w or -e may be specified, but not both." + echo >&2 + usage + exit 2 +fi + +SERVICE_ACCOUNT_FILE="$1"; shift + +if (($#)); then + echo >&2 "Unexpected argument '$1'" + echo >&2 + usage + exit 2 +fi + +export PATH=/bin:/usr/bin # play it safe + +# Load common utility routines. + +. "$(dirname "$0")/upload-sym-util.bash" + +# Make the error output Xcode-friendly. + +# This is a bit of Bash voodoo that cries for an explanation and is +# horribly underdocumented on-line. The construct '>(...)' starts a +# subprocess with its stdin connected to a pipe. After starting the +# subprocess, the parser replaces the construct with the NAME of the +# writable end of the pipe as a named file descriptor '/dev/fd/XX', +# then reevaluates the line. So, after the subprocess is started +# (which filters stdin and outputs to stderr [not stdout]), the line +# "exec 2> /dev/fd/XX" is evaluated. This redirects the main +# process's stderr to the given file descriptor. +# +# The end result is that anything sent to stderr of the form: +# file.in: line 47: blah blah +# is replaced with +# file.in:47: error: blah blah +# which Xcode will detect and emphasize in the formatted output. + +exec 2> >(sed -e 's/: line \([0-9]*\):/:\1: error:/' >&2) + +# Be long-winded about problems. The user may not understand how this +# script works or what prerequisites it has. If the user sees this, +# it is likely that they are executing the script outside of an Xcode +# build. + +ERRMSG=$'Value missing\n\nThis script must be executed as part of an Xcode build stage to have the\nproper environment variables set.' + +# Locate Xcode-generated files. + +: "${TARGET_BUILD_DIR:?"${ERRMSG}"}" +: "${FULL_PRODUCT_NAME:?"${ERRMSG}"}" + +DSYM_BUNDLE="${DWARF_DSYM_FOLDER_PATH?"${ERRMSG}"}/${DWARF_DSYM_FILE_NAME?"${ERRMSG}"}" +[[ -e "${DSYM_BUNDLE}" ]] || unset DSYM_BUNDLE + +EXECUTABLE="${TARGET_BUILD_DIR?"${ERRMSG}"}/${EXECUTABLE_PATH?"${ERRMSG}"}" + +# Locate dump_syms utility. + +if ! [[ -f "${FCR_DUMP_SYMS:=$(script_dir)/dump_syms}" && -x "${FCR_DUMP_SYMS}" ]]; then + xcerror "Cannot find dump_syms." + xcnote "It should have been installed with the Cocoapod. The location of dump_syms can be explicitly set using the environment variable FCR_DUMP_SYMS if you are using a non-standard install." + + exit 2 +fi + +if [[ ! "${FIREBASE_API_KEY}" || ! "${FIREBASE_APP_ID}" ]]; then + : "${SERVICE_PLIST:="$(find "${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}" -name GoogleService-Info.plist | head -n1)"}" + : "${SERVICE_PLIST:?"GoogleService-Info.plist could not be located"}" + : "${FIREBASE_API_KEY:="$(property API_KEY "${SERVICE_PLIST}")"}" + : "${FIREBASE_APP_ID:="$(property GOOGLE_APP_ID "${SERVICE_PLIST}")"}" +fi + +if ! [[ "${FIREBASE_API_KEY}" ]]; then + xcerror "Unable to get API_KEY from ${SERVICE_PLIST}." + xcnote "Specify FIREBASE_API_KEY in environment." + exit 2 +fi + +if ! [[ "${FIREBASE_APP_ID}" ]]; then + xcerror "Unable to get GOOGLE_APP_ID from ${SERVICE_PLIST}." + xcnote "Specify FIREBASE_APP_ID in environment." + exit 2 +fi + +# Load Info.plist values (Bundle ID & version) + +INFOPLIST="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" + +if [[ -f "${INFOPLIST}" ]]; then + : "${FCR_PROD_VERS:="$(property CFBundleShortVersionString "${INFOPLIST}")"}" + : "${FCR_BUNDLE_ID:="$(property CFBundleIdentifier "${INFOPLIST}")"}" +fi + +if ! [[ "${FCR_PROD_VERS}" ]]; then + xcerror "Unable to get CFBundleShortVersionString from Info.plist." + xcnote "Specify FCR_PROD_VERS in environment." + exit 2 +fi + +if ! [[ "${FCR_BUNDLE_ID}" ]]; then + xcerror "Unable to get CFBundleIdentifier from Info.plist." + xcnote "Specify FCR_BUNDLE_ID in environment." + exit 2 +fi + +# Support legacy account file cache before giving up + +if [[ ! -f "${SERVICE_ACCOUNT_FILE}" ]]; then + xcwarning "Unable to find service account JSON file: ${SERVICE_ACCOUNT_FILE}" + "Please ensure you've followed the steps at:" + "https://firebase.google.com/docs/crash/ios#upload_symbol_files" + + xcdebug "Trying to extract JSON file from cache." + + CACHE_PLIST="${HOME}/Library/Preferences/com.google.SymbolUpload.plist" + + if [[ -f "${CACHE_PLIST}" ]]; then + fcr_mktemp SERVICE_ACCOUNT_FILE + /usr/bin/plutil -extract "app_${FIREBASE_APP_ID//:/_}" \ + json -o "${SERVICE_ACCOUNT_FILE}" "${CACHE_PLIST}" >/dev/null 2>&1 + if [[ ! -s "${SERVICE_ACCOUNT_FILE}" ]]; then + xcwarning "${FIREBASE_APP_ID} not found in cache." + /bin/rm -f "${SERVICE_ACCOUNT_FILE}" + else + xcnote "${FIREBASE_APP_ID} found in cache. Consider using extract-keys.pl to reduce reliance on cache." + fi + else + xcnote "No cache file found." + fi +fi + +if [[ ! -f "${SERVICE_ACCOUNT_FILE}" ]]; then + xcerror "All attempts to find the service account JSON file have failed." + xcnote "You must supply it on the command line." + echo >&2 -n "$0:1: note: "; usage + exit 2 +fi + +# Dump collected information if requested + +if ((VERBOSE >= 2)); then + xcnote "FIREBASE_API_KEY = ${FIREBASE_API_KEY}" + xcnote "FIREBASE_APP_ID = ${FIREBASE_APP_ID}" + xcnote "DSYM_BUNDLE = ${DSYM_BUNDLE:-(unset, will use symbols in executable)}" + xcnote "EXECUTABLE = ${EXECUTABLE}" + xcnote "INFOPLIST = ${INFOPLIST}" + xcnote "FCR_PROD_VERS = ${FCR_PROD_VERS}" + xcnote "FCR_BUNDLE_ID = ${FCR_BUNDLE_ID}" +fi + +# Create and upload symbol files for each architecture +if [[ -x "${SWIFT_DEMANGLE:=$(xcrun --find swift-demangle 2>/dev/null)}" ]]; then + SWIFT_DEMANGLE_COMMAND="${SWIFT_DEMANGLE} -simplified" +else + SWIFT_DEMANGLE_COMMAND=/bin/cat +fi + +for ARCH in ${ARCHS?:}; do + SYMBOL_FILE="SYMBOL_FILE_${ARCH}" + fcr_mktemp "${SYMBOL_FILE}" SCRATCH + + # Just because there is a dSYM bundle at that path does not mean + # it is the RIGHT dSYM bundle... + + if [[ -d "${DSYM_BUNDLE}" ]]; then + DSYM_UUID="$(dwarfdump --arch "${ARCH}" --uuid "${DSYM_BUNDLE}" | awk '{print $2}')" + EXE_UUID="$(dwarfdump --arch "${ARCH}" --uuid "${EXECUTABLE}" | awk '{print $2}')" + if ((VERBOSE > 1)); then + xcnote "dSYM bundle UUID: ${DSYM_UUID}" + xcnote "Executable UUID: ${EXE_UUID}" + fi + if [[ "${DSYM_UUID}" != "${EXE_UUID}" ]]; then + xcdebug "Current dSYM bundle is not valid." + unset DSYM_BUNDLE + fi + fi + + if [[ ! -d "${DSYM_BUNDLE}" ]]; then + xcdebug "Extracting dSYM from executable." + fcr_mktempdir TMP_DSYM + DSYM_BUNDLE="${TMP_DSYM}/${EXECUTABLE##*/}.dSYM" + xcrun dsymutil -o "${DSYM_BUNDLE}" "${EXECUTABLE}" + STATUS=$? + if ((STATUS)); then + xcerror "Command dsymutil failed with exit code ${STATUS}." + exit ${STATUS} + fi + fi + + "${FCR_DUMP_SYMS}" -a "${ARCH}" -g "${DSYM_BUNDLE}" "${EXECUTABLE}" >"${SCRATCH}" 2> >(sed -e 's/^/warning: dump_syms: /' | grep -v 'failed to demangle' >&2) + + STATUS=$? + if ((STATUS)); then + xcerror "Command dump_syms failed with exit code ${STATUS}." + exit ${STATUS} + fi + + ${SWIFT_DEMANGLE_COMMAND} <"${SCRATCH}" >|"${!SYMBOL_FILE}" || exit 1 + + if ((VERBOSE >= 2)); then + xcnote "${EXECUTABLE##*/} (architecture ${ARCH}) symbol dump follows (first 20 lines):" + head >&2 -n20 "${!SYMBOL_FILE}" + elif ((VERBOSE >= 1)); then + xcnote "${EXECUTABLE##*/} (architecture ${ARCH}) symbol dump follows (first line only):" + head >&2 -n1 "${!SYMBOL_FILE}" + fi + + fcr_upload_files "${!SYMBOL_FILE}" || exit 1 +done diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/upload-sym-util.bash b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/upload-sym-util.bash new file mode 100644 index 00000000..a8f8c655 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/upload-sym-util.bash @@ -0,0 +1,382 @@ +# Output a clickable message. This will not count as a warning or +# error. + +xcnote () { + echo >&2 "${BASH_SOURCE[1]}:${BASH_LINENO[0]}: note: $*" +} + +# Output a clickable message prefixed with a warning symbol (U+26A0) +# and highlighted yellow. This will increase the overall warning +# count. A non-zero value for the variable ERRORS_ONLY will force +# warnings to be treated as errors. + +if ((ERRORS_ONLY)); then + xcwarning () { + echo >&2 "${BASH_SOURCE[1]}:${BASH_LINENO[0]}: error: $*" + } +else + xcwarning () { + echo >&2 "${BASH_SOURCE[1]}:${BASH_LINENO[0]}: warning: $*" + } +fi + +# Output a clickable message prefixed with a halt symbol (U+1F6D1) and +# highlighted red. This will increase the overall error count. Xcode +# will flag the build as failed if the error count is non-zero at the +# end of the build, even if this script returns a successful exit +# code. Set WARNINGS_ONLY to non-zero to prevent this. + +if ((WARNINGS_ONLY)); then + xcerror () { + echo >&2 "${BASH_SOURCE[1]}:${BASH_LINENO[0]}: warning: $*" + } +else + xcerror () { + echo >&2 "${BASH_SOURCE[1]}:${BASH_LINENO[0]}: error: $*" + } +fi + +xcdebug () { + if ((VERBOSE)); then + echo >&2 "${BASH_SOURCE[1]}:${BASH_LINENO[0]}: note: $*" + fi +} + +# Locate the script directory. + +script_dir () { + local SCRIPT="$0" SCRIPT_DIR="$(dirname "$0")" + + while SCRIPT="$(readlink "${SCRIPT}")"; do + [[ "${SCRIPT}" != /* ]] && SCRIPT="${SCRIPT_DIR}/${SCRIPT}" + SCRIPT_DIR="$(dirname "${SCRIPT}")" + done + + ( cd "${SCRIPT_DIR}"; pwd -P ) +} + +# Timestamp needed for various operations. Does not need to be exact, +# but does need to be consistent across web service calls. + +readonly NOW="$(/bin/date +%s)" + +# All files created by fcr_mktemp will be listed in FCR_TEMPORARY_FILES. +# Delete these when the enclosing script exits. (You may manually +# add files to this array as well to have them cleaned up on exit.) + +typeset -a FCR_TEMPORARY_FILES +trap 'STATUS=$?; rm -rf "${FCR_TEMPORARY_FILES[@]}"; exit ${STATUS}' 0 1 2 15 + +# Create a temporary file and add it to the list of files to delete when the +# script finishes. +# +# usage: fcr_mktemp VARNAME... + +fcr_mktemp () { + for VAR; do + eval "${VAR}=\$(mktemp -t com.google.FIRCrash) || return 1" + FCR_TEMPORARY_FILES+=("${!VAR}") + done +} + +# Create a temporary directory and add it to the list of files to +# delete when the script finishes. +# +# usage: fcr_mktempdir VARNAME... + +fcr_mktempdir () { + for VAR; do + eval "${VAR}=\$(mktemp -d -t com.google.FIRCrash) || return 1" + FCR_TEMPORARY_FILES+=("${!VAR}") + done +} + +# The keys we care about in the JSON objects. There are others that +# we do not use. Note that 'expires_at' and 'app_id' are not part of +# the original payload, but are computed from the environment used to +# make the call. + +FCR_SVC_KEYS=(client_email private_key private_key_id token_uri type) +FCR_TOK_KEYS=(access_token expires_at token_type app_id) + +# Extract a value from the property list. +# +# usage: property *name* *file* + +property () { + [[ -f "$2" ]] || echo '{}' >|"$2" # keeps PlistBuddy quiet + /usr/libexec/PlistBuddy "$2" -c "Print :$1" 2>/dev/null +} + +# Retrieve the property from the service account property list. +# +# usage: svc_property *name* + +svc_property () { + property "$1" "${SVC_PLIST}" +} + +# Does the same as svc_property above but for the token cache +# property list. +# +# usage: tok_property *name* + +tok_property () { + property "$1" "${TOK_PLIST}" +} + +# Verify that the service account property list has values for the +# required keys. Does not check the values themselves. + +fcr_verify_svc_plist () { + for key in "${FCR_SVC_KEYS[@]}"; do + if ! svc_property "${key}" >/dev/null; then + xcdebug "${key} not found in ${SVC_PLIST}. Service account invalid." + return 1 + fi + done +} + +# Verify that the token cache property list has values for the +# required keys. If the token_type is incorrect, the expiration date +# has been passed, or the application id does not match, return +# failure. + +fcr_verify_tok_plist () { + for key in "${FCR_TOK_KEYS[@]}"; do + if ! tok_property "${key}" >/dev/null; then + xcdebug "${key} not found in ${TOK_PLIST}. Token invalid." + return 1 + fi + done + + if [[ "$(tok_property token_type)" != "Bearer" ]]; then + xcwarning "Invalid token type '$(tok_property token_type)'." + return 1 + fi + + if (($(tok_property expires_at) <= NOW)); then + xcdebug "Token well-formed but expired at $(date -jf %s "$(tok_property expires_at)")." + echo '{}' >|"${TOK_PLIST}" + return 1 + fi + + if [[ "$(tok_property app_id)" != "${FIREBASE_APP_ID}" ]]; then + xcdebug "Cached token is for a different application." + echo '{}' >|"${TOK_PLIST}" + return 1 + fi +} + +# Convert a JSON certificate file to a PList certificate file. +# +# usage: fcr_load_certificate VARNAME + +fcr_load_certificate () { + : "${SERVICE_ACCOUNT_FILE:?must be the path to the service account JSON file.}" + fcr_mktemp "$1" + + if ! /usr/bin/plutil -convert binary1 "${SERVICE_ACCOUNT_FILE}" -o "${!1}"; then + xcerror "Unable to read service account file ${SERVICE_ACCOUNT_FILE}." + return 2 + fi +} + +# BASE64URL uses a sligtly different character set than BASE64, and +# uses no padding characters. + +function base64url () { + /usr/bin/base64 | sed -e 's/=//g; s/+/-/g; s/\//_/g' +} + +# Assemble the JSON Web Token (RFC 1795) +# +# usage: fcr_create_jwt *client-email* *token-uri* + +fcr_create_jwt () { + local JWT_HEADER="$(base64url <<<'{"alg":"RS256","typ":"JWT"}')" + local JWT_CLAIM="$(base64url <<<'{'"\"iss\":\"${1:?}\",\"aud\":\"${2:?}\",\"exp\":\"$((NOW + 3600))\",\"iat\":\"${NOW}\",\"scope\":\"https://www.googleapis.com/auth/mobilecrashreporting\""'}')" + local JWT_BODY="${JWT_HEADER}.${JWT_CLAIM}" + local JWT_SIG="$(echo -n "${JWT_BODY}" | openssl dgst -sha256 -sign <(svc_property private_key) -binary | base64url)" + + echo "${JWT_BODY}.${JWT_SIG}" +} + +# Set the BEARER_TOKEN variable for authentication. +# +# usage: fcr_authenticate + +fcr_authenticate () { + : "${FIREBASE_APP_ID:?required to select authentication credentials}" + + local SVC_PLIST + + fcr_load_certificate SVC_PLIST || return 2 + + local TOK_PLIST="${HOME}/Library/Preferences/com.google.SymbolUploadToken.plist" + + if ((VERBOSE > 2)); then + CURLOPT='--trace-ascii /dev/fd/2' + elif ((VERBOSE > 1)); then + CURLOPT='--verbose' + else + CURLOPT='' + fi + + # If the token will expire in the next sixty seconds (or already + # has), reload it. + if ! fcr_verify_tok_plist; then + xcdebug "Token cannot be used. Requesting OAuth2 token using installed credentials." + + if ! fcr_verify_svc_plist; then + xcerror "Incorrect/incomplete service account file." + return 2 + else + xcdebug "Certificate information appears valid." + fi + + TOKEN_URI="$(svc_property token_uri)" + CLIENT_EMAIL="$(svc_property client_email)" + + # Assemble the JSON Web Token (RFC 1795) + local JWT="$(fcr_create_jwt "${CLIENT_EMAIL}" "${TOKEN_URI}")" + + fcr_mktemp TOKEN_JSON + + HTTP_STATUS="$(curl ${CURLOPT} -o "${TOKEN_JSON}" -s -d grant_type='urn:ietf:params:oauth:grant-type:jwt-bearer' -d assertion="${JWT}" -w '%{http_code}' "${TOKEN_URI}")" + + if [[ "${HTTP_STATUS}" == 403 ]]; then + xcerror "Invalid certificate. Unable to retrieve OAuth2 token." + return 2 + elif [[ "${HTTP_STATUS}" != 200 ]]; then + cat >&2 "${TOKEN_JSON}" + return 2 + fi + + # Store the token in the preferences directory for future use. + /usr/bin/plutil -convert binary1 "${TOKEN_JSON}" -o "${TOK_PLIST}" + + EXPIRES_IN="$(tok_property expires_in)" + EXPIRES_AT="$((EXPIRES_IN + NOW))" + + /usr/libexec/PlistBuddy \ + -c "Add :app_id string \"${FIREBASE_APP_ID}\"" \ + -c "Add :expires_at integer ${EXPIRES_AT}" \ + -c "Add :expiration_date date $(TZ=GMT date -jf %s ${EXPIRES_AT})" \ + "${TOK_PLIST}" + + if ! fcr_verify_tok_plist; then + ((VERBOSE)) && /usr/libexec/PlistBuddy -c 'Print' "${TOK_PLIST}" + + echo '{}' >|"${TOK_PLIST}" + xcwarning "Token returned is not valid." + xcnote "If this error persists, download a fresh certificate." + + return 2 + fi + else + xcdebug "Token still valid." + EXPIRES_AT="$(tok_property expires_at)" + fi + + xcdebug "Token will expire on $(date -jf %s "${EXPIRES_AT}")." + xcdebug "Using service account with key $(svc_property private_key_id)." + + BEARER_TOKEN="$(tok_property access_token)" + + if [[ ! "${BEARER_TOKEN}" ]]; then + if ((VERBOSE)); then + xcwarning "Current malformed token cache:" + tok_property | while read; do xcnote "${REPLY}"; done + fi + xcerror "Unable to retrieve authentication token from server." + return 2 + fi + + return 0 +} + +# Upload the files to the server. +# +# Arguments: Names of files to upload. + +fcr_upload_files() { + fcr_authenticate || return $? + + : "${FCR_PROD_VERS:?}" + : "${FCR_BUNDLE_ID:?}" + : "${FIREBASE_APP_ID:?}" + : "${FIREBASE_API_KEY:?}" + : "${FCR_BASE_URL:=https://mobilecrashreporting.googleapis.com}" + + fcr_mktemp FILE_UPLOAD_LOCATION_PLIST META_UPLOAD_RESULT_PLIST + + if ((VERBOSE > 2)); then + CURLOPT='--trace-ascii /dev/fd/2' + elif ((VERBOSE > 1)); then + CURLOPT='--verbose' + else + CURLOPT='' + fi + + for FILE; do + xcdebug "Get signed URL for uploading." + + URL="${FCR_BASE_URL}/v1/apps/${FIREBASE_APP_ID}" + + HTTP_STATUS="$(curl ${CURLOPT} -o "${FILE_UPLOAD_LOCATION_PLIST}" -sL -H "X-Ios-Bundle-Identifier: ${FCR_BUNDLE_ID}" -H "Authorization: Bearer ${BEARER_TOKEN}" -X POST -d '' -w '%{http_code}' "${URL}/symbolFileUploadLocation?key=${FIREBASE_API_KEY}")" + STATUS=$? + + if [[ "${STATUS}" == 22 && "${HTTP_STATUS}" == 403 ]]; then + xcerror "Unable to access resource. Token invalid." + xcnote "Please verify the service account file." + return 2 + elif [[ "${STATUS}" != 0 ]]; then + xcerror "curl exited with non-zero status ${STATUS}." + ((STATUS == 22)) && xcerror "HTTP response code is ${HTTP_STATUS}." + return 2 + fi + + /usr/bin/plutil -convert binary1 "${FILE_UPLOAD_LOCATION_PLIST}" || return 1 + + UPLOAD_KEY="$(property uploadKey "${FILE_UPLOAD_LOCATION_PLIST}")" + UPLOAD_URL="$(property uploadUrl "${FILE_UPLOAD_LOCATION_PLIST}")" + ERRMSG="$(property error:message "${FILE_UPLOAD_LOCATION_PLIST}")" + + if [[ "${ERRMSG}" ]]; then + if ((VERBOSE)); then + xcnote "Server response:" + /usr/bin/plutil -p "${FILE_UPLOAD_LOCATION_PLIST}" >&2 + fi + xcerror "symbolFileUploadLocation: ${ERRMSG}" + xcnote "symbolFileUploadLocation: Failed to get upload location." + return 1 + fi + + xcdebug "Upload symbol file." + + HTTP_STATUS=$(curl ${CURLOPT} -sfL -H 'Content-Type: text/plain' -H "Authorization: Bearer ${BEARER_TOKEN}" -w '%{http_code}' -T "${FILE}" "${UPLOAD_URL}") + STATUS=$? + + if ((STATUS == 22)); then # exit code 22 is a non-successful HTTP response + xcerror "upload: Unable to upload symbol file (HTTP Status ${HTTP_STATUS})." + return 1 + elif ((STATUS != 0)); then + xcerror "upload: Unable to upload symbol file (reason unknown)." + return 1 + fi + + xcdebug "Upload metadata information." + + curl ${CURLOPT} -sL -H 'Content-Type: application/json' -H "X-Ios-Bundle-Identifier: ${FCR_BUNDLE_ID}" -H "Authorization: Bearer ${BEARER_TOKEN}" -X POST -d '{"upload_key":"'"${UPLOAD_KEY}"'","symbol_file_mapping":{"symbol_type":2,"app_version":"'"${FCR_PROD_VERS}"'"}}' "${URL}/symbolFileMappings:upsert?key=${FIREBASE_API_KEY}" >|"${META_UPLOAD_RESULT_PLIST}" || return 1 + /usr/bin/plutil -convert binary1 "${META_UPLOAD_RESULT_PLIST}" || return 1 + + ERRMSG="$(property error:message "${META_UPLOAD_RESULT_PLIST}")" + + if [[ "${ERRMSG}" ]]; then + xcerror "symbolFileMappings:upsert: ${ERRMSG}" + xcnote "symbolFileMappings:upsert: The metadata for the symbol file failed to update." + return 1 + fi + done +} diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/upload-sym.sh b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/upload-sym.sh new file mode 100755 index 00000000..c0a34e38 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Crash/upload-sym.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "$0:0: error: $0 has been removed. Please use upload-sym instead." +exit 1 diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Firebase.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Firebase.h new file mode 100644 index 00000000..90798a6a --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Firebase.h @@ -0,0 +1,52 @@ +#import <FirebaseAnalytics/FirebaseAnalytics.h> +#import <FirebaseCore/FirebaseCore.h> + +#if !defined(__has_include) + #error "Firebase.h won't import anything if your compiler doesn't support __has_include. Please \ + import the headers individually." +#else + #if __has_include(<FirebaseAppIndexing/FirebaseAppIndexing.h>) + #import <FirebaseAppIndexing/FirebaseAppIndexing.h> + #endif + + #if __has_include(<FirebaseAuth/FirebaseAuth.h>) + #import <FirebaseAuth/FirebaseAuth.h> + #endif + + #if __has_include(<FirebaseCrash/FirebaseCrash.h>) + #import <FirebaseCrash/FirebaseCrash.h> + #endif + + #if __has_include(<FirebaseDatabase/FirebaseDatabase.h>) + #import <FirebaseDatabase/FirebaseDatabase.h> + #endif + + #if __has_include(<FirebaseDynamicLinks/FirebaseDynamicLinks.h>) + #import <FirebaseDynamicLinks/FirebaseDynamicLinks.h> + #endif + + #if __has_include(<FirebaseInstanceID/FirebaseInstanceID.h>) + #import <FirebaseInstanceID/FirebaseInstanceID.h> + #endif + + #if __has_include(<FirebaseInvites/FirebaseInvites.h>) + #import <FirebaseInvites/FirebaseInvites.h> + #endif + + #if __has_include(<FirebaseMessaging/FirebaseMessaging.h>) + #import <FirebaseMessaging/FirebaseMessaging.h> + #endif + + #if __has_include(<FirebaseRemoteConfig/FirebaseRemoteConfig.h>) + #import <FirebaseRemoteConfig/FirebaseRemoteConfig.h> + #endif + + #if __has_include(<FirebaseStorage/FirebaseStorage.h>) + #import <FirebaseStorage/FirebaseStorage.h> + #endif + + #if __has_include(<GoogleMobileAds/GoogleMobileAds.h>) + #import <GoogleMobileAds/GoogleMobileAds.h> + #endif + +#endif // defined(__has_include) diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/FirebaseMessaging b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/FirebaseMessaging Binary files differnew file mode 100755 index 00000000..a0573d06 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/FirebaseMessaging diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/Headers/FIRMessaging.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/Headers/FIRMessaging.h new file mode 100755 index 00000000..a0ae2e90 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/Headers/FIRMessaging.h @@ -0,0 +1,227 @@ +#import <Foundation/Foundation.h> + +/** + * The completion handler invoked once the data connection with FIRMessaging is + * established. The data connection is used to send a continous stream of + * data and all the FIRMessaging data notifications arrive through this connection. + * Once the connection is established we invoke the callback with `nil` error. + * Correspondingly if we get an error while trying to establish a connection + * we invoke the handler with an appropriate error object and do an + * exponential backoff to try and connect again unless successful. + * + * @param error The error object if any describing why the data connection + * to FIRMessaging failed. + */ +typedef void(^FIRMessagingConnectCompletion)(NSError * __nullable error); + +/** + * Notification sent when the upstream message has been delivered + * successfully to the server. The notification object will be the messageID + * of the successfully delivered message. + */ +FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendSuccessNotification; + +/** + * Notification sent when the upstream message was failed to be sent to the + * server. The notification object will be the messageID of the failed + * message. The userInfo dictionary will contain the relevant error + * information for the failure. + */ +FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendErrorNotification; + +/** + * Notification sent when the Firebase messaging server deletes pending + * messages due to exceeded storage limits. This may occur, for example, when + * the device cannot be reached for an extended period of time. + * + * It is recommended to retrieve any missing messages directly from the + * server. + */ +FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingMessagesDeletedNotification; + +/** + * @enum FIRMessagingError + */ +typedef NS_ENUM(NSUInteger, FIRMessagingError) { + /// Unknown error. + FIRMessagingErrorUnknown = 0, + + /// FIRMessaging couldn't validate request from this client. + FIRMessagingErrorAuthentication = 1, + + /// InstanceID service cannot be accessed. + FIRMessagingErrorNoAccess = 2, + + /// Request to InstanceID backend timed out. + FIRMessagingErrorTimeout = 3, + + /// No network available to reach the servers. + FIRMessagingErrorNetwork = 4, + + /// Another similar operation in progress, bailing this one. + FIRMessagingErrorOperationInProgress = 5, + + /// Some parameters of the request were invalid. + FIRMessagingErrorInvalidRequest = 7, +}; + +/// Status for the downstream message received by the app. +typedef NS_ENUM(NSInteger, FIRMessagingMessageStatus) { + /// Unknown status. + FIRMessagingMessageStatusUnknown, + /// New downstream message received by the app. + FIRMessagingMessageStatusNew, +}; + +/// Information about a downstream message received by the app. +@interface FIRMessagingMessageInfo : NSObject + +/// The status of the downstream message +@property(nonatomic, readonly, assign) FIRMessagingMessageStatus status; + +@end + +/** + * A remote data message received by the app via FCM (not just the APNs interface). + * + * This is only for devices running iOS 10 or above. To support devices running iOS 9 or below, use + * the local and remote notifications handlers defined in UIApplicationDelegate protocol. + */ +@interface FIRMessagingRemoteMessage : NSObject + +/// The downstream message received by the application. +@property(nonatomic, readonly, strong, nonnull) NSDictionary *appData; + +@end + +/** + * A protocol to receive data message via FCM for devices running iOS 10 or above. + * + * To support devices running iOS 9 or below, use the local and remote notifications handlers + * defined in UIApplicationDelegate protocol. + */ +@protocol FIRMessagingDelegate <NSObject> + +/// The callback to handle data message received via FCM for devices running iOS 10 or above. +- (void)applicationReceivedRemoteMessage:(nonnull FIRMessagingRemoteMessage *)remoteMessage; + +@end + +/** + * Firebase Messaging lets you reliably deliver messages at no cost. + * + * To send or receive messages, the app must get a + * registration token from FIRInstanceID. This token authorizes an + * app server to send messages to an app instance. + * + * In order to receive FIRMessaging messages, declare `application:didReceiveRemoteNotification:`. + * + * + */ +@interface FIRMessaging : NSObject + +/** + * Delegate to handle remote data messages received via FCM for devices running iOS 10 or above. + */ +@property(nonatomic, weak, nullable) id<FIRMessagingDelegate> remoteMessageDelegate; + +/** + * FIRMessaging + * + * @return An instance of FIRMessaging. + */ ++ (nonnull instancetype)messaging NS_SWIFT_NAME(messaging()); + +/** + * Unavailable. Use +messaging instead. + */ +- (nonnull instancetype)init __attribute__((unavailable("Use +messaging instead."))); + +#pragma mark - Connect + +/** + * Create a FIRMessaging data connection which will be used to send the data notifications + * sent by your server. It will also be used to send ACKS and other messages based + * on the FIRMessaging ACKS and other messages based on the FIRMessaging protocol. + * + * + * @param handler The handler to be invoked once the connection is established. + * If the connection fails we invoke the handler with an + * appropriate error code letting you know why it failed. At + * the same time, FIRMessaging performs exponential backoff to retry + * establishing a connection and invoke the handler when successful. + */ +- (void)connectWithCompletion:(nonnull FIRMessagingConnectCompletion)handler; + +/** + * Disconnect the current FIRMessaging data connection. This stops any attempts to + * connect to FIRMessaging. Calling this on an already disconnected client is a no-op. + * + * Call this before `teardown` when your app is going to the background. + * Since the FIRMessaging connection won't be allowed to live when in background it is + * prudent to close the connection. + */ +- (void)disconnect; + +#pragma mark - Topics + +/** + * Asynchronously subscribes to a topic. + * + * @param topic The name of the topic, for example, @"sports". + */ +- (void)subscribeToTopic:(nonnull NSString *)topic; + +/** + * Asynchronously unsubscribe from a topic. + * + * @param topic The name of the topic, for example @"sports". + */ +- (void)unsubscribeFromTopic:(nonnull NSString *)topic; + +#pragma mark - Upstream + +/** + * Sends an upstream ("device to cloud") message. + * + * The message is queued if we don't have an active connection. + * You can only use the upstream feature if your FCM implementation + * uses the XMPP server protocol. + * + * @param message Key/Value pairs to be sent. Values must be String, any + * other type will be ignored. + * @param to A string identifying the receiver of the message. For FCM + * project IDs the value is `SENDER_ID@gcm.googleapis.com`. + * @param messageID The ID of the message. This is generated by the application. It + * must be unique for each message generated by this application. + * It allows error callbacks and debugging, to uniquely identify + * each message. + * @param ttl The time to live for the message. In case we aren't able to + * send the message before the TTL expires we will send you a + * callback. If 0, we'll attempt to send immediately and return + * an error if we're not connected. Otherwise, the message will + * be queued. As for server-side messages, we don't return an error + * if the message has been dropped because of TTL; this can happen + * on the server side, and it would require extra communication. + */ +- (void)sendMessage:(nonnull NSDictionary *)message + to:(nonnull NSString *)receiver + withMessageID:(nonnull NSString *)messageID + timeToLive:(int64_t)ttl; + +#pragma mark - Analytics + +/** + * Use this to track message delivery and analytics for messages, typically + * when you receive a notification in `application:didReceiveRemoteNotification:`. + * However, you only need to call this if you set the `FirebaseAppDelegateProxyEnabled` + * flag to NO in your Info.plist. If `FirebaseAppDelegateProxyEnabled` is either missing + * or set to YES in your Info.plist, the library will call this automatically. + * + * @param message The downstream message received by the application. + * + * @return Information about the downstream message. + */ +- (nonnull FIRMessagingMessageInfo *)appDidReceiveMessage:(nonnull NSDictionary *)message; + +@end diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/Headers/FirebaseMessaging.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/Headers/FirebaseMessaging.h new file mode 100755 index 00000000..ef49e7ff --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/Headers/FirebaseMessaging.h @@ -0,0 +1 @@ +#import "FIRMessaging.h" diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/Modules/module.modulemap b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/Modules/module.modulemap new file mode 100755 index 00000000..80bc59c1 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/FirebaseMessaging.framework/Modules/module.modulemap @@ -0,0 +1,11 @@ +framework module FirebaseMessaging { + umbrella header "FirebaseMessaging.h" + export * + module * { export *} + link "sqlite3" + link "z" + link framework "CoreGraphics" + link framework "Foundation" + link framework "SystemConfiguration" + link framework "UIKit" +}
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/Protobuf.framework/Protobuf b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/Protobuf.framework/Protobuf Binary files differnew file mode 100644 index 00000000..546e02ec --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/Messaging/Protobuf.framework/Protobuf diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/FirebaseRemoteConfig b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/FirebaseRemoteConfig Binary files differnew file mode 100755 index 00000000..45637862 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/FirebaseRemoteConfig diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/Headers/FIRRemoteConfig.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/Headers/FIRRemoteConfig.h new file mode 100755 index 00000000..395020ca --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/Headers/FIRRemoteConfig.h @@ -0,0 +1,224 @@ +// +// FIRRemoteConfig.h +// Firebase Remote Config service SDK +// Copyright 2016 Google Inc. All rights reserved. +// +#import <Foundation/Foundation.h> + +/// The Firebase Remote Config service default namespace, to be used if the API method does not +/// specify a different namespace. Use the default namespace if configuring from the Google Firebase +/// service. +extern NSString *const __nonnull FIRNamespaceGoogleMobilePlatform; + +/// Key used to manage throttling in NSError user info when the refreshing of Remote Config +/// parameter values (data) is throttled. The value of this key is the elapsed time since 1970, +/// measured in seconds. +extern NSString *const __nonnull FIRRemoteConfigThrottledEndTimeInSecondsKey; + +/// Indicates whether updated data was successfully fetched. +typedef NS_ENUM(NSInteger, FIRRemoteConfigFetchStatus) { + /// Config has never been fetched. + FIRRemoteConfigFetchStatusNoFetchYet, + /// Config fetch succeeded. + FIRRemoteConfigFetchStatusSuccess, + /// Config fetch failed. + FIRRemoteConfigFetchStatusFailure, + /// Config fetch was throttled. + FIRRemoteConfigFetchStatusThrottled, +}; + +/// Remote Config error domain that handles errors when fetching data from the service. +extern NSString *const __nonnull FIRRemoteConfigErrorDomain; +/// Firebase Remote Config service fetch error. +typedef NS_ENUM(NSInteger, FIRRemoteConfigError) { + /// Unknown or no error. + FIRRemoteConfigErrorUnknown = 8001, + /// Frequency of fetch requests exceeds throttled limit. + FIRRemoteConfigErrorThrottled = 8002, + /// Internal error that covers all internal HTTP errors. + FIRRemoteConfigErrorInternalError = 8003, +}; + +/// Enumerated value that indicates the source of Remote Config data. Data can come from +/// the Remote Config service, the DefaultConfig that is available when the app is first installed, +/// or a static initialized value if data is not available from the service or DefaultConfig. +typedef NS_ENUM(NSInteger, FIRRemoteConfigSource) { + FIRRemoteConfigSourceRemote, ///< The data source is the Remote Config service. + FIRRemoteConfigSourceDefault, ///< The data source is the DefaultConfig defined for this app. + FIRRemoteConfigSourceStatic, ///< The data doesn't exist, return a static initialized value. +}; + +/// Completion handler invoked by fetch methods when they get a response from the server. +/// +/// @param status Config fetching status. +/// @param error Error message on failure. +typedef void (^FIRRemoteConfigFetchCompletion)(FIRRemoteConfigFetchStatus status, + NSError *__nullable error); + +#pragma mark - FIRRemoteConfigValue +/// This class provides a wrapper for Remote Config parameter values, with methods to get parameter +/// values as different data types. +@interface FIRRemoteConfigValue : NSObject<NSCopying> +/// Gets the value as a string. +@property(nonatomic, readonly, nullable) NSString *stringValue; +/// Gets the value as a number value. +@property(nonatomic, readonly, nullable) NSNumber *numberValue; +/// Gets the value as a NSData object. +@property(nonatomic, readonly, nonnull) NSData *dataValue; +/// Gets the value as a boolean. +@property(nonatomic, readonly) BOOL boolValue; +/// Identifies the source of the fetched value. +@property(nonatomic, readonly) FIRRemoteConfigSource source; +@end + +#pragma mark - FIRRemoteConfigSettings +/// Firebase Remote Config settings. +@interface FIRRemoteConfigSettings : NSObject +/// Indicates whether Developer Mode is enabled. +@property(nonatomic, readonly) BOOL isDeveloperModeEnabled; +/// Initializes FIRRemoteConfigSettings, which is used to set properties for custom settings. To +/// make custom settings take effect, pass the FIRRemoteConfigSettings instance to the +/// configSettings property of FIRRemoteConfig. +- (nullable FIRRemoteConfigSettings *)initWithDeveloperModeEnabled:(BOOL)developerModeEnabled + NS_DESIGNATED_INITIALIZER; +@end + +#pragma mark - FIRRemoteConfig +/// Firebase Remote Config class. The shared instance method +remoteConfig can be created and used +/// to fetch, activate and read config results and set default config results. +@interface FIRRemoteConfig : NSObject<NSFastEnumeration> +/// Last successful fetch completion time. +@property(nonatomic, readonly, strong, nullable) NSDate *lastFetchTime; +/// Last fetch status. The status can be any enumerated value from FIRRemoteConfigFetchStatus. +@property(nonatomic, readonly, assign) FIRRemoteConfigFetchStatus lastFetchStatus; +/// Config settings are custom settings. +@property(nonatomic, readwrite, strong, nonnull) FIRRemoteConfigSettings *configSettings; + +/// Returns the FIRRemoteConfig instance shared throughout your app. This singleton object contains +/// the complete set of Remote Config parameter values available to the app, including the Active +/// Config and Default Config. This object also caches values fetched from the Remote Config Server +/// until they are copied to the Active Config by calling activateFetched. +/// When you fetch values from the Remote Config Server using the default Firebase namespace +/// service, you should use this class method to create a shared instance of the FIRRemoteConfig +/// object to ensure that your app will function properly with the Remote Config Server and the +/// Firebase service. ++ (nonnull FIRRemoteConfig *)remoteConfig NS_SWIFT_NAME(remoteConfig()); + +/// Unavailable. Use +remoteConfig instead. +- (nonnull instancetype)init __attribute__((unavailable("Use +remoteConfig instead."))); + +#pragma mark - Fetch +/// Fetches Remote Config data with a callback. Call activateFetched to make fetched data available +/// to your app. +/// @param completionHandler Fetch operation callback. +- (void)fetchWithCompletionHandler:(nullable FIRRemoteConfigFetchCompletion)completionHandler; + +/// Fetches Remote Config data and sets a duration that specifies how long config data lasts. +/// Call activateFetched to make fetched data available to your app. +/// @param expirationDuration Duration that defines how long fetched config data is available, in +/// seconds. When the config data expires, a new fetch is required. +/// @param completionHandler Fetch operation callback. +- (void)fetchWithExpirationDuration:(NSTimeInterval)expirationDuration + completionHandler:(nullable FIRRemoteConfigFetchCompletion)completionHandler; + +#pragma mark - Apply +/// Applies Fetched Config data to the Active Config, causing updates to the behavior and appearance +/// of the app to take effect (depending on how config data is used in the app). +/// Returns true if there was a Fetched Config, and it was activated. +/// Returns false if no Fetched Config was found, or the Fetched Config was already activated. +- (BOOL)activateFetched; + +#pragma mark - Get Config +/// Enables access to configuration values by using object subscripting syntax. +/// This is used to get the config value of the default namespace. +/// <pre> +/// // Example: +/// FIRRemoteConfig *config = [FIRRemoteConfig remoteConfig]; +/// FIRRemoteConfigValue *value = config[@"yourKey"]; +/// BOOL b = value.boolValue; +/// NSNumber *number = config[@"yourKey"].numberValue; +/// </pre> +- (nonnull FIRRemoteConfigValue *)objectForKeyedSubscript:(nonnull NSString *)key; + +/// Gets the config value of the default namespace. +/// @param key Config key. +- (nonnull FIRRemoteConfigValue *)configValueForKey:(nullable NSString *)key; + +/// Gets the config value of a given namespace. +/// @param key Config key. +/// @param aNamespace Config results under a given namespace. +- (nonnull FIRRemoteConfigValue *)configValueForKey:(nullable NSString *)key + namespace:(nullable NSString *)aNamespace; + +/// Gets the config value of a given namespace and a given source. +/// @param key Config key. +/// @param aNamespace Config results under a given namespace. +/// @param source Config value source. +- (nonnull FIRRemoteConfigValue *)configValueForKey:(nullable NSString *)key + namespace:(nullable NSString *)aNamespace + source:(FIRRemoteConfigSource)source; + +/// Gets all the parameter keys from a given source and a given namespace. +/// +/// @param source The config data source. +/// @param aNamespace The config data namespace. +/// @return An array of keys under the given source and namespace. +- (nonnull NSArray<NSString *> *)allKeysFromSource:(FIRRemoteConfigSource)source + namespace:(nullable NSString *)aNamespace; + +/// Returns the set of parameter keys that start with the given prefix, from the default namespace +/// in the active config. +/// +/// @param prefix The key prefix to look for. If prefix is nil or empty, returns all the +/// keys. +/// @return The set of parameter keys that start with the specified prefix. +- (nonnull NSSet<NSString *> *)keysWithPrefix:(nullable NSString *)prefix; + +/// Returns the set of parameter keys that start with the given prefix, from the given namespace in +/// the active config. +/// +/// @param prefix The key prefix to look for. If prefix is nil or empty, returns all the +/// keys in the given namespace. +/// @param aNamespace The namespace in which to look up the keys. If the namespace is invalid, +/// returns an empty set. +/// @return The set of parameter keys that start with the specified prefix. +- (nonnull NSSet<NSString *> *)keysWithPrefix:(nullable NSString *)prefix + namespace:(nullable NSString *)aNamespace; + +#pragma mark - Defaults +/// Sets config defaults for parameter keys and values in the default namespace config. +/// +/// @param defaultConfig A dictionary mapping a NSString * key to a NSObject * value. +- (void)setDefaults:(nullable NSDictionary<NSString *, NSObject *> *)defaults; + +/// Sets config defaults for parameter keys and values in the default namespace config. +/// +/// @param defaultConfig A dictionary mapping a NSString * key to a NSObject * value. +/// @param aNamespace Config under a given namespace. +- (void)setDefaults:(nullable NSDictionary<NSString *, NSObject *> *)defaultConfig + namespace:(nullable NSString *)aNamespace; + +/// Sets default configs from plist for default namespace; +/// @param fileName The plist file name, with no file name extension. For example, if the plist file +/// is defaultSamples.plist, call: +/// [[FIRRemoteConfig remoteConfig] setDefaultsFromPlistFileName:@"defaultSamples"]; +- (void)setDefaultsFromPlistFileName:(nullable NSString *)fileName; + +/// Sets default configs from plist for a given namespace; +/// @param fileName The plist file name, with no file name extension. For example, if the plist file +/// is defaultSamples.plist, call: +/// [[FIRRemoteConfig remoteConfig] setDefaultsFromPlistFileName:@"defaultSamples"]; +/// @param aNamespace The namespace where the default config is set. +- (void)setDefaultsFromPlistFileName:(nullable NSString *)fileName + namespace:(nullable NSString *)aNamespace; + +/// Returns the default value of a given key and a given namespace from the default config. +/// +/// @param key The parameter key of default config. +/// @param aNamespace The namespace of default config. +/// @return Returns the default value of the specified key and namespace. Returns +/// nil if the key or namespace doesn't exist in the default config. +- (nullable FIRRemoteConfigValue *)defaultValueForKey:(nullable NSString *)key + namespace:(nullable NSString *)aNamespace; + +@end diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/Headers/FirebaseRemoteConfig.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/Headers/FirebaseRemoteConfig.h new file mode 100755 index 00000000..eedc4fce --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/Headers/FirebaseRemoteConfig.h @@ -0,0 +1 @@ +#import "FIRRemoteConfig.h" diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/Modules/module.modulemap b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/Modules/module.modulemap new file mode 100755 index 00000000..a6627f5e --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/FirebaseRemoteConfig.framework/Modules/module.modulemap @@ -0,0 +1,11 @@ +framework module FirebaseRemoteConfig { + umbrella header "FirebaseRemoteConfig.h" + export * + module * { export *} + link "c++" + link "sqlite3" + link "z" + link framework "CoreGraphics" + link framework "Foundation" + link framework "UIKit" +}
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/Protobuf.framework/Protobuf b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/Protobuf.framework/Protobuf Binary files differnew file mode 100644 index 00000000..546e02ec --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/Firebase/RemoteConfig/Protobuf.framework/Protobuf diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/FirebasePlugin.h b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/FirebasePlugin.h new file mode 100755 index 00000000..93542737 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/FirebasePlugin.h @@ -0,0 +1,30 @@ +#import <Cordova/CDV.h>
+#import "AppDelegate.h"
+
+@interface FirebasePlugin : CDVPlugin
++ (FirebasePlugin *) firebasePlugin;
+- (void)getInstanceId:(CDVInvokedUrlCommand*)command;
+- (void)getToken:(CDVInvokedUrlCommand*)command;
+- (void)grantPermission:(CDVInvokedUrlCommand*)command;
+- (void)hasPermission:(CDVInvokedUrlCommand*)command;
+- (void)setBadgeNumber:(CDVInvokedUrlCommand*)command;
+- (void)getBadgeNumber:(CDVInvokedUrlCommand*)command;
+- (void)subscribe:(CDVInvokedUrlCommand*)command;
+- (void)unsubscribe:(CDVInvokedUrlCommand*)command;
+- (void)unregister:(CDVInvokedUrlCommand*)command;
+- (void)onNotificationOpen:(CDVInvokedUrlCommand*)command;
+- (void)onTokenRefresh:(CDVInvokedUrlCommand*)command;
+- (void)sendNotification:(NSDictionary*)userInfo;
+- (void)sendToken:(NSString*)token;
+- (void)logEvent:(CDVInvokedUrlCommand*)command;
+- (void)setScreenName:(CDVInvokedUrlCommand*)command;
+- (void)setUserId:(CDVInvokedUrlCommand*)command;
+- (void)setUserProperty:(CDVInvokedUrlCommand*)command;
+- (void)fetch:(CDVInvokedUrlCommand*)command;
+- (void)activateFetched:(CDVInvokedUrlCommand*)command;
+- (void)getValue:(CDVInvokedUrlCommand*)command;
+@property (nonatomic, copy) NSString *notificationCallbackId;
+@property (nonatomic, copy) NSString *tokenRefreshCallbackId;
+@property (nonatomic, retain) NSMutableArray *notificationStack;
+
+@end
diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/FirebasePlugin.m b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/FirebasePlugin.m new file mode 100644 index 00000000..580fb760 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/FirebasePlugin.m @@ -0,0 +1,331 @@ +#import "FirebasePlugin.h" +#import <Cordova/CDV.h> +#import "AppDelegate.h" +#import "Firebase.h" +@import FirebaseInstanceID; +@import FirebaseMessaging; +@import FirebaseAnalytics; +@import FirebaseRemoteConfig; + +#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 +@import UserNotifications; +#endif + +#ifndef NSFoundationVersionNumber_iOS_9_x_Max +#define NSFoundationVersionNumber_iOS_9_x_Max 1299 +#endif + +@implementation FirebasePlugin + +@synthesize notificationCallbackId; +@synthesize tokenRefreshCallbackId; +@synthesize notificationStack; + +static NSInteger const kNotificationStackSize = 10; +static FirebasePlugin *firebasePlugin; + ++ (FirebasePlugin *) firebasePlugin { + return firebasePlugin; +} + +- (void)pluginInitialize { + NSLog(@"Starting Firebase plugin"); + firebasePlugin = self; +} + +// DEPRECATED - alias of getToken +- (void)getInstanceId:(CDVInvokedUrlCommand *)command { + CDVPluginResult *pluginResult; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: + [[FIRInstanceID instanceID] token]]; + + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (void)getToken:(CDVInvokedUrlCommand *)command { + CDVPluginResult *pluginResult; + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: + [[FIRInstanceID instanceID] token]]; + + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} +- (void)hasPermission:(CDVInvokedUrlCommand *)command +{ + BOOL enabled = NO; + UIApplication *application = [UIApplication sharedApplication]; + if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) { + enabled = application.currentUserNotificationSettings.types != UIUserNotificationTypeNone; + } else { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + enabled = application.enabledRemoteNotificationTypes != UIRemoteNotificationTypeNone; +#pragma GCC diagnostic pop + } + + NSMutableDictionary* message = [NSMutableDictionary dictionaryWithCapacity:1]; + [message setObject:[NSNumber numberWithBool:enabled] forKey:@"isEnabled"]; + CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:message]; + [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId]; +} +- (void)grantPermission:(CDVInvokedUrlCommand *)command { + if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) { + if ([[UIApplication sharedApplication]respondsToSelector:@selector(registerUserNotificationSettings:)]) { + UIUserNotificationType notificationTypes = + (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge); + UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil]; + [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; + [[UIApplication sharedApplication] registerForRemoteNotifications]; + } else { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; + #pragma GCC diagnostic pop + } + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + + + #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 + BOOL isIOS10 = TRUE; + #else + BOOL isIOS10 = FALSE; + #endif + + + if ( !isIOS10 ) { + [[UIApplication sharedApplication] registerForRemoteNotifications]; + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + + + + // IOS 10 + UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert|UNAuthorizationOptionSound|UNAuthorizationOptionBadge; + [[UNUserNotificationCenter currentNotificationCenter] + requestAuthorizationWithOptions:authOptions + completionHandler:^(BOOL granted, NSError * _Nullable error) { + + if ( ![NSThread isMainThread] ) { + dispatch_sync(dispatch_get_main_queue(), ^{ + [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self]; + [[FIRMessaging messaging] setRemoteMessageDelegate:self]; + [[UIApplication sharedApplication] registerForRemoteNotifications]; + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus: granted ? CDVCommandStatus_OK : CDVCommandStatus_ERROR]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }); + } + else { + [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self]; + [[FIRMessaging messaging] setRemoteMessageDelegate:self]; + [[UIApplication sharedApplication] registerForRemoteNotifications]; + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + } + } + ]; + + return; +} + +- (void)setBadgeNumber:(CDVInvokedUrlCommand *)command { + int number = [[command.arguments objectAtIndex:0] intValue]; + + [self.commandDelegate runInBackground:^{ + [[UIApplication sharedApplication] setApplicationIconBadgeNumber:number]; + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void)getBadgeNumber:(CDVInvokedUrlCommand *)command { + [self.commandDelegate runInBackground:^{ + long badge = [[UIApplication sharedApplication] applicationIconBadgeNumber]; + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble:badge]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void)subscribe:(CDVInvokedUrlCommand *)command { + NSString* topic = [NSString stringWithFormat:@"/topics/%@", [command.arguments objectAtIndex:0]]; + + [[FIRMessaging messaging] subscribeToTopic: topic]; + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (void)unsubscribe:(CDVInvokedUrlCommand *)command { + NSString* topic = [NSString stringWithFormat:@"/topics/%@", [command.arguments objectAtIndex:0]]; + + [[FIRMessaging messaging] unsubscribeFromTopic: topic]; + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (void)unregister:(CDVInvokedUrlCommand *)command { + [[FIRInstanceID instanceID] deleteIDWithHandler:^void(NSError *_Nullable error){ + if (error) { + NSLog(@"Unable to delete instance"); + } else { + NSString* currentToken = [[FIRInstanceID instanceID] token]; + if (currentToken != nil) { + [self sendToken:currentToken]; + } + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + } + }]; +} + +- (void)onNotificationOpen:(CDVInvokedUrlCommand *)command { + self.notificationCallbackId = command.callbackId; + + if (self.notificationStack != nil && [self.notificationStack count]) { + for (NSDictionary *userInfo in self.notificationStack) { + [self sendNotification:userInfo]; + } + [self.notificationStack removeAllObjects]; + } +} + +- (void)onTokenRefresh:(CDVInvokedUrlCommand *)command { + self.tokenRefreshCallbackId = command.callbackId; + NSString* currentToken = [[FIRInstanceID instanceID] token]; + if (currentToken != nil) { + [self sendToken:currentToken]; + } +} + +- (void)sendNotification:(NSDictionary *)userInfo { + if (self.notificationCallbackId != nil) { + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:userInfo]; + [pluginResult setKeepCallbackAsBool:YES]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:self.notificationCallbackId]; + } else { + if (!self.notificationStack) { + self.notificationStack = [[NSMutableArray alloc] init]; + } + + // stack notifications until a callback has been registered + [self.notificationStack addObject:userInfo]; + + if ([self.notificationStack count] >= kNotificationStackSize) { + [self.notificationStack removeLastObject]; + } + } +} + +- (void)sendToken:(NSString *)token { + if (self.tokenRefreshCallbackId != nil) { + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:token]; + [pluginResult setKeepCallbackAsBool:YES]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:self.tokenRefreshCallbackId]; + } +} + +- (void)logEvent:(CDVInvokedUrlCommand *)command { + [self.commandDelegate runInBackground:^{ + NSString* name = [command.arguments objectAtIndex:0]; + NSDictionary* parameters = [command.arguments objectAtIndex:1]; + + [FIRAnalytics logEventWithName:name parameters:parameters]; + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void)setScreenName:(CDVInvokedUrlCommand *)command { + NSString* name = [command.arguments objectAtIndex:0]; + + [FIRAnalytics setScreenName:name screenClass:NULL]; + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (void)setUserId:(CDVInvokedUrlCommand *)command { + [self.commandDelegate runInBackground:^{ + NSString* id = [command.arguments objectAtIndex:0]; + + [FIRAnalytics setUserID:id]; + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void)setUserProperty:(CDVInvokedUrlCommand *)command { + [self.commandDelegate runInBackground:^{ + NSString* name = [command.arguments objectAtIndex:0]; + NSString* value = [command.arguments objectAtIndex:1]; + + [FIRAnalytics setUserPropertyString:value forName:name]; + + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void)fetch:(CDVInvokedUrlCommand *)command { + [self.commandDelegate runInBackground:^{ + FIRRemoteConfig* remoteConfig = [FIRRemoteConfig remoteConfig]; + + if ([command.arguments count] > 0){ + int expirationDuration = [[command.arguments objectAtIndex:0] intValue]; + + [remoteConfig fetchWithExpirationDuration:expirationDuration completionHandler:^(FIRRemoteConfigFetchStatus status, NSError * _Nullable error) { + if (status == FIRRemoteConfigFetchStatusSuccess) { + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + } + }]; + } else { + [remoteConfig fetchWithCompletionHandler:^(FIRRemoteConfigFetchStatus status, NSError * _Nullable error) { + if (status == FIRRemoteConfigFetchStatusSuccess) { + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + } + }]; + } + }]; +} + +- (void)activateFetched:(CDVInvokedUrlCommand *)command { + [self.commandDelegate runInBackground:^{ + FIRRemoteConfig* remoteConfig = [FIRRemoteConfig remoteConfig]; + BOOL activated = [remoteConfig activateFetched]; + CDVPluginResult *pluginResult; + if (activated) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + } else { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]; + } + + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +- (void)getValue:(CDVInvokedUrlCommand *)command { + [self.commandDelegate runInBackground:^{ + NSString* key = [command.arguments objectAtIndex:0]; + FIRRemoteConfig* remoteConfig = [FIRRemoteConfig remoteConfig]; + NSString* value = remoteConfig[key].stringValue; + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:value]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + }]; +} + +@end diff --git a/StoneIsland/plugins/cordova-plugin-firebase/src/ios/GoogleService-Info.plist b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/GoogleService-Info.plist new file mode 100644 index 00000000..5516ebf3 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/src/ios/GoogleService-Info.plist @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> +</dict> +</plist>
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-firebase/www/firebase-browser.js b/StoneIsland/plugins/cordova-plugin-firebase/www/firebase-browser.js new file mode 100755 index 00000000..93e3936f --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/www/firebase-browser.js @@ -0,0 +1,119 @@ +exports.getInstanceId = function(success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.getToken = function(success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.onNotificationOpen = function(success, error) {
+};
+
+exports.onTokenRefresh = function(success, error) {
+};
+
+exports.grantPermission = function(success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.setBadgeNumber = function(number, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.getBadgeNumber = function(success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.subscribe = function(topic, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.unsubscribe = function(topic, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.logEvent = function(name, params, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.logError = function(message, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.setScreenName = function(name, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.setUserId = function(id, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.setUserProperty = function(name, value, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.activateFetched = function (success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.fetch = function (cacheExpirationSeconds, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.getByteArray = function (key, namespace, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.getValue = function (key, namespace, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.getInfo = function (success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.setConfigSettings = function (settings, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
+
+exports.setDefaults = function (defaults, namespace, success, error) {
+ if (typeof success === 'function') {
+ success();
+ }
+};
diff --git a/StoneIsland/plugins/cordova-plugin-firebase/www/firebase.js b/StoneIsland/plugins/cordova-plugin-firebase/www/firebase.js new file mode 100644 index 00000000..cf67c884 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-firebase/www/firebase.js @@ -0,0 +1,121 @@ +var exec = require('cordova/exec'); + +exports.getInstanceId = function(success, error) { + exec(success, error, "FirebasePlugin", "getInstanceId", []); +}; + +exports.getToken = function(success, error) { + exec(success, error, "FirebasePlugin", "getToken", []); +}; + +exports.onNotificationOpen = function(success, error) { + exec(success, error, "FirebasePlugin", "onNotificationOpen", []); +}; + +exports.onTokenRefresh = function(success, error) { + exec(success, error, "FirebasePlugin", "onTokenRefresh", []); +}; + +exports.grantPermission = function(success, error) { + exec(success, error, "FirebasePlugin", "grantPermission", []); +}; + +exports.hasPermission = function(success, error) { + exec(success, error, "FirebasePlugin", "hasPermission", []); +}; + +exports.setBadgeNumber = function(number, success, error) { + exec(success, error, "FirebasePlugin", "setBadgeNumber", [number]); +}; + +exports.getBadgeNumber = function(success, error) { + exec(success, error, "FirebasePlugin", "getBadgeNumber", []); +}; + +exports.subscribe = function(topic, success, error) { + exec(success, error, "FirebasePlugin", "subscribe", [topic]); +}; + +exports.unsubscribe = function(topic, success, error) { + exec(success, error, "FirebasePlugin", "unsubscribe", [topic]); +}; + +exports.unregister = function(success, error) { + exec(success, error, "FirebasePlugin", "unregister", []); +}; + +exports.logEvent = function(name, params, success, error) { + exec(success, error, "FirebasePlugin", "logEvent", [name, params]); +}; + +exports.logError = function(message, success, error) { + exec(success, error, "FirebasePlugin", "logError", [message]); +}; + +exports.setScreenName = function(name, success, error) { + exec(success, error, "FirebasePlugin", "setScreenName", [name]); +}; + +exports.setUserId = function(id, success, error) { + exec(success, error, "FirebasePlugin", "setUserId", [id]); +}; + +exports.setUserProperty = function(name, value, success, error) { + exec(success, error, "FirebasePlugin", "setUserProperty", [name, value]); +}; + +exports.activateFetched = function (success, error) { + 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); +}; + +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); +}; + +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); +}; + +exports.getInfo = function (success, error) { + exec(success, error, "FirebasePlugin", "getInfo", []); +}; + +exports.setConfigSettings = function (settings, success, error) { + 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); +}; |
