PostDetailsActivity.kt
and navigate to
listenForComments()
. Replace
the
TODO
inside the function with the following:
cloudFirestoreManager.onCommentsValuesChange(post.id)
.observe(
this
, Observer(::onCommentsUpdate))
Here, you start listening for the comments changes for that particular post and when
the data changes you update the UI.
Go back to the
CloudFirestoreManager.kt
class and navigate to
stopListeningForCommentsChanges()
. Replace the function with the following:
fun
stopListeningForCommentsChanges
()
=
commentsRegistration.remove()
Here, you remove the listener from the location that you assigned to the
commentsRegistration
.
Open
Do'stlaringiz bilan baham: |