Compare commits
2 Commits
847858d852
...
6f76a15ded
Author | SHA1 | Date |
---|---|---|
Harsh Shandilya | 6f76a15ded | |
Harsh Shandilya | 9fe6e34015 |
|
@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Changed
|
||||
|
||||
- Bring back dividers between posts (I regret my earlier choices)
|
||||
- Upgrade to Compose May releases
|
||||
- Upgrade to Compose May stable releases
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ fun LobstersPostsScreen(
|
|||
val navigationType = ClawNavigationType.fromSize(windowSizeClass.widthSizeClass)
|
||||
|
||||
val postIdOverride = context.getActivity()?.intent?.extras?.getString(MainActivity.NAVIGATION_KEY)
|
||||
LaunchedEffect(false) {
|
||||
LaunchedEffect(Unit) {
|
||||
if (postIdOverride != null) {
|
||||
navController.navigate(Comments(postIdOverride))
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import io.github.aakira.napier.Napier
|
|||
|
||||
@Composable
|
||||
fun NetworkError(label: String, error: Throwable, modifier: Modifier = Modifier) {
|
||||
LaunchedEffect(true) { Napier.e(error, "NetworkError") { "Failed to load posts" } }
|
||||
LaunchedEffect(Unit) { Napier.e(error, "NetworkError") { "Failed to load posts" } }
|
||||
var showDialog by remember { mutableStateOf(false) }
|
||||
Column(verticalArrangement = Arrangement.spacedBy(4.dp), modifier = modifier) {
|
||||
Text(
|
||||
|
|
|
@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.text.ClickableText
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.AccountCircle
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
|
@ -24,8 +25,10 @@ import androidx.compose.runtime.produceState
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.text.LinkAnnotation
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.text.withStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.github.michaelbull.result.coroutines.runSuspendCatching
|
||||
import com.github.michaelbull.result.fold
|
||||
|
@ -104,18 +107,42 @@ private fun UserProfileInternal(
|
|||
Text(text = user.username, style = MaterialTheme.typography.displaySmall)
|
||||
ThemedRichText(text = user.about)
|
||||
user.invitedBy?.let { invitedBy ->
|
||||
Text(
|
||||
text =
|
||||
buildAnnotatedString {
|
||||
append("Invited by ")
|
||||
pushLink(
|
||||
LinkAnnotation.Clickable(
|
||||
tag = "username",
|
||||
linkInteractionListener = { openUserProfile(invitedBy) },
|
||||
)
|
||||
val text = buildAnnotatedString {
|
||||
val style =
|
||||
with(MaterialTheme.typography.bodyMedium) {
|
||||
SpanStyle(
|
||||
MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
fontSize,
|
||||
fontWeight,
|
||||
fontStyle,
|
||||
fontSynthesis,
|
||||
fontFamily,
|
||||
fontFeatureSettings,
|
||||
letterSpacing,
|
||||
baselineShift,
|
||||
textGeometricTransform,
|
||||
localeList,
|
||||
background,
|
||||
textDecoration,
|
||||
shadow,
|
||||
)
|
||||
append(invitedBy)
|
||||
}
|
||||
withStyle(style = style) { append("Invited by ") }
|
||||
pushStringAnnotation(tag = "URL", annotation = invitedBy)
|
||||
withStyle(style = style.copy(textDecoration = TextDecoration.Underline)) {
|
||||
append(invitedBy)
|
||||
}
|
||||
pop()
|
||||
}
|
||||
|
||||
ClickableText(
|
||||
text = text,
|
||||
onClick = { offset ->
|
||||
text
|
||||
.getStringAnnotations(tag = "URL", start = offset, end = offset)
|
||||
.firstOrNull()
|
||||
?.let { annotation -> openUserProfile(annotation.item) }
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,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-browser = "androidx.browser:browser:1.8.0"
|
||||
androidx-compose-animation = { module = "androidx.compose.animation:animation" }
|
||||
androidx-compose-bom = "dev.chrisbanes.compose:compose-bom:2024.05.00-alpha01"
|
||||
androidx-compose-bom = "androidx.compose:compose-bom:2024.05.00"
|
||||
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" }
|
||||
androidx-compose-glance = { module = "androidx.glance:glance-appwidget", version.ref = "glance" }
|
||||
androidx-compose-glance-m3 = { module = "androidx.glance:glance-material3", version.ref = "glance" }
|
||||
|
|
Loading…
Reference in New Issue