Skip to content

Commit fac07cd

Browse files
committed
Replace StreamTypography with StreamDesign.Typography across the library and samples
1 parent 277557a commit fac07cd

14 files changed

Lines changed: 42 additions & 69 deletions

File tree

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ 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
8282
import io.getstream.chat.android.compose.ui.theme.StreamDesign
83-
import io.getstream.chat.android.compose.ui.theme.StreamTypography
8483
import io.getstream.chat.android.compose.ui.util.rememberMessageListState
8584
import io.getstream.chat.android.compose.viewmodel.messages.AttachmentsPickerViewModel
8685
import io.getstream.chat.android.compose.viewmodel.messages.MessageComposerViewModel
@@ -139,7 +138,7 @@ class MessagesActivity : ComponentActivity() {
139138
private fun SetupChatTheme() {
140139
val isInDarkMode = isSystemInDarkTheme()
141140
val colors = if (isInDarkMode) StreamDesign.Colors.defaultDark() else StreamDesign.Colors.default()
142-
val typography = StreamTypography.defaultTypography()
141+
val typography = StreamDesign.Typography.default()
143142
val messageComposerTheme = MessageComposerTheme
144143
.defaultTheme(isInDarkMode, typography, colors)
145144
.copy(

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3912,8 +3912,6 @@ public final class io/getstream/chat/android/compose/ui/theme/StreamDesign$Typog
39123912
public final class io/getstream/chat/android/compose/ui/theme/StreamDesign$Typography$Companion {
39133913
public final fun default (Landroidx/compose/ui/text/font/FontFamily;)Lio/getstream/chat/android/compose/ui/theme/StreamDesign$Typography;
39143914
public static synthetic fun default$default (Lio/getstream/chat/android/compose/ui/theme/StreamDesign$Typography$Companion;Landroidx/compose/ui/text/font/FontFamily;ILjava/lang/Object;)Lio/getstream/chat/android/compose/ui/theme/StreamDesign$Typography;
3915-
public final fun defaultTypography (Landroidx/compose/ui/text/font/FontFamily;)Lio/getstream/chat/android/compose/ui/theme/StreamDesign$Typography;
3916-
public static synthetic fun defaultTypography$default (Lio/getstream/chat/android/compose/ui/theme/StreamDesign$Typography$Companion;Landroidx/compose/ui/text/font/FontFamily;ILjava/lang/Object;)Lio/getstream/chat/android/compose/ui/theme/StreamDesign$Typography;
39173915
}
39183916

39193917
public final class io/getstream/chat/android/compose/ui/theme/StreamKeyboardBehaviour {

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/common/CountBadge.kt

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ import androidx.compose.ui.tooling.preview.Preview
3636
import androidx.compose.ui.unit.Dp
3737
import androidx.compose.ui.unit.dp
3838
import io.getstream.chat.android.compose.ui.theme.ChatTheme
39+
import io.getstream.chat.android.compose.ui.theme.StreamDesign
3940
import io.getstream.chat.android.compose.ui.theme.StreamTokens
40-
import io.getstream.chat.android.compose.ui.theme.StreamTypography
4141

4242
@Composable
4343
internal fun CountBadge(
@@ -67,10 +67,26 @@ internal fun CountBadge(
6767
)
6868
}
6969

70-
internal enum class CountBadgeSize(val minSize: Dp, val spacing: Dp, val textStyle: (StreamTypography) -> TextStyle) {
71-
Large(minSize = 32.dp, spacing = StreamTokens.spacingXs, textStyle = StreamTypography::numericLarge),
72-
Medium(minSize = 24.dp, spacing = StreamTokens.spacingXs, textStyle = StreamTypography::numericLarge),
73-
Small(minSize = 20.dp, spacing = StreamTokens.spacing2xs, textStyle = StreamTypography::numericMedium),
70+
internal enum class CountBadgeSize(
71+
val minSize: Dp,
72+
val spacing: Dp,
73+
val textStyle: (StreamDesign.Typography) -> TextStyle,
74+
) {
75+
Large(
76+
minSize = 32.dp,
77+
spacing = StreamTokens.spacingXs,
78+
textStyle = StreamDesign.Typography::numericLarge,
79+
),
80+
Medium(
81+
minSize = 24.dp,
82+
spacing = StreamTokens.spacingXs,
83+
textStyle = StreamDesign.Typography::numericLarge,
84+
),
85+
Small(
86+
minSize = 20.dp,
87+
spacing = StreamTokens.spacing2xs,
88+
textStyle = StreamDesign.Typography::numericMedium,
89+
),
7490
}
7591

7692
@Preview

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ 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
4949
import io.getstream.chat.android.compose.ui.theme.StreamDesign
50-
import io.getstream.chat.android.compose.ui.theme.StreamTypography
5150
import io.getstream.chat.android.compose.ui.util.buildAnnotatedInputText
5251

5352
/**
@@ -136,7 +135,7 @@ public fun InputField(
136135
*/
137136
private class DefaultInputFieldVisualTransformation(
138137
val inputFieldTheme: ComposerInputFieldTheme,
139-
val typography: StreamTypography,
138+
val typography: StreamDesign.Typography,
140139
val colors: StreamDesign.Colors,
141140
) : VisualTransformation {
142141
override fun filter(text: AnnotatedString): TransformedText {

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollOptionInput.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ import androidx.compose.ui.unit.dp
5959
import androidx.compose.ui.unit.sp
6060
import io.getstream.chat.android.compose.R
6161
import io.getstream.chat.android.compose.ui.theme.ChatTheme
62+
import io.getstream.chat.android.compose.ui.theme.StreamDesign
6263
import io.getstream.chat.android.compose.ui.theme.StreamTokens
63-
import io.getstream.chat.android.compose.ui.theme.StreamTypography
6464
import io.getstream.chat.android.compose.ui.util.buildAnnotatedInputText
6565

6666
/**
@@ -135,7 +135,7 @@ public fun PollOptionInput(
135135
)
136136
TransformedText(styledText, OffsetMapping.Identity)
137137
},
138-
textStyle = StreamTypography.default().bodyDefault.copy(
138+
textStyle = StreamDesign.Typography.default().bodyDefault.copy(
139139
textDirection = TextDirection.Content,
140140
),
141141
cursorBrush = SolidColor(ChatTheme.colors.accentPrimary),

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import io.getstream.chat.android.compose.ui.theme.ChatTheme
4848
import io.getstream.chat.android.compose.ui.theme.ComposerInputFieldTheme
4949
import io.getstream.chat.android.compose.ui.theme.StreamDesign
5050
import io.getstream.chat.android.compose.ui.theme.StreamTokens
51-
import io.getstream.chat.android.compose.ui.theme.StreamTypography
5251
import io.getstream.chat.android.compose.ui.util.buildAnnotatedInputText
5352
import io.getstream.chat.android.ui.common.feature.messages.composer.capabilities.canSendMessage
5453
import io.getstream.chat.android.ui.common.feature.messages.composer.mention.Mention
@@ -150,7 +149,7 @@ private const val TextFieldMaxLines = 5
150149

151150
private class TextFieldVisualTransformation(
152151
val inputFieldTheme: ComposerInputFieldTheme,
153-
val typography: StreamTypography,
152+
val typography: StreamDesign.Typography,
154153
val colors: StreamDesign.Colors,
155154
val mentions: Set<Mention>,
156155
) : VisualTransformation {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private val LocalColors = compositionLocalOf<StreamDesign.Colors> {
8181
private val LocalDimens = compositionLocalOf<StreamDimens> {
8282
error("No dimens provided! Make sure to wrap all usages of Stream components in a ChatTheme.")
8383
}
84-
private val LocalTypography = compositionLocalOf<StreamTypography> {
84+
private val LocalTypography = compositionLocalOf<StreamDesign.Typography> {
8585
error("No typography provided! Make sure to wrap all usages of Stream components in a ChatTheme.")
8686
}
8787
private val LocalUserPresence = compositionLocalOf<UserPresence> {
@@ -246,7 +246,7 @@ private val LocalChatConfig = compositionLocalOf<ChatConfig> {
246246
* @param messageComposerFloatingStyleEnabled Whether the message composer should use the floating style or not.
247247
* @param colors The set of colors we provide, wrapped in [StreamDesign.Colors].
248248
* @param dimens The set of dimens we provide, wrapped in [StreamDimens].
249-
* @param typography The set of typography styles we provide, wrapped in [StreamTypography].
249+
* @param typography The set of typography styles we provide, wrapped in [StreamDesign.Typography].
250250
* @param rippleConfiguration Defines the appearance for ripples.
251251
* @param userPresence The user presence display configuration.
252252
* @param componentFactory Provide to customize the stateless components that are used throughout the UI
@@ -294,7 +294,7 @@ public fun ChatTheme(
294294
colors: StreamDesign.Colors =
295295
if (isInDarkMode) StreamDesign.Colors.defaultDark() else StreamDesign.Colors.default(),
296296
dimens: StreamDimens = StreamDimens.defaultDimens(),
297-
typography: StreamTypography = StreamTypography.defaultTypography(),
297+
typography: StreamDesign.Typography = StreamDesign.Typography.default(),
298298
rippleConfiguration: StreamRippleConfiguration = StreamRippleConfiguration.defaultRippleConfiguration(
299299
contentColor = LocalContentColor.current,
300300
lightTheme = !isInDarkMode,
@@ -436,9 +436,9 @@ public object ChatTheme {
436436
get() = LocalDimens.current
437437

438438
/**
439-
* Retrieves the current [StreamTypography] at the call site's position in the hierarchy.
439+
* Retrieves the current [StreamDesign.Typography] at the call site's position in the hierarchy.
440440
*/
441-
public val typography: StreamTypography
441+
public val typography: StreamDesign.Typography
442442
@Composable
443443
@ReadOnlyComposable
444444
get() = LocalTypography.current

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public data class MessageComposerTheme(
5050
@Composable
5151
public fun defaultTheme(
5252
isInDarkMode: Boolean = isSystemInDarkTheme(),
53-
typography: StreamTypography = StreamTypography.defaultTypography(),
53+
typography: StreamDesign.Typography = StreamDesign.Typography.default(),
5454
colors: StreamDesign.Colors = when (isInDarkMode) {
5555
true -> StreamDesign.Colors.defaultDark()
5656
else -> StreamDesign.Colors.default()
@@ -84,7 +84,7 @@ public data class ComposerInputFieldTheme(
8484
public companion object {
8585
@Composable
8686
public fun defaultTheme(
87-
typography: StreamTypography = StreamTypography.defaultTypography(),
87+
typography: StreamDesign.Typography = StreamDesign.Typography.default(),
8888
colors: StreamDesign.Colors = when (isSystemInDarkTheme()) {
8989
true -> StreamDesign.Colors.defaultDark()
9090
else -> StreamDesign.Colors.default()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: StreamDesign.Colors): TextStyle {
57+
fun textStyle(outgoing: Boolean, typography: StreamDesign.Typography, colors: StreamDesign.Colors): TextStyle {
5858
return typography.bodyDefault.copy(color = textColor(outgoing, colors))
5959
}
6060

61-
fun linkStyle(typography: StreamTypography, colors: StreamDesign.Colors): TextStyle =
61+
fun linkStyle(typography: StreamDesign.Typography, 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 & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -456,16 +456,6 @@ public object StreamDesign {
456456
) {
457457

458458
public companion object {
459-
/**
460-
* Builds the default typography set for our theme, with the ability to customize the
461-
* font family.
462-
*
463-
* @param fontFamily The font that the users want to use for the app.
464-
* @return [Typography] that holds all the default text styles that we support.
465-
*/
466-
@Deprecated("Use default()", ReplaceWith("default(fontFamily)"))
467-
public fun defaultTypography(fontFamily: FontFamily? = null): Typography = default(fontFamily)
468-
469459
/**
470460
* Builds the default typography set for our theme, with the ability to customize the
471461
* font family.

0 commit comments

Comments
 (0)