Skip to content

Commit

Permalink
Merge branch 'track-master-2.1' into snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeda88 committed Sep 13, 2024
2 parents c2ae27d + 32599ff commit 73aa5ca
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 41 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,13 @@ These properties are only accessible from the equivalent target's source set. Fo
.build()
```

### Running on Android

On android, some modules (`config`) require you to enable [Core library desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) if you have a *minSDK lower than API 26*.

### Running on iOS

On iOS the official [Firebase iOS SDK](https://github.com/firebase/firebase-ios-sdk) in not linked as a transtive dependency. Therefore, any project using this SDK needs to link the actual Firestore SDK as well. This can be done through your preferred installation method (Cocoapods/SPM).
On iOS the official [Firebase iOS SDK](https://github.com/firebase/firebase-ios-sdk) in not linked as a transitive dependency. Therefore, any project using this SDK needs to link the actual Firestore SDK as well. This can be done through your preferred installation method (Cocoapods/SPM).

Similarly, tests require linking as well. Make sure to add the required frameworks to the search path of your test targets. This can be done by specifying a `cocoapods` block in your `build.gradle`:
```kotlin
Expand Down
5 changes: 0 additions & 5 deletions firebase-config/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ android {
}

compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
Expand All @@ -45,10 +44,6 @@ android {
}
}

dependencies {
coreLibraryDesugaring(libs.android.desugarjdk)
}

val supportIosTarget = project.property("skipIosTarget") != "true"

kotlin {
Expand Down
11 changes: 6 additions & 5 deletions firebase-firestore/api/android/firebase-firestore.api
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public final class dev/gitlive/firebase/firestore/FieldValue$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}

