Skip to content

Commit aa9c313

Browse files
authored
Merge pull request #3 from GetStream/feature/update-to-4.22.0
Update SDK version to 4.22.0
2 parents 3fe324a + d9b4b21 commit aa9c313

File tree

5 files changed

+29
-30
lines changed

5 files changed

+29
-30
lines changed

app/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ plugins {
44
}
55

66
android {
7-
compileSdk 30
7+
compileSdk 31
88

99
defaultConfig {
1010
applicationId "com.example.chattutorial"
1111
minSdk 21
12-
targetSdk 30
12+
targetSdk 31
1313
versionCode 1
1414
versionName "1.0"
1515

@@ -38,7 +38,6 @@ android {
3838
}
3939
composeOptions {
4040
kotlinCompilerExtensionVersion compose_version
41-
kotlinCompilerVersion '1.5.10'
4241
}
4342
packagingOptions {
4443
resources {
@@ -48,7 +47,7 @@ android {
4847
}
4948

5049
dependencies {
51-
def stream_version = "4.18.0"
50+
def stream_version = "4.22.0"
5251
implementation "io.getstream:stream-chat-android-compose:$stream_version-beta"
5352

5453
implementation "androidx.compose.material:material-icons-extended:$compose_version"

app/src/main/java/com/example/chattutorial/MainActivity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ class MainActivity : AppCompatActivity() {
1616
override fun onCreate(savedInstanceState: Bundle?) {
1717
super.onCreate(savedInstanceState)
1818

19-
// Step 1 - Set up the client for API calls and the domain for offline storage
19+
// 1 - Set up the client for API calls and the domain for offline storage
2020
val client = ChatClient.Builder("b67pax5b2wdq", applicationContext)
2121
.logLevel(ChatLogLevel.ALL) // Set to NOTHING in prod
2222
.build()
2323
ChatDomain.Builder(client, applicationContext).build()
2424

25-
// Step 2 - Authenticate and connect the user
25+
// 2 - Authenticate and connect the user
2626
val user = User(
2727
id = "tutorial-droid",
2828
extraData = mutableMapOf(
@@ -35,7 +35,7 @@ class MainActivity : AppCompatActivity() {
3535
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidHV0b3JpYWwtZHJvaWQifQ.NhEr0hP9W9nwqV7ZkdShxvi02C5PR7SJE7Cs4y7kyqg"
3636
).enqueue()
3737

38-
// Step 3 - Set up the Channels Screen UI
38+
// 3 - Set up the Channels Screen UI
3939
setContent {
4040
ChatTheme {
4141
ChannelsScreen(

app/src/main/java/com/example/chattutorial/MessagesActivity3.kt

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.example.chattutorial
22

3-
import android.content.ClipboardManager
43
import android.content.Context
54
import android.content.Intent
65
import android.os.Bundle
76
import androidx.activity.compose.setContent
87
import androidx.activity.viewModels
98
import androidx.appcompat.app.AppCompatActivity
9+
import androidx.compose.foundation.background
1010
import androidx.compose.foundation.layout.Box
1111
import androidx.compose.foundation.layout.fillMaxSize
1212
import androidx.compose.foundation.layout.height
@@ -20,7 +20,6 @@ import androidx.compose.ui.Alignment
2020
import androidx.compose.ui.Modifier
2121
import androidx.compose.ui.graphics.RectangleShape
2222
import androidx.compose.ui.unit.dp
23-
import io.getstream.chat.android.client.ChatClient
2423
import io.getstream.chat.android.compose.state.messages.Thread
2524
import io.getstream.chat.android.compose.ui.messages.attachments.AttachmentsPicker
2625
import io.getstream.chat.android.compose.ui.messages.composer.MessageComposer
@@ -33,20 +32,14 @@ import io.getstream.chat.android.compose.viewmodel.messages.AttachmentsPickerVie
3332
import io.getstream.chat.android.compose.viewmodel.messages.MessageComposerViewModel
3433
import io.getstream.chat.android.compose.viewmodel.messages.MessageListViewModel
3534
import io.getstream.chat.android.compose.viewmodel.messages.MessagesViewModelFactory
36-
import io.getstream.chat.android.offline.ChatDomain
3735

3836
class MessagesActivity3 : AppCompatActivity() {
3937

4038
// Build the ViewModel factory
4139
private val factory by lazy {
4240
MessagesViewModelFactory(
43-
this,
44-
getSystemService(CLIPBOARD_SERVICE) as ClipboardManager,
45-
ChatClient.instance(),
46-
ChatDomain.instance(),
47-
intent.getStringExtra(MessagesActivity3.KEY_CHANNEL_ID) ?: "",
48-
enforceUniqueReactions = true,
49-
messageLimit = 30
41+
context = this,
42+
channelId = intent.getStringExtra(KEY_CHANNEL_ID) ?: "",
5043
)
5144
}
5245

@@ -94,11 +87,17 @@ class MessagesActivity3 : AppCompatActivity() {
9487
Scaffold(
9588
modifier = Modifier.fillMaxSize(),
9689
bottomBar = {
97-
MessageComposer(composerViewModel) // 3 - Add a composer
90+
MessageComposer( // 3 - Add a composer
91+
composerViewModel,
92+
onAttachmentsClick = {
93+
attachmentsPickerViewModel.changeAttachmentState(true)
94+
}
95+
)
9896
}
9997
) {
10098
MessageList( // 4 - Build the MessageList and connect the actions
10199
modifier = Modifier
100+
.background(ChatTheme.colors.appBackground)
102101
.padding(it)
103102
.fillMaxSize(),
104103
viewModel = listViewModel,

app/src/main/java/com/example/chattutorial/MessagesActivity4.kt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
package com.example.chattutorial
22

3-
import android.content.ClipboardManager
43
import android.content.Context
54
import android.content.Intent
65
import android.os.Bundle
76
import androidx.activity.compose.setContent
87
import androidx.activity.viewModels
98
import androidx.appcompat.app.AppCompatActivity
10-
import androidx.compose.foundation.layout.*
9+
import androidx.compose.foundation.background
10+
import androidx.compose.foundation.layout.Box
11+
import androidx.compose.foundation.layout.Row
12+
import androidx.compose.foundation.layout.fillMaxSize
13+
import androidx.compose.foundation.layout.fillMaxWidth
14+
import androidx.compose.foundation.layout.height
15+
import androidx.compose.foundation.layout.padding
16+
import androidx.compose.foundation.layout.wrapContentHeight
17+
import androidx.compose.foundation.layout.wrapContentWidth
1118
import androidx.compose.foundation.shape.RoundedCornerShape
1219
import androidx.compose.material.Icon
1320
import androidx.compose.material.Scaffold
@@ -21,7 +28,6 @@ import androidx.compose.ui.Alignment
2128
import androidx.compose.ui.Modifier
2229
import androidx.compose.ui.graphics.RectangleShape
2330
import androidx.compose.ui.unit.dp
24-
import io.getstream.chat.android.client.ChatClient
2531
import io.getstream.chat.android.compose.state.messages.Thread
2632
import io.getstream.chat.android.compose.ui.messages.attachments.AttachmentsPicker
2733
import io.getstream.chat.android.compose.ui.messages.composer.MessageComposer
@@ -35,20 +41,14 @@ import io.getstream.chat.android.compose.viewmodel.messages.AttachmentsPickerVie
3541
import io.getstream.chat.android.compose.viewmodel.messages.MessageComposerViewModel
3642
import io.getstream.chat.android.compose.viewmodel.messages.MessageListViewModel
3743
import io.getstream.chat.android.compose.viewmodel.messages.MessagesViewModelFactory
38-
import io.getstream.chat.android.offline.ChatDomain
3944

4045
class MessagesActivity4 : AppCompatActivity() {
4146

4247
// Build the ViewModel factory
4348
private val factory by lazy {
4449
MessagesViewModelFactory(
45-
this,
46-
getSystemService(CLIPBOARD_SERVICE) as ClipboardManager,
47-
ChatClient.instance(),
48-
ChatDomain.instance(),
49-
intent.getStringExtra(MessagesActivity4.KEY_CHANNEL_ID) ?: "",
50-
enforceUniqueReactions = true,
51-
messageLimit = 30
50+
context = this,
51+
channelId = intent.getStringExtra(KEY_CHANNEL_ID) ?: "",
5252
)
5353
}
5454

@@ -101,6 +101,7 @@ class MessagesActivity4 : AppCompatActivity() {
101101
) {
102102
MessageList( // 4 - Build the MessageList and connect the actions
103103
modifier = Modifier
104+
.background(ChatTheme.colors.appBackground)
104105
.padding(it)
105106
.fillMaxSize(),
106107
viewModel = listViewModel,

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
mavenCentral()
99
}
1010
dependencies {
11-
classpath "com.android.tools.build:gradle:7.0.2"
11+
classpath "com.android.tools.build:gradle:7.0.3"
1212
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21'
1313

1414
// NOTE: Do not place your application dependencies here; they belong

0 commit comments

Comments
 (0)