fix(deps): upgrade to Compose 1.7 betas

This commit is contained in:
Harsh Shandilya 2024-05-30 13:04:02 +05:30
parent b5a7225bd8
commit 535624bf22
3 changed files with 15 additions and 49 deletions

View file

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Upgrade to Kotlin 2.0.0 - Upgrade to Kotlin 2.0.0
- Upgrade to Compose May beta releases
## [1.47.0] - 2024-05-14 ## [1.47.0] - 2024-05-14

View file

@ -13,11 +13,8 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredSize import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.ClickableText
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountCircle import androidx.compose.material.icons.filled.AccountCircle
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
@ -27,11 +24,8 @@ import androidx.compose.runtime.produceState
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.github.michaelbull.result.coroutines.runSuspendCatching import com.github.michaelbull.result.coroutines.runSuspendCatching
import com.github.michaelbull.result.fold import com.github.michaelbull.result.fold
@ -110,47 +104,18 @@ private fun UserProfileInternal(
Text(text = user.username, style = MaterialTheme.typography.displaySmall) Text(text = user.username, style = MaterialTheme.typography.displaySmall)
ThemedRichText(text = user.about) ThemedRichText(text = user.about)
user.invitedBy?.let { invitedBy -> user.invitedBy?.let { invitedBy ->
val linkTextStyle = Text(
with(LocalTextStyle.current) { text =
SpanStyle( buildAnnotatedString {
LocalContentColor.current, append("Invited by ")
fontSize, pushLink(
fontWeight, LinkAnnotation.Clickable(
fontStyle, tag = "username",
fontSynthesis, linkInteractionListener = { openUserProfile(invitedBy) },
fontFamily, )
fontFeatureSettings, )
letterSpacing, append(invitedBy)
baselineShift, }
textGeometricTransform,
localeList,
background,
textDecoration,
shadow,
)
}
val text = buildAnnotatedString {
withStyle(linkTextStyle) { append("Invited by ") }
pushStringAnnotation(tag = "URL", annotation = invitedBy)
withStyle(
linkTextStyle.copy(
textDecoration = TextDecoration.Underline,
fontWeight = FontWeight.Bold,
)
) {
append(invitedBy)
}
pop()
}
ClickableText(
text = text,
onClick = { offset ->
text
.getStringAnnotations(tag = "URL", start = offset, end = offset)
.firstOrNull()
?.let { annotation -> openUserProfile(annotation.item) }
},
) )
} }
} }

View file

@ -27,7 +27,7 @@ androidx-activity-compose = "androidx.activity:activity-compose:1.9.0"
androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmark" } androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmark" }
androidx-browser = "androidx.browser:browser:1.8.0" androidx-browser = "androidx.browser:browser:1.8.0"
androidx-compose-animation = { module = "androidx.compose.animation:animation" } androidx-compose-animation = { module = "androidx.compose.animation:animation" }
androidx-compose-bom = "androidx.compose:compose-bom:2024.05.00" androidx-compose-bom = "dev.chrisbanes.compose:compose-bom:2024.05.00-alpha03"
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" } androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" }
androidx-compose-glance = { module = "androidx.glance:glance-appwidget", version.ref = "glance" } androidx-compose-glance = { module = "androidx.glance:glance-appwidget", version.ref = "glance" }
androidx-compose-glance-m3 = { module = "androidx.glance:glance-material3", version.ref = "glance" } androidx-compose-glance-m3 = { module = "androidx.glance:glance-material3", version.ref = "glance" }