File tree Expand file tree Collapse file tree 2 files changed +21
-15
lines changed
src/main/java/com/example/chattutorial Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ android {
4747}
4848
4949dependencies {
50- implementation " io.getstream:stream-chat-android-compose:6.0.2 "
51- implementation " io.getstream:stream-chat-android-offline:6.0.2 "
50+ implementation " io.getstream:stream-chat-android-compose:6.0.8 "
51+ implementation " io.getstream:stream-chat-android-offline:6.0.8 "
5252
5353 implementation(platform(" androidx.compose:compose-bom:2023.08.00" ))
5454 implementation(" androidx.activity:activity-compose:1.7.2" )
Original file line number Diff line number Diff line change 11package com.example.chattutorial
22
33import android.os.Bundle
4+ import android.widget.Toast
45import androidx.activity.ComponentActivity
56import androidx.activity.compose.setContent
67import androidx.compose.ui.res.stringResource
@@ -42,22 +43,27 @@ class MainActivity : ComponentActivity() {
4243 name = " Tutorial Droid" ,
4344 image = " https://bit.ly/2TIt8NR"
4445 )
46+
4547 client.connectUser(
4648 user = user,
4749 token = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidHV0b3JpYWwtZHJvaWQifQ.WwfBzU1GZr0brt_fXnqKdKhz3oj0rbDUm2DqJO_SS5U"
48- ).enqueue()
49-
50- // 4 - Set up the Channels Screen UI
51- setContent {
52- ChatTheme {
53- ChannelsScreen (
54- title = stringResource(id = R .string.app_name),
55- isShowingSearch = true ,
56- onItemClick = { channel ->
57- startActivity(MessagesActivity4 .getIntent(this , channel.cid))
58- },
59- onBackPressed = { finish() }
60- )
50+ ).enqueue {
51+ if (it.isSuccess) {
52+ // 4 - Set up the Channels Screen UI
53+ setContent {
54+ ChatTheme {
55+ ChannelsScreen (
56+ title = stringResource(id = R .string.app_name),
57+ isShowingSearch = true ,
58+ onItemClick = { channel ->
59+ startActivity(MessagesActivity4 .getIntent(this @MainActivity, channel.cid))
60+ },
61+ onBackPressed = { finish() }
62+ )
63+ }
64+ }
65+ } else {
66+ Toast .makeText(this , " something went wrong!" , Toast .LENGTH_SHORT ).show()
6167 }
6268 }
6369 }
You can’t perform that action at this time.
0 commit comments