From d7e88f5035a3f3be496bae93db3b609175b3c3d6 Mon Sep 17 00:00:00 2001 From: Viktor Nyblom Date: Wed, 24 Jul 2024 10:07:54 +0200 Subject: [PATCH] Make setUserId accept nullable user id to clear user id. --- .../kotlin/dev/gitlive/firebase/analytics/analytics.kt | 2 +- .../kotlin/dev/gitlive/firebase/analytics/analytics.kt | 2 +- .../iosMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt | 2 +- .../jsMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt | 2 +- .../dev/gitlive/firebase/analytics/externals/analytics.kt | 2 +- .../kotlin/dev/gitlive/firebase/analytics/analytics.jvm.kt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/firebase-analytics/src/androidMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt b/firebase-analytics/src/androidMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt index f8a15062d..6bb66ab35 100644 --- a/firebase-analytics/src/androidMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt +++ b/firebase-analytics/src/androidMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt @@ -23,7 +23,7 @@ public actual class FirebaseAnalytics(public val android: com.google.firebase.an public actual fun setUserProperty(name: String, value: String) { android.setUserProperty(name, value) } - public actual fun setUserId(id: String) { + public actual fun setUserId(id: String?) { android.setUserId(id) } public actual fun resetAnalyticsData() { diff --git a/firebase-analytics/src/commonMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt b/firebase-analytics/src/commonMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt index 43db027aa..a4fa35880 100644 --- a/firebase-analytics/src/commonMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt +++ b/firebase-analytics/src/commonMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt @@ -13,7 +13,7 @@ public expect fun Firebase.analytics(app: FirebaseApp): FirebaseAnalytics public expect class FirebaseAnalytics { public fun logEvent(name: String, parameters: Map? = null) public fun setUserProperty(name: String, value: String) - public fun setUserId(id: String) + public fun setUserId(id: String?) public fun setAnalyticsCollectionEnabled(enabled: Boolean) public fun setSessionTimeoutInterval(sessionTimeoutInterval: Duration) public suspend fun getSessionId(): Long? diff --git a/firebase-analytics/src/iosMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt b/firebase-analytics/src/iosMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt index 8d8e22b45..2b98485f5 100644 --- a/firebase-analytics/src/iosMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt +++ b/firebase-analytics/src/iosMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt @@ -23,7 +23,7 @@ public actual class FirebaseAnalytics(public val ios: FIRAnalytics.Companion) { public actual fun setUserProperty(name: String, value: String) { ios.setUserPropertyString(value, name) } - public actual fun setUserId(id: String) { + public actual fun setUserId(id: String?) { ios.setUserID(id) } public actual fun resetAnalyticsData() { diff --git a/firebase-analytics/src/jsMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt b/firebase-analytics/src/jsMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt index a41f7925a..cbad07eee 100644 --- a/firebase-analytics/src/jsMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt +++ b/firebase-analytics/src/jsMain/kotlin/dev/gitlive/firebase/analytics/analytics.kt @@ -25,7 +25,7 @@ public actual class FirebaseAnalytics(public val js: dev.gitlive.firebase.analyt dev.gitlive.firebase.analytics.externals.setUserProperty(js, name, value) } - public actual fun setUserId(id: String) { + public actual fun setUserId(id: String?) { dev.gitlive.firebase.analytics.externals.setUserId(js, id) } diff --git a/firebase-analytics/src/jsMain/kotlin/dev/gitlive/firebase/analytics/externals/analytics.kt b/firebase-analytics/src/jsMain/kotlin/dev/gitlive/firebase/analytics/externals/analytics.kt index e9e9c109d..dc29bf175 100644 --- a/firebase-analytics/src/jsMain/kotlin/dev/gitlive/firebase/analytics/externals/analytics.kt +++ b/firebase-analytics/src/jsMain/kotlin/dev/gitlive/firebase/analytics/externals/analytics.kt @@ -11,7 +11,7 @@ public external fun getAnalytics(app: FirebaseApp? = definedExternally): Firebas public external fun logEvent(app: FirebaseAnalytics, name: String, parameters: Map?) public external fun setUserProperty(app: FirebaseAnalytics, name: String, value: String) -public external fun setUserId(app: FirebaseAnalytics, id: String) +public external fun setUserId(app: FirebaseAnalytics, id: String?) public external fun resetAnalyticsData(app: FirebaseAnalytics) public external fun setDefaultEventParameters(app: FirebaseAnalytics, parameters: Map) public external fun setAnalyticsCollectionEnabled(app: FirebaseAnalytics, enabled: Boolean) diff --git a/firebase-analytics/src/jvmMain/kotlin/dev/gitlive/firebase/analytics/analytics.jvm.kt b/firebase-analytics/src/jvmMain/kotlin/dev/gitlive/firebase/analytics/analytics.jvm.kt index afc17b53d..1c0b62d05 100644 --- a/firebase-analytics/src/jvmMain/kotlin/dev/gitlive/firebase/analytics/analytics.jvm.kt +++ b/firebase-analytics/src/jvmMain/kotlin/dev/gitlive/firebase/analytics/analytics.jvm.kt @@ -14,7 +14,7 @@ public actual fun Firebase.analytics(app: FirebaseApp): FirebaseAnalytics { public actual class FirebaseAnalytics { public actual fun setUserProperty(name: String, value: String) {} - public actual fun setUserId(id: String) {} + public actual fun setUserId(id: String?) {} public actual fun resetAnalyticsData() {} public actual fun setAnalyticsCollectionEnabled(enabled: Boolean) {} public actual fun setSessionTimeoutInterval(sessionTimeoutInterval: Duration) {}