Skip to content

Commit 249cb19

Browse files
authored
[performance-expansion] Add PerformanceCollectionEnabled (#360)
* [performance-expansion] Add PerformanceCollectionEnabled * [performance-expansion] Update version and readme * [performance-expansion] Revert iOS instrumentation enabled * [performance-expansion] Update icon for crashlytics
1 parent 288d0e7 commit 249cb19

File tree

19 files changed

+144
-54
lines changed

19 files changed

+144
-54
lines changed

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar
1010

1111
The following libraries are available for the various Firebase products.
1212

13-
| Service or Product | Gradle Dependency | API Coverage |
14-
|---------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15-
| [Authentication](https://firebase.google.com/docs/auth) | [`dev.gitlive:firebase-auth:1.7.2`](https://search.maven.org/artifact/dev.gitlive/firebase-auth/1.7.2/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-auth/src/commonMain/kotlin/dev/gitlive/firebase/auth/auth.kt) |
16-
| [Realtime Database](https://firebase.google.com/docs/database) | [`dev.gitlive:firebase-database:1.7.2`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.7.2/pom) | [![70%](https://img.shields.io/badge/-70%25-orange?style=flat-square)](/firebase-database/src/commonMain/kotlin/dev/gitlive/firebase/database/database.kt) |
17-
| [Cloud Firestore](https://firebase.google.com/docs/firestore) | [`dev.gitlive:firebase-firestore:1.7.2`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.7.2/pom) | [![60%](https://img.shields.io/badge/-60%25-orange?style=flat-square)](/firebase-firestore/src/commonMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt) |
18-
| [Cloud Functions](https://firebase.google.com/docs/functions) | [`dev.gitlive:firebase-functions:1.7.2`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.7.2/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-functions/src/commonMain/kotlin/dev/gitlive/firebase/functions/functions.kt) |
19-
| [Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) | [`dev.gitlive:firebase-messaging:1.7.2`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.7.2/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
20-
| [Cloud Storage](https://firebase.google.com/docs/storage) | [`dev.gitlive:firebase-storage:1.7.2`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.7.2/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
21-
| [Installations](https://firebase.google.com/docs/projects/manage-installations) | [`dev.gitlive:firebase-installations:1.7.2`](https://search.maven.org/artifact/dev.gitlive/firebase-installations/1.7.2/pom) | [![90%](https://img.shields.io/badge/-90%25-green?style=flat-square)](/firebase-installations/src/commonMain/kotlin/dev/gitlive/firebase/installations/installations.kt) |
22-
| [Remote Config](https://firebase.google.com/docs/remote-config) | [`dev.gitlive:firebase-config:1.7.2`](https://search.maven.org/artifact/dev.gitlive/firebase-config/1.7.2/pom) | ![20%](https://img.shields.io/badge/-20%25-orange?style=flat-square) |
23-
| [Performance](https://firebase.google.com/docs/perf-mon) | [`dev.gitlive:firebase-perf:1.7.2`](https://search.maven.org/artifact/dev.gitlive/firebase-perf/1.7.2/pom) | ![1%](https://img.shields.io/badge/-1%25-orange?style=flat-square) |
24-
| [Crashlytics](https://firebase.google.com/docs/crashlytics) | [`dev.gitlive:firebase-crashlytics:1.7.2`](https://search.maven.org/artifact/dev.gitlive/firebase-crashlytics/1.7.2/pom) | ![80%](https://img.shields.io/badge/-1%25-orange?style=flat-square) |
13+
| Service or Product | Gradle Dependency | API Coverage |
14+
|---------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15+
| [Authentication](https://firebase.google.com/docs/auth) | [`dev.gitlive:firebase-auth:1.7.3`](https://search.maven.org/artifact/dev.gitlive/firebase-auth/1.7.3/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-auth/src/commonMain/kotlin/dev/gitlive/firebase/auth/auth.kt) |
16+
| [Realtime Database](https://firebase.google.com/docs/database) | [`dev.gitlive:firebase-database:1.7.3`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.7.3/pom) | [![70%](https://img.shields.io/badge/-70%25-orange?style=flat-square)](/firebase-database/src/commonMain/kotlin/dev/gitlive/firebase/database/database.kt) |
17+
| [Cloud Firestore](https://firebase.google.com/docs/firestore) | [`dev.gitlive:firebase-firestore:1.7.3`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.7.3/pom) | [![60%](https://img.shields.io/badge/-60%25-orange?style=flat-square)](/firebase-firestore/src/commonMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt) |
18+
| [Cloud Functions](https://firebase.google.com/docs/functions) | [`dev.gitlive:firebase-functions:1.7.3`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.7.3/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-functions/src/commonMain/kotlin/dev/gitlive/firebase/functions/functions.kt) |
19+
| [Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) | [`dev.gitlive:firebase-messaging:1.7.3`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.7.3/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
20+
| [Cloud Storage](https://firebase.google.com/docs/storage) | [`dev.gitlive:firebase-storage:1.7.3`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.7.3/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
21+
| [Installations](https://firebase.google.com/docs/projects/manage-installations) | [`dev.gitlive:firebase-installations:1.7.3`](https://search.maven.org/artifact/dev.gitlive/firebase-installations/1.7.3/pom) | [![90%](https://img.shields.io/badge/-90%25-green?style=flat-square)](/firebase-installations/src/commonMain/kotlin/dev/gitlive/firebase/installations/installations.kt) |
22+
| [Remote Config](https://firebase.google.com/docs/remote-config) | [`dev.gitlive:firebase-config:1.7.3`](https://search.maven.org/artifact/dev.gitlive/firebase-config/1.7.3/pom) | ![20%](https://img.shields.io/badge/-20%25-orange?style=flat-square) |
23+
| [Performance](https://firebase.google.com/docs/perf-mon) | [`dev.gitlive:firebase-perf:1.7.3`](https://search.maven.org/artifact/dev.gitlive/firebase-perf/1.7.3/pom) | ![60%](https://img.shields.io/badge/-60%25-orange?style=flat-square) |
24+
| [Crashlytics](https://firebase.google.com/docs/crashlytics) | [`dev.gitlive:firebase-crashlytics:1.7.3`](https://search.maven.org/artifact/dev.gitlive/firebase-crashlytics/1.7.3/pom) | ![80%](https://img.shields.io/badge/-80%25-green?style=flat-square) |
2525

2626

2727

@@ -203,16 +203,16 @@ If you are building a Kotlin multiplatform library which will be consumed from J
203203

204204
```json
205205
"dependencies": {
206-
"@gitlive/firebase-auth": "1.7.2",
207-
"@gitlive/firebase-config": "1.7.2",
208-
"@gitlive/firebase-database": "1.7.2",
209-
"@gitlive/firebase-firestore": "1.7.2",
210-
"@gitlive/firebase-functions": "1.7.2",
211-
"@gitlive/firebase-installations": "1.7.2",
212-
"@gitlive/firebase-messaging": "1.7.2",
213-
"@gitlive/firebase-storage": "1.7.2"
214-
"@gitlive/firebase-perf": "1.7.2"
215-
"@gitlive/firebase-crashlytics": "1.7.2"
206+
"@gitlive/firebase-auth": "1.7.3",
207+
"@gitlive/firebase-config": "1.7.3",
208+
"@gitlive/firebase-database": "1.7.3",
209+
"@gitlive/firebase-firestore": "1.7.3",
210+
"@gitlive/firebase-functions": "1.7.3",
211+
"@gitlive/firebase-installations": "1.7.3",
212+
"@gitlive/firebase-messaging": "1.7.3",
213+
"@gitlive/firebase-storage": "1.7.3"
214+
"@gitlive/firebase-perf": "1.7.3"
215+
"@gitlive/firebase-crashlytics": "1.7.3"
216216
}
217217
```
218218

firebase-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-app",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-app.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-common": "1.7.2",
26+
"@gitlive/firebase-common": "1.7.3",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

firebase-auth/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-auth",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-auth.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "1.7.2",
26+
"@gitlive/firebase-app": "1.7.3",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

firebase-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-common",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-common.js",
66
"scripts": {

firebase-common/src/jsMain/kotlin/dev/gitlive/firebase/externals.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,9 @@ external object firebase {
529529

530530
object performance {
531531

532+
var dataCollectionEnabled: Boolean
533+
var instrumentationEnabled: Boolean
534+
532535
fun trace(
533536
name: String
534537
): PerformanceTrace

firebase-config/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-config",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-config.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "1.7.2",
26+
"@gitlive/firebase-app": "1.7.3",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

firebase-crashlytics/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-crashlytics",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-crashlytics.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "1.7.2",
26+
"@gitlive/firebase-app": "1.7.3",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

firebase-database/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-database",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-database.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "1.7.2",
26+
"@gitlive/firebase-app": "1.7.3",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

firebase-firestore/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-firestore",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-firestore.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "1.7.2",
26+
"@gitlive/firebase-app": "1.7.3",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

firebase-functions/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-functions",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-functions.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "1.7.2",
26+
"@gitlive/firebase-app": "1.7.3",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

firebase-installations/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-installations",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-installations.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "1.7.2",
26+
"@gitlive/firebase-app": "1.7.3",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

firebase-perf/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-perf",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-perf.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "1.7.2",
26+
"@gitlive/firebase-app": "1.7.3",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

firebase-perf/src/androidMain/kotlin/dev/gitlive/firebase/perf/performance.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ actual fun Firebase.performance(app: FirebaseApp) =
1414
actual class FirebasePerformance(val android: com.google.firebase.perf.FirebasePerformance){
1515

1616
actual fun newTrace(traceName: String): Trace = Trace(android.newTrace(traceName))
17+
18+
actual fun isPerformanceCollectionEnabled() = android.isPerformanceCollectionEnabled
19+
20+
actual fun setPerformanceCollectionEnabled(enable: Boolean) {
21+
android.isPerformanceCollectionEnabled = enable
22+
}
1723
}
1824

1925
actual open class FirebasePerformanceException(message: String) : FirebaseException(message)

firebase-perf/src/commonMain/kotlin/dev/gitlive/firebase/perf/performance.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ expect fun Firebase.performance(app: FirebaseApp): FirebasePerformance
1414
expect class FirebasePerformance {
1515

1616
fun newTrace(traceName: String): Trace
17+
18+
fun isPerformanceCollectionEnabled(): Boolean
19+
20+
fun setPerformanceCollectionEnabled(enable: Boolean)
1721
}
1822

1923
expect open class FirebasePerformanceException : FirebaseException

firebase-perf/src/commonTest/kotlin/dev/gitlive/firebase/perf/performance.kt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import dev.gitlive.firebase.FirebaseOptions
99
import dev.gitlive.firebase.apps
1010
import dev.gitlive.firebase.initialize
1111
import kotlinx.coroutines.CoroutineScope
12-
import kotlin.test.BeforeTest
13-
import kotlin.test.Test
14-
import kotlin.test.assertNotNull
12+
import kotlin.test.*
1513

1614
expect val emulatorHost: String
1715
expect val context: Any
@@ -47,4 +45,18 @@ class FirebasePerformanceTest {
4745

4846
assertNotNull(trace)
4947
}
48+
49+
@Test
50+
fun testPerformanceCollectionEnabled() = runTest {
51+
52+
val performance = Firebase.performance
53+
54+
performance.setPerformanceCollectionEnabled(false)
55+
56+
assertFalse(performance.isPerformanceCollectionEnabled())
57+
58+
performance.setPerformanceCollectionEnabled(true)
59+
60+
assertTrue(performance.isPerformanceCollectionEnabled())
61+
}
5062
}

firebase-perf/src/iosMain/kotlin/dev/gitlive/firebase/perf/performance.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ actual fun Firebase.performance(app: FirebaseApp) =
1515
actual class FirebasePerformance(val ios: FIRPerformance) {
1616

1717
actual fun newTrace(traceName: String): Trace = Trace(ios.traceWithName(traceName))
18+
19+
actual fun isPerformanceCollectionEnabled(): Boolean = ios.isDataCollectionEnabled()
20+
21+
actual fun setPerformanceCollectionEnabled(enable: Boolean) {
22+
ios.dataCollectionEnabled = enable
23+
}
1824
}
1925

2026
actual open class FirebasePerformanceException(message: String) : FirebaseException(message)

firebase-perf/src/jsMain/kotlin/dev/gitlive/firebase/perf/performance.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ actual class FirebasePerformance internal constructor(val js: firebase.performan
2222
actual fun newTrace(traceName: String): Trace = rethrow {
2323
Trace(js.trace(traceName))
2424
}
25+
26+
actual fun isPerformanceCollectionEnabled(): Boolean = js.dataCollectionEnabled
27+
28+
actual fun setPerformanceCollectionEnabled(enable: Boolean) {
29+
js.dataCollectionEnabled = enable
30+
}
31+
32+
fun isInstrumentationEnabled(): Boolean = js.instrumentationEnabled
33+
34+
fun setInstrumentationEnabled(enable: Boolean) {
35+
js.instrumentationEnabled = enable
36+
}
2537
}
2638

2739
actual open class FirebasePerformanceException(code: String, cause: Throwable) :

0 commit comments

Comments
 (0)