File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
samplekotlin/src/main/java/com/example/chattutorial Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -81,13 +81,16 @@ class ChannelActivity3 : AppCompatActivity() {
8181 binding.typingHeaderView.text = nobodyTyping
8282
8383 // Obtain a ChannelController
84- val channelController = ChatDomain .instance().useCases.getChannelController(cid).execute().data()
85-
86- // Observe typing users
87- channelController.typing.observe(this ) { users ->
88- binding.typingHeaderView.text = when {
89- users.isNotEmpty() -> users.joinToString(prefix = " typing: " ) { user -> user.name }
90- else -> nobodyTyping
84+ ChatDomain .instance().useCases.getChannelController(cid).enqueue { channelControllerResult ->
85+ if (channelControllerResult.isSuccess) {
86+
87+ // Observe typing users
88+ channelControllerResult.data().typing.observe(this ) { users ->
89+ binding.typingHeaderView.text = when {
90+ users.isNotEmpty() -> users.joinToString(prefix = " typing: " ) { user -> user.name }
91+ else -> nobodyTyping
92+ }
93+ }
9194 }
9295 }
9396 }
You can’t perform that action at this time.
0 commit comments