Skip to content

Commit 6e41e70

Browse files
updates to database-transactions
1 parent a2332de commit 6e41e70

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
33
import org.gradle.api.tasks.testing.logging.TestLogEvent
44

55
plugins {
6-
kotlin("multiplatform") version "1.5.31" apply false
6+
kotlin("multiplatform") version "1.5.32" apply false
77
id("base")
88
}
99

@@ -17,7 +17,7 @@ buildscript {
1717
}
1818
}
1919
dependencies {
20-
classpath("com.android.tools.build:gradle:7.0.3")
20+
classpath("com.android.tools.build:gradle:7.0.4")
2121
classpath("com.adarshr:gradle-test-logger-plugin:2.1.1")
2222
}
2323
}

firebase-database/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ kotlin {
129129
apiVersion = "1.5"
130130
languageVersion = "1.5"
131131
progressiveMode = true
132-
optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
133-
optIn("kotlinx.coroutines.FlowPreview")
134-
optIn("kotlinx.serialization.InternalSerializationApi")
132+
// optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
133+
// optIn("kotlinx.coroutines.FlowPreview")
134+
// optIn("kotlinx.serialization.InternalSerializationApi")
135135
}
136136
}
137137

firebase-database/src/androidMain/kotlin/dev/gitlive/firebase/database/database.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,19 @@ actual class DatabaseReference internal constructor(
192192
val deferred = CompletableDeferred<DataSnapshot>()
193193
android.runTransaction(object : Transaction.Handler {
194194

195-
override fun doTransaction(currentData: MutableData) =
196-
Transaction.success(transactionUpdate(decode(strategy, currentData)) as MutableData)
195+
override fun doTransaction(currentData: MutableData): Transaction.Result {
196+
currentData.value = currentData.value?.let {
197+
transactionUpdate(decode(strategy, it))
198+
}
199+
return Transaction.success(currentData)
200+
}
197201

198202
override fun onComplete(
199203
error: DatabaseError?,
200204
committed: Boolean,
201205
snapshot: com.google.firebase.database.DataSnapshot?
202206
) {
203-
if(error != null) {
207+
if (error != null) {
204208
deferred.completeExceptionally(error.toException())
205209
} else {
206210
deferred.complete(DataSnapshot(snapshot!!))

0 commit comments

Comments
 (0)