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 73aa5ca + 6743d80 commit e6278af
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 60 deletions.
11 changes: 5 additions & 6 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 abstract class dev/gitlive/firebase/firestore/FieldValueBuilder {
public abstract fun addEncoded (Ljava/lang/Object;)V
public final class dev/gitlive/firebase/firestore/FieldValueBuilder {
public final 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,14 +176,13 @@ public final class dev/gitlive/firebase/firestore/FieldValueSerializer : kotlinx
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
}

public abstract class dev/gitlive/firebase/firestore/FieldsAndValuesBuilder {
public fun <init> ()V
public final class dev/gitlive/firebase/firestore/FieldsAndValuesBuilder {
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 abstract fun toEncoded (Ldev/gitlive/firebase/firestore/FieldPath;Ljava/lang/Object;)V
public abstract fun toEncoded (Ljava/lang/String;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 class dev/gitlive/firebase/firestore/Filter {
Expand Down
11 changes: 5 additions & 6 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 abstract class dev/gitlive/firebase/firestore/FieldValueBuilder {
public abstract fun addEncoded (Ljava/lang/Object;)V
public final class dev/gitlive/firebase/firestore/FieldValueBuilder {
public final 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,14 +176,13 @@ public final class dev/gitlive/firebase/firestore/FieldValueSerializer : kotlinx
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
}

public abstract class dev/gitlive/firebase/firestore/FieldsAndValuesBuilder {
public fun <init> ()V
public final class dev/gitlive/firebase/firestore/FieldsAndValuesBuilder {
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 abstract fun toEncoded (Ldev/gitlive/firebase/firestore/FieldPath;Ljava/lang/Object;)V
public abstract fun toEncoded (Ljava/lang/String;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 class dev/gitlive/firebase/firestore/Filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package dev.gitlive.firebase.firestore
import dev.gitlive.firebase.EncodeSettings
import kotlinx.serialization.SerializationStrategy

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

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

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

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

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

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

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

@PublishedApi
internal abstract fun FieldPath.toEncoded(encodedValue: Any?)
internal fun FieldPath.toEncoded(encodedValue: Any?) {
fieldAndValues += FieldAndValue.WithFieldPath(this, encodedValue)
}
}
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, dev.gitlive.firebase.firestore.internal.FieldsAndValuesBuilder().apply(fieldsAndValuesBuilder).fieldAndValues))
): Transaction = Transaction(nativeWrapper.updateEncoded(documentRef, 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(*dev.gitlive.firebase.firestore.internal.FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))
public fun startAfter(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.startAfter(*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(*dev.gitlive.firebase.firestore.internal.FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))
public fun startAt(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.startAt(*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(*dev.gitlive.firebase.firestore.internal.FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))
public fun endBefore(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.endBefore(*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(*dev.gitlive.firebase.firestore.internal.FieldValueBuilder().apply(builder).fieldValues.toTypedArray()))
public fun endAt(builder: FieldValueBuilder.() -> Unit): Query = Query(nativeQuery.endAt(*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,
dev.gitlive.firebase.firestore.internal.FieldsAndValuesBuilder().apply(fieldAndValuesBuilder).fieldAndValues,
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(dev.gitlive.firebase.firestore.internal.FieldsAndValuesBuilder().apply(fieldsAndValuesBuilder).fieldAndValues)
native.updateEncoded(FieldsAndValuesBuilder().apply(fieldsAndValuesBuilder).fieldAndValues)
}

public suspend fun delete() {
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit e6278af

Please sign in to comment.