Skip to content

Commit ea321d2

Browse files
authored
Merge branch 'main' into davidmotson.golden_files_fix
2 parents 4940d80 + 0554f0d commit ea321d2

File tree

5 files changed

+49
-26
lines changed

5 files changed

+49
-26
lines changed

firebase-dataconnect/demo/build.gradle.kts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ import java.nio.charset.StandardCharsets
1919

2020
plugins {
2121
// Use whichever versions of these dependencies suit your application.
22-
// The versions shown here were the latest versions as of December 03, 2024.
22+
// The versions shown here were the latest versions as of March 05, 2025.
2323
// Note, however, that the version of kotlin("plugin.serialization") _must_,
2424
// in general, match the version of kotlin("android").
25-
id("com.android.application") version "8.7.3"
25+
id("com.android.application") version "8.9.0"
2626
id("com.google.gms.google-services") version "4.4.2"
27-
val kotlinVersion = "2.1.0"
27+
val kotlinVersion = "2.1.10"
2828
kotlin("android") version kotlinVersion
2929
kotlin("plugin.serialization") version kotlinVersion
3030

@@ -35,19 +35,19 @@ plugins {
3535

3636
dependencies {
3737
// Use whichever versions of these dependencies suit your application.
38-
// The versions shown here were the latest versions as of December 03, 2024.
39-
implementation("com.google.firebase:firebase-dataconnect:16.0.0-beta03")
40-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
41-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")
42-
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3")
38+
// The versions shown here were the latest versions as of March 05, 2025.
39+
implementation("com.google.firebase:firebase-dataconnect:16.0.0-beta04")
40+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
41+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1")
42+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.8.0")
4343
implementation("androidx.appcompat:appcompat:1.7.0")
44-
implementation("androidx.activity:activity-ktx:1.9.3")
44+
implementation("androidx.activity:activity-ktx:1.10.1")
4545
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")
4646
implementation("com.google.android.material:material:1.12.0")
4747

4848
// The following code in this "dependencies" block can be omitted from customer
4949
// facing documentation as it is an implementation detail of this application.
50-
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.3")
50+
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
5151
implementation("io.kotest:kotest-property:5.9.1")
5252
implementation("io.kotest.extensions:kotest-property-arbs:2.1.2")
5353
}

firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/MyApplication.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class MyApplication : Application() {
6161
}
6262
)
6363

64-
private val initialLogLevel = FirebaseDataConnect.logLevel
64+
private val initialLogLevel = FirebaseDataConnect.logLevel.value
6565
private val connectorMutex = Mutex()
6666
private var connector: Ctry3q3tp6kzxConnector? = null
6767

@@ -70,7 +70,7 @@ class MyApplication : Application() {
7070

7171
coroutineScope.launch {
7272
if (getDataConnectDebugLoggingEnabled()) {
73-
FirebaseDataConnect.logLevel = LogLevel.DEBUG
73+
FirebaseDataConnect.logLevel.value = LogLevel.DEBUG
7474
}
7575
}
7676
}
@@ -102,7 +102,7 @@ class MyApplication : Application() {
102102
getSharedPreferences().all[SharedPrefsKeys.IS_DATA_CONNECT_LOGGING_ENABLED] as? Boolean ?: false
103103

104104
suspend fun setDataConnectDebugLoggingEnabled(enabled: Boolean) {
105-
FirebaseDataConnect.logLevel = if (enabled) LogLevel.DEBUG else initialLogLevel
105+
FirebaseDataConnect.logLevel.value = if (enabled) LogLevel.DEBUG else initialLogLevel
106106
editSharedPreferences { putBoolean(SharedPrefsKeys.IS_DATA_CONNECT_LOGGING_ENABLED, enabled) }
107107
}
108108

firebase-functions/firebase-functions.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ dependencies {
112112
implementation(libs.okhttp)
113113
implementation(libs.playservices.base)
114114
implementation(libs.playservices.basement)
115-
implementation(libs.reactive.streams)
115+
api(libs.reactive.streams)
116116

117117
api(libs.playservices.tasks)
118118

firebase-functions/src/androidTest/java/com/google/firebase/functions/StreamTests.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,26 @@ class StreamTests {
143143
assertThat(subscriber.throwable).isInstanceOf(FirebaseFunctionsException::class.java)
144144
}
145145

146+
@Test
147+
fun nonExistentFunction_receivesError() = runBlocking {
148+
val function =
149+
functions.getHttpsCallable("nonexistentFunction").withTimeout(2000, TimeUnit.MILLISECONDS)
150+
val subscriber = StreamSubscriber()
151+
152+
function.stream().subscribe(subscriber)
153+
154+
withTimeout(2000) {
155+
while (subscriber.throwable == null) {
156+
delay(100)
157+
}
158+
}
159+
160+
assertThat(subscriber.throwable).isNotNull()
161+
assertThat(subscriber.throwable).isInstanceOf(FirebaseFunctionsException::class.java)
162+
assertThat((subscriber.throwable as FirebaseFunctionsException).code)
163+
.isEqualTo(FirebaseFunctionsException.Code.NOT_FOUND)
164+
}
165+
146166
@Test
147167
fun genStreamWeather_receivesWeatherForecasts() = runBlocking {
148168
val inputData = listOf(mapOf("name" to "Toronto"), mapOf("name" to "London"))

firebase-functions/src/main/java/com/google/firebase/functions/PublisherStream.kt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,12 @@ internal class PublisherStream(
300300
val errorMessage: String
301301
if (response.code() == 404 && response.header("Content-Type") == htmlContentType) {
302302
errorMessage = """URL not found. Raw response: ${response.body()?.string()}""".trimMargin()
303-
throw FirebaseFunctionsException(
304-
errorMessage,
305-
FirebaseFunctionsException.Code.fromHttpStatus(response.code()),
306-
null
303+
notifyError(
304+
FirebaseFunctionsException(
305+
errorMessage,
306+
FirebaseFunctionsException.Code.fromHttpStatus(response.code()),
307+
null
308+
)
307309
)
308310
}
309311

@@ -313,16 +315,17 @@ internal class PublisherStream(
313315
val json = JSONObject(text)
314316
error = serializer.decode(json.opt("error"))
315317
} catch (e: Throwable) {
316-
throw FirebaseFunctionsException(
317-
"${e.message} Unexpected Response:\n$text ",
318-
FirebaseFunctionsException.Code.INTERNAL,
319-
e
318+
notifyError(
319+
FirebaseFunctionsException(
320+
"${e.message} Unexpected Response:\n$text ",
321+
FirebaseFunctionsException.Code.INTERNAL,
322+
e
323+
)
320324
)
325+
return
321326
}
322-
throw FirebaseFunctionsException(
323-
error.toString(),
324-
FirebaseFunctionsException.Code.INTERNAL,
325-
error
327+
notifyError(
328+
FirebaseFunctionsException(error.toString(), FirebaseFunctionsException.Code.INTERNAL, error)
326329
)
327330
}
328331
}

0 commit comments

Comments
 (0)