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 @@ -196,7 +196,7 @@ subprojects {
196196 dependencies {
197197 " commonMainImplementation" (" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" )
198198 " androidMainImplementation" (" org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.5.2" )
199- " androidMainImplementation" (platform(" com.google.firebase:firebase-bom:29.0.0 " ))
199+ " androidMainImplementation" (platform(" com.google.firebase:firebase-bom:29.0.1 " ))
200200 " commonTestImplementation" (kotlin(" test-common" ))
201201 " commonTestImplementation" (kotlin(" test-annotations-common" ))
202202 " commonTestImplementation" (" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" )
Original file line number Diff line number Diff line change @@ -384,6 +384,7 @@ external object firebase {
384384
385385 open class CollectionReference : Query {
386386 val path: String
387+ val parent: DocumentReference ?
387388 fun doc (path : String = definedExternally): DocumentReference
388389 fun add (data : Any ): Promise <DocumentReference >
389390 }
@@ -420,6 +421,7 @@ external object firebase {
420421 open class DocumentReference {
421422 val id: String
422423 val path: String
424+ val parent: CollectionReference
423425
424426 fun collection (path : String ): CollectionReference
425427 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) {
@@ -369,6 +372,9 @@ actual class CollectionReference(override val android: com.google.firebase.fires
369372 actual val document: DocumentReference
370373 get() = DocumentReference (android.document())
371374
375+ actual val parent: DocumentReference ?
376+ get() = android.parent?.let {DocumentReference (it)}
377+
372378 actual fun document (documentPath : String ) = DocumentReference (android.document(documentPath))
373379
374380 actual suspend inline fun <reified T > add (data : T , encodeDefaults : Boolean ) =
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ expect class DocumentReference {
109109 val id: String
110110 val path: String
111111 val snapshots: Flow <DocumentSnapshot >
112+ val parent: CollectionReference
112113
113114 fun collection (collectionPath : String ): CollectionReference
114115 suspend fun get (): DocumentSnapshot
@@ -133,6 +134,7 @@ expect class DocumentReference {
133134expect class CollectionReference : Query {
134135 val path: String
135136 val document: DocumentReference
137+ val parent: DocumentReference ?
136138
137139 fun document (documentPath : String ): DocumentReference
138140 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 ) =
@@ -283,6 +286,8 @@ actual class CollectionReference(override val ios: FIRCollectionReference) : Que
283286
284287 actual val document get() = DocumentReference (ios.documentWithAutoID())
285288
289+ actual val parent get() = ios.parent?.let {DocumentReference (it)}
290+
286291 actual fun document (documentPath : String ) = DocumentReference (ios.documentWithPath(documentPath))
287292
288293 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 ) =
@@ -351,6 +354,8 @@ actual class CollectionReference(override val js: firebase.firestore.CollectionR
351354
352355 actual val document get() = rethrow { DocumentReference (js.doc()) }
353356
357+ actual val parent get() = rethrow { js.parent?.let {DocumentReference (it)} }
358+
354359 actual fun document (documentPath : String ) = rethrow { DocumentReference (js.doc(documentPath)) }
355360
356361 actual suspend inline fun <reified T > add (data : T , encodeDefaults : Boolean ) =
You can’t perform that action at this time.
0 commit comments