Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.dimension.flare.ui.component.status

import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -15,6 +16,7 @@ import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.platform.LocalUriHandler
Expand Down Expand Up @@ -231,6 +233,7 @@ import dev.dimension.flare.compose.ui.xqt_item_reblogged_status
import dev.dimension.flare.model.MicroBlogKey
import dev.dimension.flare.ui.component.AvatarComponentDefaults
import dev.dimension.flare.ui.component.FAIcon
import dev.dimension.flare.ui.component.FlareDividerDefaults
import dev.dimension.flare.ui.component.VerticalDivider
import dev.dimension.flare.ui.component.platform.PlatformButton
import dev.dimension.flare.ui.component.platform.PlatformCard
Expand Down Expand Up @@ -459,9 +462,17 @@ private fun UserListContent(
}
val status = data.status
if (status != null) {
StatusContent(
QuotedStatus(
data = status,
detailStatusKey = null,
modifier =
Modifier
.border(
FlareDividerDefaults.thickness,
color = FlareDividerDefaults.color,
shape = PlatformTheme.shapes.medium,
).clip(
shape = PlatformTheme.shapes.medium,
),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,10 @@ internal class VVODataSource(
val mediaId = mediaIds.joinToString(",")
if (data.referenceStatus != null && data.referenceStatus.composeStatus is ComposeStatus.VVOComment) {
service.replyComment(
id = data.referenceStatus.composeStatus.statusKey.id,
cid = data.referenceStatus.composeStatus.rootId,
cid = data.referenceStatus.composeStatus.statusKey.id,
reply = data.referenceStatus.composeStatus.statusKey.id,
id = data.referenceStatus.composeStatus.rootId,
mid = data.referenceStatus.composeStatus.rootId,
content = data.content,
st = st,
picId = mediaId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ internal data class Comment(
val bid: String? = null,
val comments: JsonElement? = null,
val pic: StatusPic? = null,
val analysis_extra: String? = null,
) {
val commentList: List<Comment>?
get() =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,21 @@ internal fun Comment.renderStatus(
id = id,
host = vvoHost,
)
val statusMid =
status?.mid ?: run {
analysis_extra
?.split('|')
?.mapNotNull {
val pair = it.split(':')
if (pair.size == 2) {
pair[0] to pair[1]
} else {
null
}
}?.toMap()
?.get("mid")
}

return UiTimeline.ItemContent.Status(
statusKey = statusKey,
content = element.toUi(),
Expand All @@ -372,8 +387,13 @@ internal fun Comment.renderStatus(
)
},
)
}.orEmpty()
.toImmutableList(),
}?.toImmutableList() ?: listOfNotNull(status)
.map {
it.renderStatus(
accountKey,
event,
)
}.toImmutableList(),
card = null,
contentWarning = null,
images =
Expand All @@ -398,20 +418,20 @@ internal fun Comment.renderStatus(
poll = null,
actions =
listOfNotNull(
StatusAction.Item.Reply(
count = replyCount ?: 0,
onClicked = {
if (rootidstr != null) {
statusMid?.let {
StatusAction.Item.Reply(
count = replyCount ?: 0,
onClicked = {
launcher.launch(
AppDeepLink.VVO.ReplyToComment(
accountKey = accountKey,
replyTo = statusKey,
rootId = rootidstr,
rootId = statusMid,
),
)
}
},
),
},
)
},
StatusAction.Item.Like(
count = likeCount ?: 0,
liked = liked ?: false,
Expand Down Expand Up @@ -450,12 +470,21 @@ internal fun Comment.renderStatus(
createdAt = createdAt?.toUi() ?: Clock.System.now().toUi(),
sensitive = false,
onClicked = {
launcher.launch(
AppDeepLink.VVO.CommentDetail(
accountKey = accountKey,
statusKey = statusKey,
),
)
if (status != null) {
launcher.launch(
AppDeepLink.VVO.StatusDetail(
accountKey = accountKey,
statusKey = status.renderStatus(accountKey, event).statusKey,
),
)
} else {
launcher.launch(
AppDeepLink.VVO.CommentDetail(
accountKey = accountKey,
statusKey = statusKey,
),
)
}
},
platformType = PlatformType.VVo,
onMediaClicked = { media, index ->
Expand Down Expand Up @@ -490,6 +519,11 @@ internal fun Attitude.render(
): UiTimeline {
val content = status?.renderStatus(accountKey, event)
val user = user?.render(accountKey)
val userListContent =
UiTimeline.ItemContent.UserList(
users = listOfNotNull(user).toImmutableList(),
status = content,
)
return UiTimeline(
topMessage =
UiTimeline.TopMessage(
Expand All @@ -508,7 +542,7 @@ internal fun Attitude.render(
},
statusKey = MicroBlogKey(id.toString(), vvoHost),
),
content = content,
content = userListContent,
)
}

Expand Down