Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ plugins/
*.iml
local.properties
npm-debug.log*
.vscode/
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
Change Log
==========
## Version 6.0.0

* Firebase Remote Config implementation (Android only)
* Added variables to specify the version of dependencies

## Version 5.0.0

* Firebase Performance implementation (Android only)
* Firebase Crashlytics implementation (Android only)
* Android project dependencies versions have been increased

## Version 4.0.0

* Compatible with Tabris.js version 3.0.0+
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ Feature | Supported platforms
--- | ---
[Firebase Cloud Messaging](doc/cloud-messaging.md) | Android, iOS
[Firebase Analytics](doc/analytics.md) | Android, iOS
[Firebase Crashlytics](doc/crashlytics.md) | Android
[Firebase Performance](doc/performance.md) | Android
[Firebase Remote Config](doc/remote-config.md) | Android

## Compatibility

Expand Down
3 changes: 3 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ The Tabris.js Firebase Plugin documentation consists of the following pages:

* [Firebase Cloud Messaging](cloud-messaging.md)
* [Firebase Analytics](analytics.md)
* [Firebase Crashlytics](crashlytics.md)
* [Firebase Performance](performance.md)
* [Firebase Remote Config](remote-config.md)
52 changes: 52 additions & 0 deletions doc/crashlytics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Firebase Crashlytics

## Enable analytics tracking
By default the plugin does _NOT_ track any usage data. You have to enable crash reports sending by setting `crashlyticsCollectionEnabled` to `true`:

```js
firebase.Crashlytics.setCrashlyticsCollectionEnabled(true);
```

**Note:** changes will only be applied after restarting the application.

## API

The firebase crashlytics API is represented as the global object `firebase.Crashlytics`.

### `Crashlytics`

#### Methods

##### `setCrashlyticsCollectionEnabled(enabled)`

* Enables or disables the collection of data about crashes.

**Note:** changes will only be applied after restarting the application.

##### `setUserIdentifier(id)`

* Specify a user identifier which will be visible in the Crashlytics UI.

##### `makeCrash()`

* The easiest way to cause a crash - great for testing!

##### `log(value)`

* Add text logging that will be sent with your next report. This logging will only be visible in your Crashlytics dashboard, and will be associated with the next crash or logged exception for this app execution. Newline characters ('\n') will be stripped from msg. The log is rolling with a maximum size of 64k, such that messages are removed (oldest first) if the max size is exceeded.

##### `log(priority, tag, value)`

* Add text logging that will be sent with your next report, using log(value). The message will also be printed to LogCat.

##### `setBool(key, value)`

* Sets a value to be associated with a given key for your crash data.

##### `setString(key, value)`

* Sets a value to be associated with a given key for your crash data.

##### `setInt(key, value)`

* Sets a value to be associated with a given key for your crash data.
36 changes: 36 additions & 0 deletions doc/performance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Firebase Crashlytics

## Enable analytics tracking
By default the plugin does _NOT_ track any usage data. You have to enable performance monitoring by setting `performanceCollectionEnabled` to `true`:

```js
firebase.Performance.performanceCollectionEnabled = true;
```

## API

The firebase performance API is represented as the global object `firebase.Performance`.

### `Performance`

#### Properties

All `Performance` properties are _write only_.

##### `performanceCollectionEnabled` : _boolean_

* Enables performance data collection for this app. To make use of firebase performance data collection _has to be enabled_ by the developer. The enablement persists across sessions.

#### Methods

##### `startTrace(name)`

* Creates a Trace object with given name and start the trace.

##### `stopTrace(name)`

* Stops a Trace with given name.

##### `incrementMetrics(name, counter, value)`

* Atomically increments the metric with the given name in this trace by the incrementBy value.
43 changes: 43 additions & 0 deletions doc/remote-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Firebase Remote Config

## API

The firebase remote config API is represented as the global object `firebase.RemoteConfig`.

### `RemoteConfig`

#### Properties

##### `minimumFetchIntervalInSeconds` : _number_

* Specified minimum config fetch interval.

#### Methods

##### `setDefaults(values)`

* Asynchronously sets default configs using the given key-value JSON Object.

The values in defaults must be one of the following types:

* byte[]
* Boolean
* Double
* Long
* String

##### `getBoolean(key)`

* Returns the parameter value for the given key as a boolean.

##### `getDouble(key)`

* Returns the parameter value for the given key as a double (number).

##### `getLong(key)`

* Returns the parameter value for the given key as a long. (number).

##### `getString(key)`

