File tree Expand file tree Collapse file tree 6 files changed +21
-1
lines changed
firebase-common/src/jsMain/kotlin/dev/gitlive/firebase
androidMain/kotlin/dev/gitlive/firebase/firestore
commonMain/kotlin/dev/gitlive/firebase/firestore
iosMain/kotlin/dev/gitlive/firebase/firestore
jsMain/kotlin/dev/gitlive/firebase/firestore Expand file tree Collapse file tree 6 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ subprojects {
197197 dependencies {
198198 " commonMainImplementation" (" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" )
199199 " androidMainImplementation" (" org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.5.2" )
200- " androidMainImplementation" (platform(" com.google.firebase:firebase-bom:28.4 .1" ))
200+ " androidMainImplementation" (platform(" com.google.firebase:firebase-bom:29.0 .1" ))
201201 " commonTestImplementation" (kotlin(" test-common" ))
202202 " commonTestImplementation" (kotlin(" test-annotations-common" ))
203203 " commonTestImplementation" (" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" )
Original file line number Diff line number Diff line change @@ -383,6 +383,7 @@ external object firebase {
383383
384384 open class CollectionReference : Query {
385385 val path: String
386+ val parent: DocumentReference ?
386387 fun doc (path : String = definedExternally): DocumentReference
387388 fun add (data : Any ): Promise <DocumentReference >
388389 }
@@ -419,6 +420,7 @@ external object firebase {
419420 open class DocumentReference {
420421 val id: String
421422 val path: String
423+ val parent: CollectionReference
422424
423425 fun collection (path : String ): CollectionReference
424426 fun get (options : Any? = definedExternally): Promise <DocumentSnapshot >
Original file line number Diff line number Diff line change @@ -227,6 +227,9 @@ actual class DocumentReference(val android: com.google.firebase.firestore.Docume
227227 actual val path: String
228228 get() = android.path
229229
230+ actual val parent: CollectionReference
231+ get() = CollectionReference (android.parent)
232+
230233 actual fun collection (collectionPath : String ) = CollectionReference (android.collection(collectionPath))
231234
232235 actual suspend inline fun <reified T > set (data : T , encodeDefaults : Boolean , merge : Boolean ) = when (merge) {
@@ -367,6 +370,9 @@ actual class CollectionReference(override val android: com.google.firebase.fires
367370 actual val document: DocumentReference
368371 get() = DocumentReference (android.document())
369372
373+ actual val parent: DocumentReference ?
374+ get() = android.parent?.let {DocumentReference (it)}
375+
370376 actual fun document (documentPath : String ) = DocumentReference (android.document(documentPath))
371377
372378 actual suspend inline fun <reified T > add (data : T , encodeDefaults : Boolean ) =
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ expect class DocumentReference {
105105 val id: String
106106 val path: String
107107 val snapshots: Flow <DocumentSnapshot >
108+ val parent: CollectionReference
108109
109110 fun collection (collectionPath : String ): CollectionReference
110111 suspend fun get (): DocumentSnapshot
@@ -129,6 +130,7 @@ expect class DocumentReference {
129130expect class CollectionReference : Query {
130131 val path: String
131132 val document: DocumentReference
133+ val parent: DocumentReference ?
132134
133135 fun document (documentPath : String ): DocumentReference
134136 suspend inline fun <reified T > add (data : T , encodeDefaults : Boolean = true): DocumentReference
Original file line number Diff line number Diff line change @@ -174,6 +174,9 @@ actual class DocumentReference(val ios: FIRDocumentReference) {
174174 actual val path: String
175175 get() = ios.path
176176
177+ actual val parent: CollectionReference
178+ get() = CollectionReference (ios.parent)
179+
177180 actual fun collection (collectionPath : String ) = CollectionReference (ios.collectionWithPath(collectionPath))
178181
179182 actual suspend inline fun <reified T > set (data : T , encodeDefaults : Boolean , merge : Boolean ) =
@@ -282,6 +285,8 @@ actual class CollectionReference(override val ios: FIRCollectionReference) : Que
282285
283286 actual val document get() = DocumentReference (ios.documentWithAutoID())
284287
288+ actual val parent get() = ios.parent?.let {DocumentReference (it)}
289+
285290 actual fun document (documentPath : String ) = DocumentReference (ios.documentWithPath(documentPath))
286291
287292 actual suspend inline fun <reified T > add (data : T , encodeDefaults : Boolean ) =
Original file line number Diff line number Diff line change @@ -214,6 +214,9 @@ actual class DocumentReference(val js: firebase.firestore.DocumentReference) {
214214 actual val path: String
215215 get() = rethrow { js.path }
216216
217+ actual val parent: CollectionReference
218+ get() = rethrow { CollectionReference (js.parent) }
219+
217220 actual fun collection (collectionPath : String ) = rethrow { CollectionReference (js.collection(collectionPath)) }
218221
219222 actual suspend inline fun <reified T > set (data : T , encodeDefaults : Boolean , merge : Boolean ) =
@@ -347,6 +350,8 @@ actual class CollectionReference(override val js: firebase.firestore.CollectionR
347350
348351 actual val document get() = rethrow { DocumentReference (js.doc()) }
349352
353+ actual val parent get() = rethrow { js.parent?.let {DocumentReference (it)} }
354+
350355 actual fun document (documentPath : String ) = rethrow { DocumentReference (js.doc(documentPath)) }
351356
352357 actual suspend inline fun <reified T > add (data : T , encodeDefaults : Boolean ) =
You can’t perform that action at this time.
0 commit comments