public final class dev/gitlive/firebase/firestore/FieldValueBuilder {
public final fun addEncoded (Ljava/lang/Object;)V
public abstract class dev/gitlive/firebase/firestore/FieldValueBuilder {
public abstract fun addEncoded (Ljava/lang/Object;)V
public final fun addWithStrategy (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
public final fun getBuildSettings ()Lkotlin/jvm/functions/Function1;
public final fun setBuildSettings (Lkotlin/jvm/functions/Function1;)V
Expand All @@ -176,13 +176,14 @@ public final class dev/gitlive/firebase/firestore/FieldValueSerializer : kotlinx
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
}

public final class dev/gitlive/firebase/firestore/FieldsAndValuesBuilder {
public abstract class dev/gitlive/firebase/firestore/FieldsAndValuesBuilder {
public fun <init> ()V
public final fun getBuildSettings ()Lkotlin/jvm/functions/Function1;
public final fun setBuildSettings (Lkotlin/jvm/functions/Function1;)V
public final fun to (Ldev/gitlive/firebase/firestore/FieldPath;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
public final fun to (Ljava/lang/String;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
public final fun toEncoded (Ldev/gitlive/firebase/firestore/FieldPath;Ljava/lang/Object;)V
public final fun toEncoded (Ljava/lang/String;Ljava/lang/Object;)V
public abstract fun toEncoded (Ldev/gitlive/firebase/firestore/FieldPath;Ljava/lang/Object;)V
public abstract fun toEncoded (Ljava/lang/String;Ljava/lang/Object;)V
}

public abstract class dev/gitlive/firebase/firestore/Filter {
Expand Down
11 changes: 6 additions & 5 deletions firebase-firestore/api/jvm/firebase-firestore.api
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public final class dev/gitlive/firebase/firestore/FieldValue$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}

public final class dev/gitlive/firebase/firestore/FieldValueBuilder {
public final fun addEncoded (Ljava/lang/Object;)V
public abstract class dev/gitlive/firebase/firestore/FieldValueBuilder {
public abstract fun addEncoded (Ljava/lang/Object;)V
public final fun addWithStrategy (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
public final fun getBuildSettings ()Lkotlin/jvm/functions/Function1;
public final fun setBuildSettings (Lkotlin/jvm/functions/Function1;)V
Expand All @@ -176,13 +176,14 @@ public final class dev/gitlive/firebase/firestore/FieldValueSerializer : kotlinx
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
}

public final class dev/gitlive/firebase/firestore/FieldsAndValuesBuilder {
public abstract class dev/gitlive/firebase/firestore/FieldsAndValuesBuilder {
public fun <init> ()V
public final fun getBuildSettings ()Lkotlin/jvm/functions/Function1;
public final fun setBuildSettings (Lkotlin/jvm/functions/Function1;)V
public final fun to (Ldev/gitlive/firebase/firestore/FieldPath;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
public final fun to (Ljava/lang/String;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
public final fun toEncoded (Ldev/gitlive/firebase/firestore/FieldPath;Ljava/lang/Object;)V
public final fun toEncoded (Ljava/lang/String;Ljava/lang/Object;)V
public abstract fun toEncoded (Ldev/gitlive/firebase/firestore/FieldPath;Ljava/lang/Object;)V
public abstract fun toEncoded (Ljava/lang/String;Ljava/lang/Object;)V
}

public abstract class dev/gitlive/firebase/firestore/Filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package dev.gitlive.firebase.firestore
import dev.gitlive.firebase.EncodeSettings
import kotlinx.serialization.SerializationStrategy

public class FieldValueBuilder internal constructor() {
public abstract class FieldValueBuilder internal constructor() {

internal val fieldValues: MutableList<Any> = mutableListOf()
public var buildSettings: EncodeSettings.Builder.() -> Unit = {
encodeDefaults = true
}
Expand All @@ -19,7 +18,5 @@ public class FieldValueBuilder internal constructor() {
}

@PublishedApi
internal fun addEncoded(encodedValue: Any) {
fieldValues += encodedValue
}
internal abstract fun addEncoded(encodedValue: Any)
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package dev.gitlive.firebase.firestore

import dev.gitlive.firebase.EncodeSettings
import dev.gitlive.firebase.firestore.internal.FieldAndValue
import kotlinx.serialization.SerializationStrategy

public class FieldsAndValuesBuilder internal constructor() {
public abstract class FieldsAndValuesBuilder {

internal val fieldAndValues: MutableList<FieldAndValue> = mutableListOf()
public var buildSettings: EncodeSettings.Builder.() -> Unit = {
encodeDefaults = true
}
Expand All @@ -28,12 +26,8 @@ public class FieldsAndValuesBuilder internal constructor() {
}

@PublishedApi
internal fun String.toEncoded(encodedValue: Any?) {
fieldAndValues += FieldAndValue.WithStringField(this, encodedValue)
}
internal abstract fun String.toEncoded(encodedValue: Any?)

@PublishedApi
internal fun FieldPath.toEncoded(encodedValue: Any?) {
fieldAndValues += FieldAndValue.WithFieldPath(this, encodedValue)
}
internal abstract fun FieldPath.toEncoded(encodedValue: Any?)
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public data class Transaction internal constructor(internal val nativeWrapper: N
public fun update(
documentRef: DocumentReference,
fieldsAndValuesBuilder: FieldsAndValuesBuilder.() -> Unit,
): Transaction = Transaction(nativeWrapper.updateEncoded(documentRef, FieldsAndValuesBuilder().apply(fieldsAndValuesBuilder).fieldAndValues))
): Transaction = Transaction(nativeWrapper.updateEncoded(documentRef, dev.gitlive.firebase.firestore.internal.FieldsAndValuesBuilder().apply(fieldsAndValuesBuilder).fieldAndValues))

@PublishedApi
internal fun updateEncoded(documentRef: DocumentReference, encodedData: EncodedObject): Transaction = Transaction(nativeWrapper.updateEncoded(documentRef, encodedData))
Expand Down Expand Up @@ -263,7 +263,7 @@ public open class Query internal constructor(internal val nativeQuery: NativeQue
}
}

public fun startAfter(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.startAfter(*FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))
public fun startAfter(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.startAfter(*dev.gitlive.firebase.firestore.internal.FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))

public fun startAt(document: DocumentSnapshot): Query = Query(nativeQuery.startAt(document.native))
public fun startAt(vararg fieldValues: Any?): Query = startAt({}, *fieldValues)
Expand All @@ -275,7 +275,7 @@ public open class Query internal constructor(internal val nativeQuery: NativeQue
}
}

public fun startAt(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.startAt(*FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))
public fun startAt(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.startAt(*dev.gitlive.firebase.firestore.internal.FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))

public fun endBefore(document: DocumentSnapshot): Query = Query(nativeQuery.endBefore(document.native))
public fun endBefore(vararg fieldValues: Any?): Query = endBefore({}, *fieldValues)
Expand All @@ -287,7 +287,7 @@ public open class Query internal constructor(internal val nativeQuery: NativeQue
}
}

public fun endBefore(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.endBefore(*FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))
public fun endBefore(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.endBefore(*dev.gitlive.firebase.firestore.internal.FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))

public fun endAt(document: DocumentSnapshot): Query = Query(nativeQuery.endAt(document.native))
public fun endAt(vararg fieldValues: Any?): Query = endAt({}, *fieldValues)
Expand All @@ -299,7 +299,7 @@ public open class Query internal constructor(internal val nativeQuery: NativeQue
}
}

public fun endAt(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.endAt(*FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))
public fun endAt(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.endAt(*dev.gitlive.firebase.firestore.internal.FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))
}

@Deprecated("Deprecated in favor of using a [FilterBuilder]", replaceWith = ReplaceWith("where { field equalTo equalTo }", "dev.gitlive.firebase.firestore"))
Expand Down Expand Up @@ -461,7 +461,7 @@ public data class WriteBatch internal constructor(internal val nativeWrapper: Na
): WriteBatch = WriteBatch(
nativeWrapper.updateEncoded(
documentRef,
FieldsAndValuesBuilder().apply(fieldAndValuesBuilder).fieldAndValues,
dev.gitlive.firebase.firestore.internal.FieldsAndValuesBuilder().apply(fieldAndValuesBuilder).fieldAndValues,
),
)

Expand Down Expand Up @@ -633,7 +633,7 @@ public data class DocumentReference internal constructor(internal val native: Na
public suspend fun update(
fieldsAndValuesBuilder: FieldsAndValuesBuilder.() -> Unit,
) {
native.updateEncoded(FieldsAndValuesBuilder().apply(fieldsAndValuesBuilder).fieldAndValues)
native.updateEncoded(dev.gitlive.firebase.firestore.internal.FieldsAndValuesBuilder().apply(fieldsAndValuesBuilder).fieldAndValues)
}

public suspend fun delete() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package dev.gitlive.firebase.firestore.internal

import kotlin.experimental.ExperimentalObjCName
import kotlin.native.ObjCName

@OptIn(ExperimentalObjCName::class)
@ObjCName("FieldValueBuilderImpl")
internal class FieldValueBuilder : dev.gitlive.firebase.firestore.FieldValueBuilder() {

internal val fieldValues: MutableList<Any> = mutableListOf()

override fun addEncoded(encodedValue: Any) {
fieldValues += encodedValue
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package dev.gitlive.firebase.firestore.internal

import dev.gitlive.firebase.firestore.FieldPath
import dev.gitlive.firebase.firestore.FieldsAndValuesBuilder
import kotlin.experimental.ExperimentalObjCName
import kotlin.native.ObjCName

@OptIn(ExperimentalObjCName::class)
@ObjCName("FieldsAndValuesBuilderImpl")
internal class FieldsAndValuesBuilder : FieldsAndValuesBuilder() {

internal val fieldAndValues: MutableList<FieldAndValue> = mutableListOf()

override fun String.toEncoded(encodedValue: Any?) {
fieldAndValues += FieldAndValue.WithStringField(this, encodedValue)
}

override fun FieldPath.toEncoded(encodedValue: Any?) {
fieldAndValues += FieldAndValue.WithFieldPath(this, encodedValue)
}
}
6 changes: 2 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "8.5.2"
agp = "8.6.0"
androidx-test-core = "1.6.1"
androidx-test-junit = "1.2.1"
androidx-test-runner = "1.6.2"
Expand All @@ -10,7 +10,7 @@ gson = "2.11.0"
junit = "4.13.2"
kotlin = "2.0.20"
kotlinx-coroutines = "1.9.0-RC.2"
kotlinx-serialization = "1.7.1"
kotlinx-serialization = "1.7.2"
kotlinx-binarycompatibilityvalidator = "0.16.3"
kotlinx-datetime = "0.6.1"
kotlinter = "4.4.1"
Expand All @@ -20,7 +20,6 @@ firebase-cocoapods = "11.1.0"
ios-deploymentTarget = "13.0"
test-logger-plugin = "4.0.0"
dokka = "1.9.20"
desugar-libs = "2.1.1"

[libraries]
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" }
Expand Down Expand Up @@ -50,7 +49,6 @@ kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka" }
android-desugarjdk = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar-libs" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
Expand Down

0 comments on commit 73aa5ca

Please sign in to comment.