* Returns the parameter value for the given key as a String.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tabris-plugin-firebase",
"version": "4.0.0",
"version": "6.0.0",
"description": "A firebase plugin for Tabris.js",
"types": "./types/index.d.ts",
"peerDependencies": {
Expand Down
95 changes: 55 additions & 40 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="tabris-plugin-firebase"
version="3.0.0">
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android" id="tabris-plugin-firebase" version="3.0.0">

<name>Tabris.js Firebase Plugin</name>
<description>A firebase for Tabris.js. The plugin allows to handle cloud messages.</description>
Expand All @@ -24,11 +22,23 @@
<clobbers target="firebase.Analytics" />
</js-module>

<js-module src="www/Performance.js" name="performance">
<clobbers target="firebase.Performance" />
</js-module>

<js-module src="www/Crashlytics.js" name="crashlytics">
<clobbers target="firebase.Crashlytics" />
</js-module>


<platform name="android">

<!-- The default value "@mipmap/ic_launcher" is the resource used by the tabris-android cordova platform for the app icon -->
<preference name="ANDROID_NOTIFICATION_ICON" default="@mipmap/ic_launcher" />
<preference name="TABRIS_FIREBASE_ANALYTICS_VERSION" default="17.2.1"/>
<preference name="TABRIS_FIREBASE_MESSAGING_VERSION" default="20.0.1"/>
<preference name="TABRIS_FIREBASE_PERFORMANCE_VERSION" default="19.0.2"/>
<preference name="TABRIS_FIREBASE_CRASHLYTICS_VERSION" default="2.10.1"/>

<config-file target="AndroidManifest.xml" parent="/manifest">

Expand All @@ -51,41 +61,46 @@
</intent-filter>
</service>

<meta-data
android:name="com.eclipsesource.tabris.android.HANDLER.com.eclipsesource.tabris.firebase.messaging"
android:value="com.eclipsesource.firebase.messaging.MessagingHandler" />
<meta-data
android:name="com.eclipsesource.tabris.android.HANDLER.com.eclipsesource.tabris.firebase.analytics"
android:value="com.eclipsesource.firebase.analytics.AnalyticsHandler" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="$ANDROID_NOTIFICATION_ICON" />
<meta-data android:name="com.eclipsesource.tabris.android.HANDLER.com.eclipsesource.tabris.firebase.messaging" android:value="com.eclipsesource.firebase.messaging.MessagingHandler" />
<meta-data android:name="com.eclipsesource.tabris.android.HANDLER.com.eclipsesource.tabris.firebase.analytics" android:value="com.eclipsesource.firebase.analytics.AnalyticsHandler" />
<meta-data android:name="com.eclipsesource.tabris.android.HANDLER.com.eclipsesource.tabris.firebase.performance" android:value="com.eclipsesource.firebase.performance.PerformanceHandler" />
<meta-data android:name="com.eclipsesource.tabris.android.HANDLER.com.eclipsesource.tabris.firebase.crashlytics" android:value="com.eclipsesource.firebase.crashlytics.CrashlyticsHandler" />
<meta-data android:name="com.eclipsesource.tabris.android.HANDLER.com.eclipsesource.tabris.firebase.remote_config" android:value="com.eclipsesource.firebase.crashlytics.RemoteConfigHandler" />

<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="$ANDROID_NOTIFICATION_ICON" />

<meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />
<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />
<meta-data android:name="firebase_performance_collection_enabled" android:value="false" />

<receiver android:name="com.eclipsesource.firebase.messaging.NotificationOpenedReceiver" />

</config-file>

<framework src="src/android/build-extras.gradle" custom="true" type="gradleReference" />
<framework src="src/android/firebase_build.gradle" custom="true" type="gradleReference" />

<framework src="com.google.firebase:firebase-analytics:$TABRIS_FIREBASE_ANALYTICS_VERSION" />
<framework src="com.google.firebase:firebase-messaging:$TABRIS_FIREBASE_MESSAGING_VERSION" />
<framework src="com.google.firebase:firebase-perf:$TABRIS_FIREBASE_PERFORMANCE_VERSION" />
<framework src="com.crashlytics.sdk.android:crashlytics:$TABRIS_FIREBASE_CRASHLYTICS_VERSION" />

<source-file src="src/android/com/eclipsesource/firebase/messaging/MessagingHandler.kt" target-dir="src/com/eclipsesource/firebase/messaging" />
<source-file src="src/android/com/eclipsesource/firebase/messaging/Messaging.kt" target-dir="src/com/eclipsesource/firebase/messaging" />
<source-file src="src/android/com/eclipsesource/firebase/messaging/TabrisFirebaseMessagingService.kt" target-dir="src/com/eclipsesource/firebase/messaging" />
<source-file src="src/android/com/eclipsesource/firebase/messaging/TabrisFirebaseInstanceIDService.kt" target-dir="src/com/eclipsesource/firebase/messaging" />
<source-file src="src/android/com/eclipsesource/firebase/messaging/NotificationOpenedReceiver.kt" target-dir="src/com/eclipsesource/firebase/messaging" />

<source-file src="src/android/com/eclipsesource/firebase/analytics/AnalyticsHandler.kt" target-dir="src/com/eclipsesource/firebase/analytics" />
<source-file src="src/android/com/eclipsesource/firebase/analytics/Analytics.kt" target-dir="src/com/eclipsesource/firebase/analytics" />

<framework src="com.google.firebase:firebase-core:16.0.7" />
<framework src="com.google.firebase:firebase-messaging:17.3.4" />
<source-file src="src/android/com/eclipsesource/firebase/performance/PerformanceHandler.kt" target-dir="src/com/eclipsesource/firebase/performance" />
<source-file src="src/android/com/eclipsesource/firebase/performance/Performance.kt" target-dir="src/com/eclipsesource/firebase/performance" />

<source-file src="src/android/com/eclipsesource/firebase/messaging/MessagingHandler.kt"
target-dir="src/com/eclipsesource/firebase/messaging" />
<source-file src="src/android/com/eclipsesource/firebase/messaging/Messaging.kt"
target-dir="src/com/eclipsesource/firebase/messaging" />
<source-file src="src/android/com/eclipsesource/firebase/messaging/TabrisFirebaseMessagingService.kt"
target-dir="src/com/eclipsesource/firebase/messaging" />
<source-file src="src/android/com/eclipsesource/firebase/messaging/TabrisFirebaseInstanceIDService.kt"
target-dir="src/com/eclipsesource/firebase/messaging" />
<source-file src="src/android/com/eclipsesource/firebase/messaging/NotificationOpenedReceiver.kt"
target-dir="src/com/eclipsesource/firebase/messaging" />
<source-file src="src/android/com/eclipsesource/firebase/crashlytics/CrashlyticsHandler.kt" target-dir="src/com/eclipsesource/firebase/crashlytics" />
<source-file src="src/android/com/eclipsesource/firebase/crashlytics/Crashlytics.kt" target-dir="src/com/eclipsesource/firebase/crashlytics" />

<source-file src="src/android/com/eclipsesource/firebase/analytics/AnalyticsHandler.kt"
target-dir="src/com/eclipsesource/firebase/analytics" />
<source-file src="src/android/com/eclipsesource/firebase/analytics/Analytics.kt"
target-dir="src/com/eclipsesource/firebase/analytics" />
<source-file src="src/android/com/eclipsesource/firebase/remote_config/RemoteConfigHandler.kt" target-dir="src/com/eclipsesource/firebase/remote_config" />
<source-file src="src/android/com/eclipsesource/firebase/remote_config/RemoteConfig.kt" target-dir="src/com/eclipsesource/firebase/remote_config" />

<hook src="scripts/android/copy_google_services.js" type="after_prepare" />

Expand All @@ -97,28 +112,28 @@

<!-- Add entries to TabrisPlugins.plist -->
<config-file target="*TabrisPlugins.plist" parent="classes">
<array>
<string>ESFBMessaging</string>
<string>ESFBAnalytics</string>
</array>
<array>
<string>ESFBMessaging</string>
<string>ESFBAnalytics</string>
</array>
</config-file>

<config-file target="*Entitlements-Debug.plist" parent="aps-environment">
<string>development</string>
<string>development</string>
</config-file>

<config-file target="*Entitlements-Release.plist" parent="aps-environment">
<string>production</string>
<string>production</string>
</config-file>

<config-file target="*-Info.plist" parent="UIBackgroundModes">
<array>
<string>remote-notification</string>
</array>
<array>
<string>remote-notification</string>
</array>
</config-file>

<config-file target="*-Info.plist" parent="FIREBASE_ANALYTICS_COLLECTION_ENABLED">
<false/>
<false/>
</config-file>

<!-- Frameworks -->
Expand Down
12 changes: 8 additions & 4 deletions project/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
buildscript {
ext {
playServicesVersion = '12.0.1'
kotlinVersion = '1.3.21'
kotlinVersion = '1.3.50'
}
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:3.1.2'
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'io.fabric.tools:gradle:1.31.2'
classpath 'com.google.firebase:perf-plugin:1.3.1'
}
}

Expand Down
Loading