Skip to content

Commit 7bcfe60

Browse files
authored
Merge branch 'develop' into chore/sample-app-polish
2 parents ffa84f8 + b32775f commit 7bcfe60

121 files changed

Lines changed: 2258 additions & 431 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
![stream-chat-android-client](https://img.shields.io/badge/stream--chat--android--client-5.82%20MB-lightgreen)
2222
![stream-chat-android-ui-components](https://img.shields.io/badge/stream--chat--android--ui--components-11.01%20MB-lightgreen)
23-
![stream-chat-android-compose](https://img.shields.io/badge/stream--chat--android--compose-12.37%20MB-lightgreen)
23+
![stream-chat-android-compose](https://img.shields.io/badge/stream--chat--android--compose-12.40%20MB-lightgreen)
2424

2525
</div>
2626

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ tasks.withType<Delete> {
114114
}
115115

116116
apiValidation {
117-
ignoredPackages.add("com/getstream/sdk/chat/databinding")
118117
ignoredPackages.add("io/getstream/chat/android/ui/databinding")
119118

120119
ignoredProjects += listOf(
120+
"stream-chat-android-benchmark",
121121
"stream-chat-android-client-test",
122122
"stream-chat-android-compose-sample",
123123
"stream-chat-android-docs",

metrics/size.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"debug": {
33
"stream-chat-android-client": 7840,
44
"stream-chat-android-ui-components": 14224,
5-
"stream-chat-android-compose": 16096
5+
"stream-chat-android-compose": 16136
66
},
77
"release": {
88
"stream-chat-android-client": 5960,
99
"stream-chat-android-ui-components": 11284,
10-
"stream-chat-android-compose": 12668
10+
"stream-chat-android-compose": 12700
1111
}
1212
}

stream-chat-android-client/src/main/java/io/getstream/chat/android/client/internal/state/sync/internal/SyncManager.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ import java.util.concurrent.atomic.AtomicBoolean
7878
import java.util.concurrent.atomic.AtomicReference
7979

8080
private const val QUERIES_TO_RETRY = 3
81+
private const val SYNC_MAX_CIDS = 100
8182

8283
/**
8384
* This class is responsible to sync messages, reactions and channel data. It tries to sync then, if necessary,
@@ -303,10 +304,11 @@ internal class SyncManager(
303304
val lastSyncAt = syncState?.lastSyncedAt ?: Date(now())
304305
val rawLastSyncAt = syncState?.rawLastSyncedAt
305306
logger.v { "[performSync] lastSyncAt: $lastSyncAt, rawLastSyncAt: $rawLastSyncAt" }
307+
val cappedCids = cids.take(SYNC_MAX_CIDS)
306308
val result = if (rawLastSyncAt != null) {
307-
chatClient.getSyncHistory(cids, rawLastSyncAt).await()
309+
chatClient.getSyncHistory(cappedCids, rawLastSyncAt).await()
308310
} else {
309-
chatClient.getSyncHistory(cids, lastSyncAt).await()
311+
chatClient.getSyncHistory(cappedCids, lastSyncAt).await()
310312
}
311313
if (result.isTooManyEventsToSyncError()) {
312314
logger.e { "[performSync] failed (too many events to sync): $result" }

stream-chat-android-client/src/test/java/io/getstream/chat/android/client/internal/state/internal/SyncManagerTest.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ import org.junit.jupiter.api.Test
7070
import org.junit.jupiter.api.TestInstance
7171
import org.mockito.kotlin.any
7272
import org.mockito.kotlin.doReturn
73+
import org.mockito.kotlin.eq
7374
import org.mockito.kotlin.mock
7475
import org.mockito.kotlin.never
7576
import org.mockito.kotlin.times
@@ -223,6 +224,27 @@ internal class SyncManagerTest {
223224
}
224225
}
225226

227+
@Test
228+
fun `performSync caps channel_cids at 100`() = runTest(testDispatcher) {
229+
/* Given */
230+
_syncState.value = null
231+
whenever(repositoryFacade.selectSyncState(any())) doReturn null
232+
val cids = (1..150).map { "messaging:channel-$it" }
233+
val expectedCids = cids.take(100)
234+
235+
whenever(chatClient.getSyncHistory(any(), any<Date>())) doReturn TestCall(
236+
Result.Success(emptyList()),
237+
)
238+
239+
val syncManager = buildSyncManager()
240+
241+
/* When */
242+
syncManager.performSync(cids = cids)
243+
244+
/* Then */
245+
verify(chatClient).getSyncHistory(eq(expectedCids), any<Date>())
246+
}
247+
226248
@Test
227249
fun `test sync max threshold for messages`() = runTest(testDispatcher) {
228250
/* Given */

stream-chat-android-compose/api/stream-chat-android-compose.api

Lines changed: 58 additions & 13 deletions
Large diffs are not rendered by default.

stream-chat-android-compose/detekt-baseline.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<ID>MagicNumber:PollMoreOptionsDialog.kt$200</ID>
1111
<ID>MagicNumber:PollMoreOptionsDialog.kt$400</ID>
1212
<ID>MagicNumber:TypingIndicatorAnimatedDot.kt$0.5f</ID>
13-
<ID>MagicNumber:WaveformSlider.kt$100</ID>
1413
<ID>MagicNumber:WaveformSlider.kt$50</ID>
1514
<ID>MaxLineLength:MessageOptions.kt$title = if (selectedMessage.pinned) R.string.stream_compose_unpin_message else R.string.stream_compose_pin_message</ID>
1615
<ID>MaxLineLength:PollCreationHeader.kt$*</ID>

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/FileAttachmentContent.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import androidx.compose.foundation.layout.padding
2828
import androidx.compose.foundation.layout.size
2929
import androidx.compose.foundation.shape.RoundedCornerShape
3030
import androidx.compose.material3.Text
31+
import androidx.compose.material3.ripple
3132
import androidx.compose.runtime.Composable
3233
import androidx.compose.runtime.remember
3334
import androidx.compose.ui.Alignment
@@ -36,6 +37,7 @@ import androidx.compose.ui.draw.clip
3637
import androidx.compose.ui.graphics.Color
3738
import androidx.compose.ui.layout.ContentScale
3839
import androidx.compose.ui.platform.testTag
40+
import androidx.compose.ui.res.stringResource
3941
import androidx.compose.ui.text.TextStyle
4042
import androidx.compose.ui.text.style.TextOverflow
4143
import androidx.compose.ui.tooling.preview.Preview
@@ -44,6 +46,7 @@ import io.getstream.chat.android.client.utils.attachment.isAudio
4446
import io.getstream.chat.android.client.utils.attachment.isFile
4547
import io.getstream.chat.android.client.utils.attachment.isImage
4648
import io.getstream.chat.android.client.utils.attachment.isVideo
49+
import io.getstream.chat.android.compose.R
4750
import io.getstream.chat.android.compose.state.messages.attachments.AttachmentState
4851
import io.getstream.chat.android.compose.ui.attachments.preview.handler.AttachmentPreviewHandler
4952
import io.getstream.chat.android.compose.ui.components.LoadingIndicator
@@ -99,6 +102,7 @@ public fun FileAttachmentContent(
99102
)
100103
.testTag("Stream_MultipleFileAttachmentsColumn"),
101104
) {
105+
val openAttachmentLabel = stringResource(R.string.stream_compose_message_attachment_open)
102106
for (attachment in message.attachments) {
103107
if (attachment.isFile() || attachment.isAudio()) {
104108
ChatTheme.componentFactory.FileAttachmentItem(
@@ -111,8 +115,9 @@ public fun FileAttachmentContent(
111115
.background(color, fileAttachmentShape)
112116
}
113117
.combinedClickable(
114-
indication = null,
118+
indication = ripple(),
115119
interactionSource = remember { MutableInteractionSource() },
120+
onClickLabel = openAttachmentLabel,
116121
onClick = { onItemClick(previewHandlers, attachment) },
117122
onLongClick = { attachmentState.onLongItemClick(message) },
118123
),

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/GiphyAttachmentContent.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import androidx.compose.foundation.layout.padding
3030
import androidx.compose.foundation.layout.size
3131
import androidx.compose.foundation.shape.RoundedCornerShape
3232
import androidx.compose.material3.Text
33+
import androidx.compose.material3.ripple
3334
import androidx.compose.runtime.Composable
3435
import androidx.compose.runtime.CompositionLocalProvider
3536
import androidx.compose.runtime.remember
@@ -123,7 +124,7 @@ public fun GiphyAttachmentContent(
123124
.clip(RoundedCornerShape(StreamTokens.radiusLg))
124125
}
125126
.combinedClickable(
126-
indication = null,
127+
indication = ripple(),
127128
interactionSource = remember { MutableInteractionSource() },
128129
onClick = {
129130
onItemClick(

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/attachments/content/LinkAttachmentContent.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import androidx.compose.foundation.layout.size
3737
import androidx.compose.foundation.shape.RoundedCornerShape
3838
import androidx.compose.material3.Icon
3939
import androidx.compose.material3.Text
40+
import androidx.compose.material3.ripple
4041
import androidx.compose.runtime.Composable
4142
import androidx.compose.runtime.CompositionLocalProvider
4243
import androidx.compose.runtime.remember
@@ -49,6 +50,7 @@ import androidx.compose.ui.layout.ContentScale
4950
import androidx.compose.ui.platform.LocalContext
5051
import androidx.compose.ui.platform.testTag
5152
import androidx.compose.ui.res.painterResource
53+
import androidx.compose.ui.res.stringResource
5254
import androidx.compose.ui.text.style.TextOverflow
5355
import androidx.compose.ui.tooling.preview.Preview
5456
import androidx.compose.ui.unit.dp
@@ -104,15 +106,17 @@ public fun LinkAttachmentContent(
104106
}
105107

106108
val context = LocalContext.current
109+
val openAttachmentLabel = stringResource(R.string.stream_compose_message_attachment_open)
107110
val textColor = MessageStyling.textColor(outgoing = state.isMine)
108111
val baseModifier = modifier
109112
.padding(MessageStyling.messageSectionPadding)
110113
.fillMaxWidth()
111114
.clip(RoundedCornerShape(StreamTokens.radiusLg))
112115
.background(MessageStyling.attachmentBackgroundColor(state.isMine))
113116
.combinedClickable(
114-
indication = null,
117+
indication = ripple(),
115118
interactionSource = remember { MutableInteractionSource() },
119+
onClickLabel = openAttachmentLabel,
116120
onClick = {
117121
onItemClick(
118122
LinkAttachmentClickData(

0 commit comments

Comments
 (0)