Skip to content

Commit

Permalink
Apply markdown text in Chat screen
Browse files Browse the repository at this point in the history
  • Loading branch information
jja08111 committed Jul 4, 2024
1 parent 525107a commit 83d1e7d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions feature/chat/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ dependencies {
implementation(libs.androidx.hilt.navigation.compose)
implementation(libs.androidx.lifecycle.compose)

implementation(libs.compose.markdown)

implementation(libs.androidx.room.paging)
implementation(libs.androidx.paging.compose)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import dev.jeziellago.compose.markdowntext.MarkdownText
import io.jja08111.gemini.core.ui.R
import io.jja08111.gemini.model.MessageGroup
import io.jja08111.gemini.model.ModelResponseState
Expand Down Expand Up @@ -103,9 +104,9 @@ private fun ColumnScope.TextMessageItem(
isError -> ErrorMessageItem(textColor = textColor.copy(alpha = 0.4f))
isLoading && text.isEmpty() -> Shimmer()
else -> {
Text(
MarkdownText(
modifier = Modifier.align(Alignment.CenterVertically),
text = text,
markdown = text,
style = MaterialTheme.typography.bodyLarge.copy(
color = textColor,
),
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ material = "1.11.0"
ktlint = "12.1.0"
ksp = "1.9.22-1.0.17"
googleGenerativeAi = "0.2.0"
composeMarkdown = "0.5.0"

# Wearables
playServicesWearable = "18.1.0"
Expand Down Expand Up @@ -58,6 +59,7 @@ androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
google-generative-ai = { group = "com.google.ai.client.generativeai", name = "generativeai", version.ref = "googleGenerativeAi" }
compose-markdown = { group = "com.github.jeziellago", name = "compose-markdown", version.ref = "composeMarkdown" }
hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
hilt-android-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" }

Expand Down
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
setUrl("https://jitpack.io")
}
}
}

Expand Down

0 comments on commit 83d1e7d

Please sign in to comment.