ChatSdk not showing contacts in the fragment but saving in database.
BismeetSingh opened this issue · comments
-
Is the bug present in the demo Chat SDK project?
-
What modifications have you made to the Chat SDK?
-
Android Version:
-
Steps taken to reproduce the problem:
-
Expected result:
-
Actual result:
-
Comments:
I am trying to fetch a list of contacts from the real-time database and then add them to contacts using their entity Ids.
This is the code I wrote in custom contacts fragment but no contacts are being added to the chat fragment.
The Android version is Android Q.
val ref= FirebasePaths.usersRef()
Timber.d(ref.toString())
// Timber.d("Entity ID %s",ChatSDK.currentUser().entityID)
val userListener=
object :ValueEventListener {
override fun onDataChange(snapshot: DataSnapshot) {
Timber.d(snapshot.toString() )
for(userSnapshot in snapshot.children){
val user = UserWrapper(userSnapshot)
ChatSDK.contact().addContact(user.model,ConnectionType.Contact).subscribe()
}
}
override fun onCancelled(error: DatabaseError) {
TODO("Not yet implemented")
}
}
ref.addValueEventListener(userListener)
```
Hi @BismeetSingh this code looks like it should be ok but since it's custom code and I don't know what your Firebase database looks like I can't say for sure why it's not working. I would recommend that you check that the user snapshot is in the right format. You can confirm this by debugging.
I'm going to close this issue because it's not actually a Chat SDK bug. If you need further support you can follow up on Discord and consider buying some priority support time.