Skip to content

Commit 85d4784

Browse files
committed
Added contains any and also incremented firebase version.
1 parent e5d4f7a commit 85d4784

File tree

6 files changed

+32
-3
lines changed

6 files changed

+32
-3
lines changed

build.gradle.kts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ val minSdkVersion by extra(14)
2626
tasks {
2727
val downloadIOSFirebaseZipFile by creating(Download::class) {
2828
onlyIfModified(true)
29-
src("https://github.com/firebase/firebase-ios-sdk/releases/download/6.17.0/Firebase-6.17.0.zip")
30-
dest(File("$buildDir", "Firebase-6.17.0.zip"))
29+
src("https://github.com/firebase/firebase-ios-sdk/releases/download/6.23.0/Firebase-6.23.0.zip")
30+
dest(File("$buildDir", "Firebase-6.23.0.zip"))
3131
overwrite(true)
3232

3333
}
@@ -138,6 +138,10 @@ subprojects {
138138
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.3.4")
139139
"iosMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.4")
140140
"iosMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.3.4")
141+
"commonTestImplementation"(kotlin("test-common"))
142+
"commonTestImplementation"(kotlin("test-annotations-common"))
143+
"androidTestImplementation"(kotlin("test-junit"))
144+
"androidTestImplementation"("junit:junit:4.12")
141145
}
142146
}
143147

firebase-firestore/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ kotlin {
5050
}
5151
val androidMain by getting {
5252
dependencies {
53-
api("com.google.firebase:firebase-firestore:19.0.2")
53+
api("com.google.firebase:firebase-firestore:21.4.3")
5454
}
5555
}
5656

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,13 @@ actual open class Query(open val android: com.google.firebase.firestore.Query) {
294294
}
295295
}
296296
)
297+
298+
internal actual fun _where(field: String, vararg arrayContainsAny: Any) = Query(
299+
android.whereArrayContainsAny(field, arrayContainsAny.toList())
300+
)
301+
internal actual fun _where(path: FieldPath, vararg arrayContainsAny: Any) = Query(
302+
android.whereArrayContainsAny(path, arrayContainsAny.toList())
303+
)
297304
}
298305

299306
actual class CollectionReference(override val android: com.google.firebase.firestore.CollectionReference) : Query(android) {

firebase-firestore/src/commonMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ expect open class Query {
6060
internal fun _where(path: FieldPath, equalTo: Any?): Query
6161
internal fun _where(field: String, lessThan: Any? = null, greaterThan: Any? = null, arrayContains: Any? = null): Query
6262
internal fun _where(path: FieldPath, lessThan: Any? = null, greaterThan: Any? = null, arrayContains: Any? = null): Query
63+
internal fun _where(field: String, vararg arrayContainsAny: Any): Query
64+
internal fun _where(path: FieldPath, vararg arrayContainsAny: Any): Query
6365
val snapshots: Flow<QuerySnapshot>
6466
suspend fun get(): QuerySnapshot
6567
}
@@ -68,6 +70,8 @@ fun Query.where(field: String, equalTo: Any?) = _where(field, equalTo)
6870
fun Query.where(path: FieldPath, equalTo: Any?) = _where(path, equalTo)
6971
fun Query.where(field: String, lessThan: Any? = null, greaterThan: Any? = null, arrayContains: Any? = null) = _where(field, lessThan, greaterThan, arrayContains)
7072
fun Query.where(path: FieldPath, lessThan: Any? = null, greaterThan: Any? = null, arrayContains: Any? = null) = _where(path, lessThan, greaterThan, arrayContains)
73+
fun Query.where(field: String, vararg arrayContainsAny: Any) = _where(field, arrayContainsAny)
74+
fun Query.where(path: FieldPath, vararg arrayContainsAny: Any) = _where(path, arrayContainsAny)
7175

7276

7377
expect class WriteBatch {

firebase-firestore/src/iosMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ actual open class Query(open val ios: FIRQuery) {
204204
}
205205
}
206206
)
207+
208+
internal actual fun _where(field: String, vararg arrayContainsAny: Any) = Query(
209+
ios.queryWhereField(field, arrayContainsAny = arrayContainsAny.toList())
210+
)
211+
internal actual fun _where(path: FieldPath, vararg arrayContainsAny: Any) = Query(
212+
ios.queryWhereFieldPath(path, arrayContainsAny = arrayContainsAny.toList())
213+
)
207214
}
208215
actual class CollectionReference(override val ios: FIRCollectionReference) : Query(ios) {
209216

firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ actual open class Query(open val js: firebase.firestore.Query) {
269269
)
270270
}
271271

272+
internal actual fun _where(field: String, vararg arrayContainsAny: Any) = rethrow {
273+
Query(js.where(field, "array-contains-any", arrayContainsAny))
274+
}
275+
internal actual fun _where(path: FieldPath, vararg arrayContainsAny: Any) = rethrow {
276+
Query(js.where(path, "array-contains-any", arrayContainsAny))
277+
}
278+
272279
actual val snapshots get() = callbackFlow {
273280
val unsubscribe = rethrow {
274281
js.onSnapshot(

0 commit comments

Comments
 (0)