Skip to content

Commit 277557a

Browse files
committed
Replace StreamColors with StreamDesign.Colors across the library and samples
1 parent 6b0323d commit 277557a

13 files changed

Lines changed: 36 additions & 63 deletions

File tree

stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ import io.getstream.chat.android.compose.ui.theme.ComposerInputFieldTheme
7979
import io.getstream.chat.android.compose.ui.theme.MessageComposerTheme
8080
import io.getstream.chat.android.compose.ui.theme.MessageOptionsTheme
8181
import io.getstream.chat.android.compose.ui.theme.ReactionOptionsTheme
82-
import io.getstream.chat.android.compose.ui.theme.StreamColors
82+
import io.getstream.chat.android.compose.ui.theme.StreamDesign
8383
import io.getstream.chat.android.compose.ui.theme.StreamTypography
8484
import io.getstream.chat.android.compose.ui.util.rememberMessageListState
8585
import io.getstream.chat.android.compose.viewmodel.messages.AttachmentsPickerViewModel
@@ -138,7 +138,7 @@ class MessagesActivity : ComponentActivity() {
138138
@Composable
139139
private fun SetupChatTheme() {
140140
val isInDarkMode = isSystemInDarkTheme()
141-
val colors = if (isInDarkMode) StreamColors.defaultDarkColors() else StreamColors.defaultColors()
141+
val colors = if (isInDarkMode) StreamDesign.Colors.defaultDark() else StreamDesign.Colors.default()
142142
val typography = StreamTypography.defaultTypography()
143143
val messageComposerTheme = MessageComposerTheme
144144
.defaultTheme(isInDarkMode, typography, colors)

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3746,9 +3746,7 @@ public final class io/getstream/chat/android/compose/ui/theme/StreamDesign$Color
37463746

37473747
public final class io/getstream/chat/android/compose/ui/theme/StreamDesign$Colors$Companion {
37483748
public final fun default ()Lio/getstream/chat/android/compose/ui/theme/StreamDesign$Colors;
3749-
public final fun defaultColors ()Lio/getstream/chat/android/compose/ui/theme/StreamDesign$Colors;
37503749
public final fun defaultDark ()Lio/getstream/chat/android/compose/ui/theme/StreamDesign$Colors;
3751-
public final fun defaultDarkColors ()Lio/getstream/chat/android/compose/ui/theme/StreamDesign$Colors;
37523750
}
37533751

37543752
public final class io/getstream/chat/android/compose/ui/theme/StreamDesign$Dimens {

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/composer/ComposerLinkPreview.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import coil3.compose.LocalAsyncImagePreviewHandler
5656
import io.getstream.chat.android.compose.R
5757
import io.getstream.chat.android.compose.ui.components.ComposerCancelIcon
5858
import io.getstream.chat.android.compose.ui.theme.ChatTheme
59-
import io.getstream.chat.android.compose.ui.theme.StreamColors
59+
import io.getstream.chat.android.compose.ui.theme.StreamDesign
6060
import io.getstream.chat.android.compose.ui.theme.StreamTokens
6161
import io.getstream.chat.android.compose.ui.util.AsyncImagePreviewHandler
6262
import io.getstream.chat.android.compose.ui.util.StreamAsyncImage
@@ -148,7 +148,7 @@ public fun ComposerLinkPreview(
148148
}
149149

150150
@Composable
151-
private fun ComposerLinkImagePreview(attachment: Attachment, colors: StreamColors) {
151+
private fun ComposerLinkImagePreview(attachment: Attachment, colors: StreamDesign.Colors) {
152152
val imagePreviewUrl = attachment.imagePreviewUrl ?: return
153153
val shape = RoundedCornerShape(StreamTokens.radiusMd)
154154
StreamAsyncImage(

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/composer/InputField.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import androidx.compose.ui.tooling.preview.Preview
4646
import androidx.compose.ui.unit.dp
4747
import io.getstream.chat.android.compose.ui.theme.ChatTheme
4848
import io.getstream.chat.android.compose.ui.theme.ComposerInputFieldTheme
49-
import io.getstream.chat.android.compose.ui.theme.StreamColors
49+
import io.getstream.chat.android.compose.ui.theme.StreamDesign
5050
import io.getstream.chat.android.compose.ui.theme.StreamTypography
5151
import io.getstream.chat.android.compose.ui.util.buildAnnotatedInputText
5252

@@ -137,7 +137,7 @@ public fun InputField(
137137
private class DefaultInputFieldVisualTransformation(
138138
val inputFieldTheme: ComposerInputFieldTheme,
139139
val typography: StreamTypography,
140-
val colors: StreamColors,
140+
val colors: StreamDesign.Colors,
141141
) : VisualTransformation {
142142
override fun filter(text: AnnotatedString): TransformedText {
143143
val textColor = inputFieldTheme.textStyle.color

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/internal/MessageComposerInputCenterContent.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import androidx.compose.ui.text.style.TextDecoration
4646
import io.getstream.chat.android.compose.R
4747
import io.getstream.chat.android.compose.ui.theme.ChatTheme
4848
import io.getstream.chat.android.compose.ui.theme.ComposerInputFieldTheme
49-
import io.getstream.chat.android.compose.ui.theme.StreamColors
49+
import io.getstream.chat.android.compose.ui.theme.StreamDesign
5050
import io.getstream.chat.android.compose.ui.theme.StreamTokens
5151
import io.getstream.chat.android.compose.ui.theme.StreamTypography
5252
import io.getstream.chat.android.compose.ui.util.buildAnnotatedInputText
@@ -151,7 +151,7 @@ private const val TextFieldMaxLines = 5
151151
private class TextFieldVisualTransformation(
152152
val inputFieldTheme: ComposerInputFieldTheme,
153153
val typography: StreamTypography,
154-
val colors: StreamColors,
154+
val colors: StreamDesign.Colors,
155155
val mentions: Set<Mention>,
156156
) : VisualTransformation {
157157
override fun filter(text: AnnotatedString): TransformedText {

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatTheme.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import io.getstream.sdk.chat.audio.recording.StreamMediaRecorder
7575
/**
7676
* Local providers for various properties we connect to our components, for styling.
7777
*/
78-
private val LocalColors = compositionLocalOf<StreamColors> {
78+
private val LocalColors = compositionLocalOf<StreamDesign.Colors> {
7979
error("No colors provided! Make sure to wrap all usages of Stream components in a ChatTheme.")
8080
}
8181
private val LocalDimens = compositionLocalOf<StreamDimens> {
@@ -244,7 +244,7 @@ private val LocalChatConfig = compositionLocalOf<ChatConfig> {
244244
* @param isComposerLinkPreviewEnabled Whether the composer link preview is enabled or not.
245245
* @param attachmentPickerConfig Configuration for the attachment picker modes and settings.
246246
* @param messageComposerFloatingStyleEnabled Whether the message composer should use the floating style or not.
247-
* @param colors The set of colors we provide, wrapped in [StreamColors].
247+
* @param colors The set of colors we provide, wrapped in [StreamDesign.Colors].
248248
* @param dimens The set of dimens we provide, wrapped in [StreamDimens].
249249
* @param typography The set of typography styles we provide, wrapped in [StreamTypography].
250250
* @param rippleConfiguration Defines the appearance for ripples.
@@ -291,7 +291,8 @@ public fun ChatTheme(
291291
isComposerLinkPreviewEnabled: Boolean = false,
292292
attachmentPickerConfig: AttachmentPickerConfig = AttachmentPickerConfig(),
293293
messageComposerFloatingStyleEnabled: Boolean = false,
294-
colors: StreamColors = if (isInDarkMode) StreamColors.defaultDarkColors() else StreamColors.defaultColors(),
294+
colors: StreamDesign.Colors =
295+
if (isInDarkMode) StreamDesign.Colors.defaultDark() else StreamDesign.Colors.default(),
295296
dimens: StreamDimens = StreamDimens.defaultDimens(),
296297
typography: StreamTypography = StreamTypography.defaultTypography(),
297298
rippleConfiguration: StreamRippleConfiguration = StreamRippleConfiguration.defaultRippleConfiguration(
@@ -419,9 +420,9 @@ public object ChatTheme {
419420
get() = LocalChatConfig.current
420421

421422
/**
422-
* Retrieves the current [StreamColors] at the call site's position in the hierarchy.
423+
* Retrieves the current [StreamDesign.Colors] at the call site's position in the hierarchy.
423424
*/
424-
public val colors: StreamColors
425+
public val colors: StreamDesign.Colors
425426
@Composable
426427
@ReadOnlyComposable
427428
get() = LocalColors.current

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/MessageComposerTheme.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public data class MessageComposerTheme(
5151
public fun defaultTheme(
5252
isInDarkMode: Boolean = isSystemInDarkTheme(),
5353
typography: StreamTypography = StreamTypography.defaultTypography(),
54-
colors: StreamColors = when (isInDarkMode) {
55-
true -> StreamColors.defaultDarkColors()
56-
else -> StreamColors.defaultColors()
54+
colors: StreamDesign.Colors = when (isInDarkMode) {
55+
true -> StreamDesign.Colors.defaultDark()
56+
else -> StreamDesign.Colors.default()
5757
},
5858
): MessageComposerTheme {
5959
return MessageComposerTheme(
@@ -85,9 +85,9 @@ public data class ComposerInputFieldTheme(
8585
@Composable
8686
public fun defaultTheme(
8787
typography: StreamTypography = StreamTypography.defaultTypography(),
88-
colors: StreamColors = when (isSystemInDarkTheme()) {
89-
true -> StreamColors.defaultDarkColors()
90-
else -> StreamColors.defaultColors()
88+
colors: StreamDesign.Colors = when (isSystemInDarkTheme()) {
89+
true -> StreamDesign.Colors.defaultDark()
90+
else -> StreamDesign.Colors.default()
9191
},
9292
mentionStyleFactory: MentionStyleFactory = MentionStyleFactory.NoStyle,
9393
): ComposerInputFieldTheme {
@@ -150,7 +150,7 @@ public data class ComposerActionsTheme(
150150
* @return A [ComposerActionsTheme] instance holding the default theming.
151151
*/
152152
@Composable
153-
public fun defaultTheme(colors: StreamColors): ComposerActionsTheme {
153+
public fun defaultTheme(colors: StreamDesign.Colors): ComposerActionsTheme {
154154
val attachmentsButton = IconContainerStyle(
155155
size = ComponentSize(width = 48.dp, height = 48.dp),
156156
padding = ComponentPadding(0.dp),

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/MessageStyling.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import io.getstream.chat.android.ui.common.utils.extensions.isMine
3232
@Suppress("TooManyFunctions")
3333
internal object MessageStyling {
3434
@Composable
35-
fun backgroundColor(outgoing: Boolean, colors: StreamColors = ChatTheme.colors) = when {
35+
fun backgroundColor(outgoing: Boolean, colors: StreamDesign.Colors = ChatTheme.colors) = when {
3636
outgoing -> colors.chatBgOutgoing
3737
else -> colors.chatBgIncoming
3838
}
@@ -42,7 +42,7 @@ internal object MessageStyling {
4242
return textColor(outgoing, ChatTheme.colors)
4343
}
4444

45-
fun textColor(outgoing: Boolean, colors: StreamColors): Color {
45+
fun textColor(outgoing: Boolean, colors: StreamDesign.Colors): Color {
4646
return if (outgoing) {
4747
colors.chatTextOutgoing
4848
} else {
@@ -54,11 +54,11 @@ internal object MessageStyling {
5454
fun textStyle(outgoing: Boolean): TextStyle =
5555
textStyle(outgoing, ChatTheme.typography, ChatTheme.colors)
5656

57-
fun textStyle(outgoing: Boolean, typography: StreamTypography, colors: StreamColors): TextStyle {
57+
fun textStyle(outgoing: Boolean, typography: StreamTypography, colors: StreamDesign.Colors): TextStyle {
5858
return typography.bodyDefault.copy(color = textColor(outgoing, colors))
5959
}
6060

61-
fun linkStyle(typography: StreamTypography, colors: StreamColors): TextStyle =
61+
fun linkStyle(typography: StreamTypography, colors: StreamDesign.Colors): TextStyle =
6262
typography.bodyDefault.copy(color = colors.chatTextLink)
6363

6464
@Composable

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/StreamDesign.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,6 @@ public object StreamDesign {
262262
) {
263263

264264
public companion object {
265-
/**
266-
* Provides the default colors for the light mode of the app.
267-
*
268-
* @return A [Colors] instance holding our color palette.
269-
*/
270-
@Deprecated("Use default()", ReplaceWith("default()"))
271-
@Suppress("LongMethod")
272-
public fun defaultColors(): Colors = default()
273-
274265
/**
275266
* Provides the default colors for the light mode of the app.
276267
*
@@ -351,15 +342,6 @@ public object StreamDesign {
351342
highlightBackground = StreamPrimitiveColors.highlightLight,
352343
)
353344

354-
/**
355-
* Provides the default colors for the dark mode of the app.
356-
*
357-
* @return A [Colors] instance holding our color palette.
358-
*/
359-
@Deprecated("Use defaultDark()", ReplaceWith("defaultDark()"))
360-
@Suppress("LongMethod")
361-
public fun defaultDarkColors(): Colors = defaultDark()
362-
363345
/**
364346
* Provides the default colors for the dark mode of the app.
365347
*

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/StreamColors.kt renamed to stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/StreamPrimitiveColors.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
@file:Suppress("MatchingDeclarationName")
18-
1917
package io.getstream.chat.android.compose.ui.theme
2018

2119
import androidx.compose.ui.graphics.Color
2220

23-
/**
24-
* Use [StreamDesign.Colors] instead.
25-
*/
26-
@Deprecated("Use StreamDesign.Colors", ReplaceWith("StreamDesign.Colors"))
27-
public typealias StreamColors = StreamDesign.Colors
28-
2921
@Suppress("MagicNumber")
3022
internal object StreamPrimitiveColors {
3123
val baseBlack = Color(0xFF000000)

0 commit comments

Comments
 (0)