Skip to content

Commit 43cd969

Browse files
authored
Merge pull request #8 from GetStream/sdk/5.0.1
Update SDK version to 5.0.1
2 parents 1e53604 + 362722d commit 43cd969

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

app/build.gradle

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,13 @@ android {
4747
}
4848

4949
dependencies {
50-
def stream_version = "4.28.2"
51-
implementation "io.getstream:stream-chat-android-compose:$stream_version-beta"
50+
implementation "io.getstream:stream-chat-android-compose:5.0.1"
5251

5352
implementation "androidx.compose.material:material-icons-extended:$compose_version"
5453
implementation "androidx.compose.ui:ui:$compose_version"
5554
implementation "androidx.compose.material:material:$compose_version"
5655
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
5756
implementation "androidx.activity:activity-compose:1.4.0"
5857

59-
implementation "com.google.android.material:material:1.4.0"
60-
61-
testImplementation 'junit:junit:4.+'
62-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
63-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
64-
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
65-
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
58+
implementation "com.google.android.material:material:1.5.0"
6659
}

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

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,44 @@ import io.getstream.chat.android.client.logger.ChatLogLevel
99
import io.getstream.chat.android.client.models.User
1010
import io.getstream.chat.android.compose.ui.channels.ChannelsScreen
1111
import io.getstream.chat.android.compose.ui.theme.ChatTheme
12-
import io.getstream.chat.android.offline.ChatDomain
12+
import io.getstream.chat.android.offline.model.message.attachments.UploadAttachmentsNetworkType
13+
import io.getstream.chat.android.offline.plugin.configuration.Config
14+
import io.getstream.chat.android.offline.plugin.factory.StreamOfflinePluginFactory
1315

1416
class MainActivity : AppCompatActivity() {
1517

1618
override fun onCreate(savedInstanceState: Bundle?) {
1719
super.onCreate(savedInstanceState)
1820

19-
// 1 - Set up the client for API calls and the domain for offline storage
21+
// 1 - Set up the OfflinePlugin for offline storage
22+
val offlinePluginFactory = StreamOfflinePluginFactory(
23+
config = Config(
24+
backgroundSyncEnabled = true,
25+
userPresence = true,
26+
persistenceEnabled = true,
27+
uploadAttachmentsNetworkType = UploadAttachmentsNetworkType.NOT_ROAMING,
28+
),
29+
appContext = applicationContext,
30+
)
31+
32+
// 2 - Set up the client for API calls and with the plugin for offline storage
2033
val client = ChatClient.Builder("b67pax5b2wdq", applicationContext)
34+
.withPlugin(offlinePluginFactory)
2135
.logLevel(ChatLogLevel.ALL) // Set to NOTHING in prod
2236
.build()
23-
ChatDomain.Builder(client, applicationContext).build()
2437

25-
// 2 - Authenticate and connect the user
26-
val user = User(id = "tutorial-droid").apply {
27-
name = "Tutorial Droid"
38+
// 3 - Authenticate and connect the user
39+
val user = User(
40+
id = "tutorial-droid",
41+
name = "Tutorial Droid",
2842
image = "https://bit.ly/2TIt8NR"
29-
}
43+
)
3044
client.connectUser(
3145
user = user,
3246
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidHV0b3JpYWwtZHJvaWQifQ.NhEr0hP9W9nwqV7ZkdShxvi02C5PR7SJE7Cs4y7kyqg"
3347
).enqueue()
3448

35-
// 3 - Set up the Channels Screen UI
49+
// 4 - Set up the Channels Screen UI
3650
setContent {
3751
ChatTheme {
3852
ChannelsScreen(

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
buildscript {
22
ext {
3-
compose_version = '1.0.5'
3+
compose_version = '1.1.1'
44
}
55
repositories {
66
google()
77
mavenCentral()
88
}
99
dependencies {
10-
classpath "com.android.tools.build:gradle:7.1.0"
11-
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31'
10+
classpath "com.android.tools.build:gradle:7.1.2"
11+
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
1212
}
1313
}
1414

0 commit comments

Comments
 (0)