Skip to content

Commit

Permalink
Merge branch 'master' into auth-result
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-kew authored Aug 16, 2024
2 parents ac4cffa + 70d0514 commit 277e7f5
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 6 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Push

on: [ push ]

jobs:
formatKotlin:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: formatKotlin
run: ./gradlew formatKotlin
- uses: stefanzweifel/git-auto-commit-action@v5
- name: lintKotlin
run: ./gradlew lintKotlin
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public expect fun Firebase.analytics(app: FirebaseApp): FirebaseAnalytics
public expect class FirebaseAnalytics {
public fun logEvent(name: String, parameters: Map<String, Any>? = 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?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public external fun getAnalytics(app: FirebaseApp? = definedExternally): Firebas

public external fun logEvent(app: FirebaseAnalytics, name: String, parameters: Map<String, Any>?)
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<String, String>)
public external fun setAnalyticsCollectionEnabled(app: FirebaseAnalytics, enabled: Boolean)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down
1 change: 1 addition & 0 deletions firebase-messaging/api/android/firebase-messaging.api
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
public final class dev/gitlive/firebase/messaging/FirebaseMessaging {
public fun <init> (Lcom/google/firebase/messaging/FirebaseMessaging;)V
public final fun deleteToken (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun getAndroid ()Lcom/google/firebase/messaging/FirebaseMessaging;
public final fun getToken (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun subscribeToTopic (Ljava/lang/String;)V
Expand Down
1 change: 1 addition & 0 deletions firebase-messaging/api/jvm/firebase-messaging.api
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
public final class dev/gitlive/firebase/messaging/FirebaseMessaging {
public fun <init> ()V
public final fun deleteToken (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun getToken (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun subscribeToTopic (Ljava/lang/String;)V
public final fun unsubscribeFromTopic (Ljava/lang/String;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ public actual class FirebaseMessaging(public val android: com.google.firebase.me
}

public actual suspend fun getToken(): String = android.token.await()

public actual suspend fun deleteToken() {
android.deleteToken().await()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ public expect class FirebaseMessaging {
* @return [String] FCM token
*/
public suspend fun getToken(): String

/**
* Delete FCM token for client
*/
public suspend fun deleteToken()
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public actual class FirebaseMessaging(public val ios: FIRMessaging) {
}

public actual suspend fun getToken(): String = awaitResult { ios.tokenWithCompletion(it) }

public actual suspend fun deleteToken() {
await { ios.deleteTokenWithCompletion(it) }
}
}

public suspend inline fun <T> T.await(function: T.(callback: (NSError?) -> Unit) -> Unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ public external fun getMessaging(

public external fun getToken(messaging: Messaging = definedExternally, options: dynamic = definedExternally): Promise<String>

public external fun deleteToken(messaging: Messaging = definedExternally): Promise<Boolean>

public external interface Messaging
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ public actual class FirebaseMessaging(public val js: Messaging) {
}

public actual suspend fun getToken(): String = dev.gitlive.firebase.messaging.externals.getToken(js).await()

public actual suspend fun deleteToken() {
dev.gitlive.firebase.messaging.externals.deleteToken(js).await()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ public actual class FirebaseMessaging {
public actual suspend fun getToken(): String {
TODO("Not yet implemented")
}

public actual suspend fun deleteToken() {
TODO("Not yet implemented")
}
}

0 comments on commit 277e7f5

Please sign in to comment.