Skip to content

Commit

Permalink
Merge branch 'main' into rl.harm.category.civic
Browse files Browse the repository at this point in the history
  • Loading branch information
rlazo authored Nov 12, 2024
2 parents f8ac2b7 + 4e2dcd0 commit d92e971
Show file tree
Hide file tree
Showing 14 changed files with 855 additions and 233 deletions.
1 change: 1 addition & 0 deletions firebase-dataconnect/firebase-dataconnect.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ dependencies {
testImplementation(libs.kotlinx.datetime)
testImplementation(libs.kotlinx.serialization.json)
testImplementation(libs.mockk)
testImplementation(libs.testonly.three.ten.abp)
testImplementation(libs.robolectric)

androidTestImplementation(project(":firebase-dataconnect:androidTestutil"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.firebase.dataconnect

import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.dataconnect.core.FirebaseDataConnectInternal
import com.google.firebase.dataconnect.testutil.DataConnectBackend
import com.google.firebase.dataconnect.testutil.DataConnectIntegrationTestBase
import com.google.firebase.dataconnect.testutil.InProcessDataConnectGrpcServer
Expand Down Expand Up @@ -201,6 +202,7 @@ class AuthIntegrationTest : DataConnectIntegrationTestBase() {
}

private suspend fun signIn() {
(personSchema.dataConnect as FirebaseDataConnectInternal).awaitAuthReady()
val authResult = auth.run { signInAnonymously().await() }
withClue("authResult.user returned from signInAnonymously()") {
authResult.user.shouldNotBeNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,20 @@ internal class DataConnectAppCheck(
blockingDispatcher: CoroutineDispatcher,
logger: Logger,
) :
DataConnectCredentialsTokenManager<InteropAppCheckTokenProvider, AppCheckTokenListener>(
DataConnectCredentialsTokenManager<InteropAppCheckTokenProvider>(
deferredProvider = deferredAppCheckTokenProvider,
parentCoroutineScope = parentCoroutineScope,
blockingDispatcher = blockingDispatcher,
logger = logger,
) {
override fun newTokenListener(): AppCheckTokenListener = AppCheckTokenListenerImpl(logger)
private val appCheckTokenListener = AppCheckTokenListenerImpl(logger)

@DeferredApi
override fun addTokenListener(
provider: InteropAppCheckTokenProvider,
listener: AppCheckTokenListener
) = provider.addAppCheckTokenListener(listener)
override fun addTokenListener(provider: InteropAppCheckTokenProvider) =
provider.addAppCheckTokenListener(appCheckTokenListener)

override fun removeTokenListener(
provider: InteropAppCheckTokenProvider,
listener: AppCheckTokenListener
) = provider.removeAppCheckTokenListener(listener)
override fun removeTokenListener(provider: InteropAppCheckTokenProvider) =
provider.removeAppCheckTokenListener(appCheckTokenListener)

override suspend fun getToken(provider: InteropAppCheckTokenProvider, forceRefresh: Boolean) =
provider.getToken(forceRefresh).await().let { GetTokenResult(it.token) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ internal class DataConnectAuth(
blockingDispatcher: CoroutineDispatcher,
logger: Logger,
) :
DataConnectCredentialsTokenManager<InternalAuthProvider, IdTokenListener>(
DataConnectCredentialsTokenManager<InternalAuthProvider>(
deferredProvider = deferredAuthProvider,
parentCoroutineScope = parentCoroutineScope,
blockingDispatcher = blockingDispatcher,
logger = logger,
) {
override fun newTokenListener(): IdTokenListener = IdTokenListenerImpl(logger)
private val idTokenListener = IdTokenListenerImpl(logger)

@DeferredApi
override fun addTokenListener(provider: InternalAuthProvider, listener: IdTokenListener) =
provider.addIdTokenListener(listener)
override fun addTokenListener(provider: InternalAuthProvider) =
provider.addIdTokenListener(idTokenListener)

override fun removeTokenListener(provider: InternalAuthProvider, listener: IdTokenListener) =
provider.removeIdTokenListener(listener)
override fun removeTokenListener(provider: InternalAuthProvider) =
provider.removeIdTokenListener(idTokenListener)

override suspend fun getToken(provider: InternalAuthProvider, forceRefresh: Boolean) =
provider.getAccessToken(forceRefresh).await().let { GetTokenResult(it.token) }
Expand Down
Loading

0 comments on commit d92e971

Please sign in to comment.