Skip to content

Commit ed72726

Browse files
authored
Merge pull request #16 from GitLiveApp/contains-any
Added contains any and also incremented firebase version.
2 parents e5d4f7a + 0044cae commit ed72726

File tree

6 files changed

+28
-3
lines changed

6 files changed

+28
-3
lines changed

build.gradle.kts

Lines changed: 2 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
}

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, arrayContainsAny: List<Any>) = Query(
299+
android.whereArrayContainsAny(field, arrayContainsAny)
300+
)
301+
internal actual fun _where(path: FieldPath, arrayContainsAny: List<Any>) = Query(
302+
android.whereArrayContainsAny(path, arrayContainsAny)
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, arrayContainsAny: List<Any>): Query
64+
internal fun _where(path: FieldPath, arrayContainsAny: List<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, arrayContainsAny: List<Any>) = _where(field, arrayContainsAny)
74+
fun Query.where(path: FieldPath, arrayContainsAny: List<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, arrayContainsAny: List<Any>) = Query(
209+
ios.queryWhereField(field, arrayContainsAny = arrayContainsAny)
210+
)
211+
internal actual fun _where(path: FieldPath, arrayContainsAny: List<Any>) = Query(
212+
ios.queryWhereFieldPath(path, arrayContainsAny = arrayContainsAny)
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, arrayContainsAny: List<Any>) = rethrow {
273+
Query(js.where(field, "array-contains-any", arrayContainsAny))
274+
}
275+
internal actual fun _where(path: FieldPath, arrayContainsAny: List<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)