diff --git a/.github/workflows/dataconnect_demo_app.yml b/.github/workflows/dataconnect_demo_app.yml index 47c1c8ee3e4..3380b00459a 100644 --- a/.github/workflows/dataconnect_demo_app.yml +++ b/.github/workflows/dataconnect_demo_app.yml @@ -26,7 +26,7 @@ on: env: FDC_NODE_VERSION: ${{ inputs.nodeVersion || '24' }} FDC_INPUT_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion }} - FDC_JAVA_VERSION: ${{ inputs.javaVersion || '17' }} + FDC_JAVA_VERSION: ${{ inputs.javaVersion || '21' }} FDC_FIREBASE_TOOLS_DIR: ${{ github.workspace }}/firebase-tools FDC_FIREBASE_COMMAND: ${{ github.workspace }}/firebase-tools/node_modules/.bin/firebase FDC_PYTHON_VERSION: ${{ inputs.pythonVersion || '3.13' }} @@ -89,6 +89,8 @@ jobs: cd "$FDC_FIREBASE_TOOLS_DIR" echo '{}' > package.json npm install --fund=false --audit=false --save --save-exact firebase-tools@"$FDC_FIREBASE_TOOLS_VERSION" + npm install-scripts approve google-logging-utils protobufjs re2 + npm rebuild - name: install firebase-tools from package-lock.json if: steps.package_json_lock.outputs.cache-hit == 'true' @@ -147,6 +149,7 @@ jobs: --warning-mode all \ --project-dir firebase-dataconnect/demo \ ${FDC_GRADLE_INFO_FLAG:+"$FDC_GRADLE_INFO_FLAG"} \ + -PdataConnect.demo.firebaseCommand="$FDC_FIREBASE_COMMAND" \ dokkaGeneratePublicationHtml - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 diff --git a/firebase-dataconnect/demo/build.gradle.kts b/firebase-dataconnect/demo/build.gradle.kts index 68fb4e85c27..fd5e9015f55 100644 --- a/firebase-dataconnect/demo/build.gradle.kts +++ b/firebase-dataconnect/demo/build.gradle.kts @@ -20,36 +20,35 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { // Use whichever versions of these dependencies suit your application. - // The versions shown here were the latest versions as of July 17, 2025. + // The versions shown here were the latest versions as of October 09, 2026. // Note, however, that the version of kotlin("plugin.serialization") _must_, - // in general, match the version of kotlin("android"). - id("com.android.application") version "8.11.1" - id("com.google.gms.google-services") version "4.4.3" - val kotlinVersion = "2.1.10" - kotlin("android") version kotlinVersion - kotlin("plugin.serialization") version kotlinVersion + // in general, match the version of the kotlin compiler bundled with the + // Android Gradle Plugin id("com.android.application"). + id("com.android.application") version "9.4.1" + kotlin("plugin.serialization") version "2.2.10" + id("com.google.gms.google-services") version "4.5.0" // The following code in this "plugins" block can be omitted from customer // facing documentation as it is an implementation detail of this application. - id("com.diffplug.spotless") version "7.1.0" + id("com.diffplug.spotless") version "8.10.4" - id("org.jetbrains.dokka") version "2.0.0" + id("org.jetbrains.dokka") version "2.2.0" } dependencies { // Use whichever versions of these dependencies suit your application. - // The versions shown here were the latest versions as of July 17, 2025. + // The versions shown here were the latest versions as of October 09, 2026. // Data Connect - implementation(platform("com.google.firebase:firebase-bom:33.16.0")) + implementation(platform("com.google.firebase:firebase-bom:35.0.0")) implementation("com.google.firebase:firebase-dataconnect") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.9.0") - implementation("androidx.appcompat:appcompat:1.7.1") - implementation("androidx.activity:activity-ktx:1.10.1") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.9.2") - implementation("com.google.android.material:material:1.12.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.11.0") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.11.0") + implementation("androidx.appcompat:appcompat:1.8.0") + implementation("androidx.activity:activity-ktx:1.13.0") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.11.0") + implementation("com.google.android.material:material:1.14.0") // The following code in this "dependencies" block can be omitted from customer // facing documentation as it is an implementation detail of this application. @@ -60,8 +59,8 @@ dependencies { dokka { moduleName.set("Data Connect Demo") - dokkaSourceSets.main { - sourceRoots.from(layout.buildDirectory.dir("dataConnect/generatedSources/").get()) + dokkaSourceSets.configureEach { + sourceRoots.from(layout.buildDirectory.dir("dataConnect/generatedSources/")) } } @@ -71,16 +70,16 @@ dokka { android { namespace = "com.google.firebase.dataconnect.minimaldemo" - compileSdk = 36 + compileSdk = 37 defaultConfig { minSdk = 24 - targetSdk = 36 + targetSdk = 37 versionCode = 1 versionName = "1.0" } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 isCoreLibraryDesugaringEnabled = true } buildFeatures.viewBinding = true @@ -88,13 +87,13 @@ android { kotlin { compilerOptions { - jvmTarget = JvmTarget.JVM_1_8 + jvmTarget = JvmTarget.JVM_11 optIn.add("kotlin.RequiresOptIn") } } spotless { - val ktfmtVersion = "0.53" + val ktfmtVersion = "0.65" kotlin { target("**/*.kt") targetExclude("build/") @@ -155,8 +154,6 @@ abstract class DataConnectGenerateSourcesTask : DefaultTask() { @get:Inject protected abstract val providerFactory: ProviderFactory - @get:Inject protected abstract val fileSystemOperations: FileSystemOperations - @TaskAction fun run() { val inputDirectory: File = inputDirectory.get().dir @@ -252,7 +249,7 @@ abstract class DataConnectGenerateSourcesTask : DefaultTask() { } @DisableCachingByDefault( - because = "Copying files is not worth caching, just like org.gradle.api.tasks.Copy" + because = "Copying files is not worth caching, just like org.gradle.api.tasks.Copy", ) abstract class CopyDirectoryTask : DefaultTask() { @@ -343,15 +340,14 @@ run { description = "Copy the generated Data Connect Kotlin SDK sources into the " + "generated code directory for the \"${variant.name}\" variant." - srcDirectory = - generateSourcesTask.flatMap { - it.outputDirectory.map { outputDirectory -> - objectFactory.fileTree().apply { - setDir(outputDirectory) - exclude("**/*.log") - } + srcDirectory = generateSourcesTask.flatMap { + it.outputDirectory.map { outputDirectory -> + objectFactory.fileTree().apply { + setDir(outputDirectory) + exclude("**/*.log") } } + } } variant.sources.java!!.addGeneratedSourceDirectory(copyTask, CopyDirectoryTask::destDirectory) diff --git a/firebase-dataconnect/demo/gradle.properties b/firebase-dataconnect/demo/gradle.properties index 65486a3b71c..8904a294f8d 100644 --- a/firebase-dataconnect/demo/gradle.properties +++ b/firebase-dataconnect/demo/gradle.properties @@ -6,31 +6,36 @@ android.useAndroidX=true org.gradle.jvmargs=-Xmx2g -// Use Dokka Gradle Plugin v2, which is technically "experimental" -// but is fine for our purposes. -// https://kotlinlang.org/docs/dokka-migration.html +# Use Dokka Gradle Plugin v2, which is technically "experimental" +# but is fine for our purposes. +# https://kotlinlang.org/docs/dokka-migration.html org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true -// The path of the "firebase" command to use. -// If not specified, then "firebase" is used, resolved using the PATH environment variable. -// See build.gradle.kts for details. -//dataConnect.demo.firebaseCommand=/path/to/firebase - -// The path of the directory containing the "node" and "npm" commands. -// This directory will be prepended to the PATH before running the "firebase" command -// and may be useful to override the "node" and "npm" executables that get used by it. -// See build.gradle.kts for details. -//dataConnect.demo.nodeExecutableDirectory=/path/to/node/bin - -// The Data Connect emulator executable to use. -// If set, the `DATACONNECT_EMULATOR_BINARY_PATH` environment variable will be set before calling -// the "firebase" command to instruct it to use the specified Data Connect emulator rather than -// downloading an official version and using it. -// See build.gradle.kts for details. -//dataConnect.demo.dataConnectEmulatorExecutable=/path/to/cli - -// A comma-separated list of "preview flags" to specify to the Data Connect emulator and codegen. -// This is used to enable features that are not (yet) intended for end-user consumption. -// See build.gradle.kts for details. -//dataConnect.demo.dataConnectPreviewFlags=flag1,flag2,flag3 +# The path of the "firebase" command to use. +# If not specified, then "firebase" is used, resolved using the PATH environment variable. +# See build.gradle.kts for details. +#dataConnect.demo.firebaseCommand=/path/to/firebase + +# The path of the directory containing the "node" and "npm" commands. +# This directory will be prepended to the PATH before running the "firebase" command +# and may be useful to override the "node" and "npm" executables that get used by it. +# See build.gradle.kts for details. +#dataConnect.demo.nodeExecutableDirectory=/path/to/node/bin + +# The Data Connect emulator executable to use. +# If set, the `DATACONNECT_EMULATOR_BINARY_PATH` environment variable will be set before calling +# the "firebase" command to instruct it to use the specified Data Connect emulator rather than +# downloading an official version and using it. +# See build.gradle.kts for details. +#dataConnect.demo.dataConnectEmulatorExecutable=/path/to/cli + +# A comma-separated list of "preview flags" to specify to the Data Connect emulator and codegen. +# This is used to enable features that are not (yet) intended for end-user consumption. +# See build.gradle.kts for details. +#dataConnect.demo.dataConnectPreviewFlags=flag1,flag2,flag3 + +# Enabled parallel sync for Gradle 9.4+ +org.gradle.tooling.parallel=true +android.uniquePackageNames=false +android.r8.strictFullModeForKeepRules=false diff --git a/firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.jar b/firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.jar index a4b76b9530d..5097068a8d3 100644 Binary files a/firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.jar and b/firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.jar differ diff --git a/firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties b/firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties index 4f5eb9dcc0e..2e7bb9fd6ab 100644 --- a/firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties +++ b/firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.1-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/firebase-dataconnect/demo/gradlew b/firebase-dataconnect/demo/gradlew index f5feea6d6b1..249efbb032c 100755 --- a/firebase-dataconnect/demo/gradlew +++ b/firebase-dataconnect/demo/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -29,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -86,8 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -115,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -173,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -206,15 +203,14 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/firebase-dataconnect/demo/gradlew.bat b/firebase-dataconnect/demo/gradlew.bat index 9b42019c791..03754c4c3d9 100644 --- a/firebase-dataconnect/demo/gradlew.bat +++ b/firebase-dataconnect/demo/gradlew.bat @@ -19,12 +19,39 @@ @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -45,13 +72,14 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -59,36 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/ListItemsViewModel.kt b/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/ListItemsViewModel.kt index c08ed3aa037..e5c78bf9ba7 100644 --- a/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/ListItemsViewModel.kt +++ b/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/ListItemsViewModel.kt @@ -46,16 +46,15 @@ class ListItemsViewModel(private val app: MyApplication) : ViewModel() { private set private var job: Job? = null - val loadingState: LoadingState = - job.let { - if (it === null) { - LoadingState.NotStarted - } else if (it.isCancelled || it.isCompleted) { - LoadingState.Completed - } else { - LoadingState.InProgress - } + val loadingState: LoadingState = job.let { + if (it === null) { + LoadingState.NotStarted + } else if (it.isCancelled || it.isCompleted) { + LoadingState.Completed + } else { + LoadingState.InProgress } + } enum class LoadingState { NotStarted, @@ -73,8 +72,9 @@ class ListItemsViewModel(private val app: MyApplication) : ViewModel() { } // Start a new coroutine to perform the "get items" operation. - val job: Deferred> = - viewModelScope.async { app.getConnector().getAllItems.execute().data.items } + val job: Deferred> = viewModelScope.async { + app.getConnector().getAllItems.execute().data.items + } this.result = null this.job = job diff --git a/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/MainViewModel.kt b/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/MainViewModel.kt index 1769a9154b8..098c5ac809c 100644 --- a/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/MainViewModel.kt +++ b/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/MainViewModel.kt @@ -74,8 +74,9 @@ class MainViewModel(private val app: MyApplication) : ViewModel() { // Start a new coroutine to perform the "insert" operation. Log.i(TAG, "Inserting item: $variables") - val job: Deferred = - viewModelScope.async { app.getConnector().insertItem.ref(variables).execute().data.key } + val job: Deferred = viewModelScope.async { + app.getConnector().insertItem.ref(variables).execute().data.key + } val inProgressOperationState = OperationState.InProgress(_stateSequenceNumber.value, variables, job) insertState = inProgressOperationState @@ -122,8 +123,9 @@ class MainViewModel(private val app: MyApplication) : ViewModel() { // Start a new coroutine to perform the "get" operation. Log.i(TAG, "Retrieving item with key: $key") - val job: Deferred = - viewModelScope.async { app.getConnector().getItemByKey.execute(key).data.item } + val job: Deferred = viewModelScope.async { + app.getConnector().getItemByKey.execute(key).data.item + } val inProgressOperationState = OperationState.InProgress(_stateSequenceNumber.value, key, job) getState = inProgressOperationState _stateSequenceNumber.value++ @@ -167,8 +169,9 @@ class MainViewModel(private val app: MyApplication) : ViewModel() { // Start a new coroutine to perform the "delete" operation. Log.i(TAG, "Deleting item with key: $key") - val job: Deferred = - viewModelScope.async { app.getConnector().deleteItemByKey.execute(key) } + val job: Deferred = viewModelScope.async { + app.getConnector().deleteItemByKey.execute(key) + } val inProgressOperationState = OperationState.InProgress(_stateSequenceNumber.value, key, job) deleteState = inProgressOperationState _stateSequenceNumber.value++ diff --git a/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/MyApplication.kt b/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/MyApplication.kt index 1b6360efb58..188907b5a01 100644 --- a/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/MyApplication.kt +++ b/firebase-dataconnect/demo/src/main/kotlin/com/google/firebase/dataconnect/minimaldemo/MyApplication.kt @@ -58,7 +58,7 @@ class MyApplication : Application() { "(error code 8xrn9vvddd)", throwable, ) - } + }, ) private val initialLogLevel = FirebaseDataConnect.logLevel.value