diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/Utils.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/Utils.kt index 9ce0bfe3..32cb7492 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/api/Utils.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/Utils.kt @@ -1,33 +1,8 @@ package com.huanchengfly.tieba.post.api import android.os.Build -import androidx.compose.foundation.text.appendInlineContent -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.ExperimentalTextApi -import androidx.compose.ui.text.SpanStyle -import androidx.compose.ui.text.buildAnnotatedString -import androidx.compose.ui.text.withAnnotation -import androidx.compose.ui.text.withStyle import com.huanchengfly.tieba.post.App import com.huanchengfly.tieba.post.App.ScreenInfo -import com.huanchengfly.tieba.post.R -import com.huanchengfly.tieba.post.api.models.protos.PbContent -import com.huanchengfly.tieba.post.api.models.protos.Post -import com.huanchengfly.tieba.post.api.models.protos.SubPostList -import com.huanchengfly.tieba.post.api.models.protos.ThreadInfo -import com.huanchengfly.tieba.post.arch.wrapImmutable -import com.huanchengfly.tieba.post.ui.common.PbContentRender -import com.huanchengfly.tieba.post.ui.common.PicContentRender -import com.huanchengfly.tieba.post.ui.common.TextContentRender.Companion.appendText -import com.huanchengfly.tieba.post.ui.common.VideoContentRender -import com.huanchengfly.tieba.post.ui.common.VoiceContentRender -import com.huanchengfly.tieba.post.ui.common.theme.utils.ThemeUtils -import com.huanchengfly.tieba.post.ui.utils.getPhotoViewData -import com.huanchengfly.tieba.post.utils.EmoticonManager -import com.huanchengfly.tieba.post.utils.EmoticonUtil.emoticonString -import com.huanchengfly.tieba.post.utils.ImageUtil -import kotlinx.collections.immutable.ImmutableList -import kotlinx.collections.immutable.toImmutableList private val defaultUserAgent: String = @@ -43,307 +18,3 @@ fun getScreenHeight(): Int = ScreenInfo.EXACT_SCREEN_HEIGHT fun getScreenWidth(): Int = ScreenInfo.EXACT_SCREEN_WIDTH fun Boolean.booleanToString(): String = if (this) "1" else "0" - -val ThreadInfo.abstractText: String - get() = richAbstract.joinToString(separator = "") { - when (it.type) { - 0 -> it.text.replace(Regex(" {2,}"), " ") - 2 -> { - EmoticonManager.registerEmoticon(it.text, it.c) - "#(${it.c})" - } - - else -> "" - } - } - -val ThreadInfo.hasAgree: Int - get() = agree?.hasAgree ?: 0 - -val ThreadInfo.hasAgreed: Boolean - get() = hasAgree == 1 - -val ThreadInfo.hasAbstract: Boolean - get() = richAbstract.any { (it.type == 0 && it.text.isNotBlank()) || it.type == 2 } - -fun ThreadInfo.updateAgreeStatus( - hasAgree: Int -) = if (agree != null) { - if (hasAgree != agree.hasAgree) { - if (hasAgree == 1) { - copy( - agreeNum = agreeNum + 1, - agree = agree.copy( - agreeNum = agree.agreeNum + 1, - diffAgreeNum = agree.diffAgreeNum + 1, - hasAgree = 1 - ) - ) - } else { - copy( - agreeNum = agreeNum - 1, - agree = agree.copy( - agreeNum = agree.agreeNum - 1, - diffAgreeNum = agree.diffAgreeNum - 1, - hasAgree = 0 - ) - ) - } - } else { - this - } -} else { - copy( - agreeNum = if (hasAgree == 1) agreeNum + 1 else agreeNum - 1 - ) -} - -fun ThreadInfo.updateCollectStatus( - newStatus: Int, - markPostId: Long -) = if (collectStatus != newStatus) { - this.copy( - collectStatus = newStatus, - collectMarkPid = markPostId.toString() - ) -} else { - this -} - -fun Post.updateAgreeStatus( - hasAgree: Int -) = if (agree != null) { - if (hasAgree != agree.hasAgree) { - if (hasAgree == 1) { - copy( - agree = agree.copy( - agreeNum = agree.agreeNum + 1, - diffAgreeNum = agree.diffAgreeNum + 1, - hasAgree = 1 - ) - ) - } else { - copy( - agree = agree.copy( - agreeNum = agree.agreeNum - 1, - diffAgreeNum = agree.diffAgreeNum - 1, - hasAgree = 0 - ) - ) - } - } else { - this - } -} else { - this -} - -fun SubPostList.updateAgreeStatus( - hasAgree: Int -) = if (agree != null) { - if (hasAgree != agree.hasAgree) { - if (hasAgree == 1) { - copy( - agree = agree.copy( - agreeNum = agree.agreeNum + 1, - diffAgreeNum = agree.diffAgreeNum + 1, - hasAgree = 1 - ) - ) - } else { - copy( - agree = agree.copy( - agreeNum = agree.agreeNum - 1, - diffAgreeNum = agree.diffAgreeNum - 1, - hasAgree = 0 - ) - ) - } - } else { - this - } -} else { - this -} - -private val PbContent.picUrl: String - get() = - ImageUtil.getUrl( - App.INSTANCE, - true, - originSrc, - bigCdnSrc, - bigSrc, - dynamic_, - cdnSrc, - cdnSrcActive, - src - ) - -val List.plainText: String - get() = joinToString(separator = "") { - when (it.type) { - 0, 1, 4, 9, 27 -> it.text - 2 -> "#(${it.c})" - 3, 20 -> "[图片]" - 5 -> "[视钑]" - else -> "" - } - } - -@OptIn(ExperimentalTextApi::class) -val List.renders: ImmutableList - get() { - val renders = mutableListOf() - - forEach { - when (it.type) { - 0, 9, 27 -> { - renders.appendText(it.text) - } - - 1 -> { - val text = buildAnnotatedString { - appendInlineContent("link_icon", alternateText = "πŸ”—") - withAnnotation(tag = "url", annotation = it.link) { - withStyle( - SpanStyle( - color = Color( - ThemeUtils.getColorByAttr( - App.INSTANCE, - R.attr.colorPrimary - ) - ) - ) - ) { - append(it.text) - } - } - } - renders.appendText(text) - } - - 2 -> { - EmoticonManager.registerEmoticon( - it.text, - it.c - ) - val emoticonText = "#(${it.c})".emoticonString - renders.appendText(emoticonText) - } - - 3 -> { - val width = it.bsize.split(",")[0].toInt() - val height = it.bsize.split(",")[1].toInt() - renders.add( - PicContentRender( - picUrl = it.picUrl, - originUrl = it.originSrc, - showOriginBtn = it.showOriginalBtn == 1, - originSize = it.originSize, - picId = ImageUtil.getPicId(it.originSrc), - width = width, - height = height - ) - ) - } - - 4 -> { - val text = buildAnnotatedString { - withAnnotation(tag = "user", annotation = "${it.uid}") { - withStyle( - SpanStyle( - color = Color( - ThemeUtils.getColorByAttr( - App.INSTANCE, - R.attr.colorPrimary - ) - ) - ) - ) { - append(it.text) - } - } - } - renders.appendText(text) - } - - 5 -> { - if (it.src.isNotBlank()) { - val width = it.bsize.split(",")[0].toInt() - val height = it.bsize.split(",")[1].toInt() - renders.add( - VideoContentRender( - videoUrl = it.link, - picUrl = it.src, - webUrl = it.text, - width = width, - height = height - ) - ) - } else { - val text = buildAnnotatedString { - appendInlineContent("video_icon", alternateText = "πŸŽ₯") - withAnnotation(tag = "url", annotation = it.text) { - withStyle( - SpanStyle( - color = Color( - ThemeUtils.getColorByAttr( - App.INSTANCE, - R.attr.colorPrimary - ) - ) - ) - ) { - append(App.INSTANCE.getString(R.string.tag_video)) - append(it.text) - } - } - } - renders.appendText(text) - } - } - - 10 -> { - renders.add(VoiceContentRender(it.voiceMD5, it.duringTime)) - } - - 20 -> { - val width = it.bsize.split(",")[0].toInt() - val height = it.bsize.split(",")[1].toInt() - renders.add( - PicContentRender( - picUrl = it.src, - originUrl = it.src, - showOriginBtn = it.showOriginalBtn == 1, - originSize = it.originSize, - picId = ImageUtil.getPicId(it.src), - width = width, - height = height - ) - ) - } - } - } - - return renders.toImmutableList() - } - -val Post.contentRenders: ImmutableList - get() { - val renders = content.renders - - return renders.map { - if (it is PicContentRender) { - val data = getPhotoViewData( - this, - it.picId, - it.picUrl, - it.originUrl, - it.showOriginBtn, - it.originSize - ) - if (data != null) it.copy(photoViewData = wrapImmutable(data)) else it - } else it - }.toImmutableList() - } \ No newline at end of file diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/models/protos/Extensions.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/models/protos/Extensions.kt new file mode 100644 index 00000000..e4c0cda6 --- /dev/null +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/models/protos/Extensions.kt @@ -0,0 +1,327 @@ +package com.huanchengfly.tieba.post.api.models.protos + +import androidx.compose.foundation.text.appendInlineContent +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.ExperimentalTextApi +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.withAnnotation +import androidx.compose.ui.text.withStyle +import com.huanchengfly.tieba.post.App +import com.huanchengfly.tieba.post.R +import com.huanchengfly.tieba.post.arch.wrapImmutable +import com.huanchengfly.tieba.post.ui.common.PbContentRender +import com.huanchengfly.tieba.post.ui.common.PicContentRender +import com.huanchengfly.tieba.post.ui.common.TextContentRender.Companion.appendText +import com.huanchengfly.tieba.post.ui.common.VideoContentRender +import com.huanchengfly.tieba.post.ui.common.VoiceContentRender +import com.huanchengfly.tieba.post.ui.common.theme.utils.ThemeUtils +import com.huanchengfly.tieba.post.ui.utils.getPhotoViewData +import com.huanchengfly.tieba.post.utils.EmoticonManager +import com.huanchengfly.tieba.post.utils.EmoticonUtil.emoticonString +import com.huanchengfly.tieba.post.utils.ImageUtil +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList + +val ThreadInfo.abstractText: String + get() = richAbstract.joinToString(separator = "") { + when (it.type) { + 0 -> it.text.replace(Regex(" {2,}"), " ") + 2 -> { + EmoticonManager.registerEmoticon(it.text, it.c) + "#(${it.c})" + } + + else -> "" + } + } +val ThreadInfo.hasAgree: Int + get() = agree?.hasAgree ?: 0 +val ThreadInfo.hasAgreed: Boolean + get() = hasAgree == 1 +val ThreadInfo.hasAbstract: Boolean + get() = richAbstract.any { (it.type == 0 && it.text.isNotBlank()) || it.type == 2 } + +fun ThreadInfo.updateAgreeStatus( + hasAgree: Int +) = if (agree != null) { + if (hasAgree != agree.hasAgree) { + if (hasAgree == 1) { + copy( + agreeNum = agreeNum + 1, + agree = agree.copy( + agreeNum = agree.agreeNum + 1, + diffAgreeNum = agree.diffAgreeNum + 1, + hasAgree = 1 + ) + ) + } else { + copy( + agreeNum = agreeNum - 1, + agree = agree.copy( + agreeNum = agree.agreeNum - 1, + diffAgreeNum = agree.diffAgreeNum - 1, + hasAgree = 0 + ) + ) + } + } else { + this + } +} else { + copy( + agreeNum = if (hasAgree == 1) agreeNum + 1 else agreeNum - 1 + ) +} + +fun ThreadInfo.updateCollectStatus( + newStatus: Int, + markPostId: Long +) = if (collectStatus != newStatus) { + this.copy( + collectStatus = newStatus, + collectMarkPid = markPostId.toString() + ) +} else { + this +} + +fun Post.updateAgreeStatus( + hasAgree: Int +) = if (agree != null) { + if (hasAgree != agree.hasAgree) { + if (hasAgree == 1) { + copy( + agree = agree.copy( + agreeNum = agree.agreeNum + 1, + diffAgreeNum = agree.diffAgreeNum + 1, + hasAgree = 1 + ) + ) + } else { + copy( + agree = agree.copy( + agreeNum = agree.agreeNum - 1, + diffAgreeNum = agree.diffAgreeNum - 1, + hasAgree = 0 + ) + ) + } + } else { + this + } +} else { + this +} + +fun SubPostList.updateAgreeStatus( + hasAgree: Int +) = if (agree != null) { + if (hasAgree != agree.hasAgree) { + if (hasAgree == 1) { + copy( + agree = agree.copy( + agreeNum = agree.agreeNum + 1, + diffAgreeNum = agree.diffAgreeNum + 1, + hasAgree = 1 + ) + ) + } else { + copy( + agree = agree.copy( + agreeNum = agree.agreeNum - 1, + diffAgreeNum = agree.diffAgreeNum - 1, + hasAgree = 0 + ) + ) + } + } else { + this + } +} else { + this +} + +private val PbContent.picUrl: String + get() = + ImageUtil.getUrl( + App.INSTANCE, + true, + originSrc, + bigCdnSrc, + bigSrc, + dynamic_, + cdnSrc, + cdnSrcActive, + src + ) +val List.plainText: String + get() = joinToString(separator = "") { + when (it.type) { + 0, 1, 4, 9, 27 -> it.text + 2 -> "#(${it.c})" + 3, 20 -> "[图片]" + 5 -> "[视钑]" + else -> "" + } + } + +@OptIn(ExperimentalTextApi::class) +val List.renders: ImmutableList + get() { + val renders = mutableListOf() + + forEach { + when (it.type) { + 0, 9, 27 -> { + renders.appendText(it.text) + } + + 1 -> { + val text = buildAnnotatedString { + appendInlineContent("link_icon", alternateText = "πŸ”—") + withAnnotation(tag = "url", annotation = it.link) { + withStyle( + SpanStyle( + color = Color( + ThemeUtils.getColorByAttr( + App.INSTANCE, + R.attr.colorPrimary + ) + ) + ) + ) { + append(it.text) + } + } + } + renders.appendText(text) + } + + 2 -> { + EmoticonManager.registerEmoticon( + it.text, + it.c + ) + val emoticonText = "#(${it.c})".emoticonString + renders.appendText(emoticonText) + } + + 3 -> { + val width = it.bsize.split(",")[0].toInt() + val height = it.bsize.split(",")[1].toInt() + renders.add( + PicContentRender( + picUrl = it.picUrl, + originUrl = it.originSrc, + showOriginBtn = it.showOriginalBtn == 1, + originSize = it.originSize, + picId = ImageUtil.getPicId(it.originSrc), + width = width, + height = height + ) + ) + } + + 4 -> { + val text = buildAnnotatedString { + withAnnotation(tag = "user", annotation = "${it.uid}") { + withStyle( + SpanStyle( + color = Color( + ThemeUtils.getColorByAttr( + App.INSTANCE, + R.attr.colorPrimary + ) + ) + ) + ) { + append(it.text) + } + } + } + renders.appendText(text) + } + + 5 -> { + if (it.src.isNotBlank()) { + val width = it.bsize.split(",")[0].toInt() + val height = it.bsize.split(",")[1].toInt() + renders.add( + VideoContentRender( + videoUrl = it.link, + picUrl = it.src, + webUrl = it.text, + width = width, + height = height + ) + ) + } else { + val text = buildAnnotatedString { + appendInlineContent("video_icon", alternateText = "πŸŽ₯") + withAnnotation(tag = "url", annotation = it.text) { + withStyle( + SpanStyle( + color = Color( + ThemeUtils.getColorByAttr( + App.INSTANCE, + R.attr.colorPrimary + ) + ) + ) + ) { + append(App.INSTANCE.getString(R.string.tag_video)) + append(it.text) + } + } + } + renders.appendText(text) + } + } + + 10 -> { + renders.add(VoiceContentRender(it.voiceMD5, it.duringTime)) + } + + 20 -> { + val width = it.bsize.split(",")[0].toInt() + val height = it.bsize.split(",")[1].toInt() + renders.add( + PicContentRender( + picUrl = it.src, + originUrl = it.src, + showOriginBtn = it.showOriginalBtn == 1, + originSize = it.originSize, + picId = ImageUtil.getPicId(it.src), + width = width, + height = height + ) + ) + } + } + } + + return renders.toImmutableList() + } +val Post.contentRenders: ImmutableList + get() { + val renders = content.renders + + return renders.map { + if (it is PicContentRender) { + val data = getPhotoViewData( + this, + it.picId, + it.picUrl, + it.originUrl, + it.showOriginBtn, + it.originSize + ) + if (data != null) it.copy(photoViewData = wrapImmutable(data)) else it + } else it + }.toImmutableList() + } +val User.bawuType: String? + get() = if (is_bawu == 1) { + if (bawu_type == "manager") "吧主" else "小吧主" + } else null \ No newline at end of file diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListPage.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListPage.kt index 81af30b2..5e23b932 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListPage.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListPage.kt @@ -38,8 +38,8 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.huanchengfly.tieba.post.R -import com.huanchengfly.tieba.post.api.abstractText import com.huanchengfly.tieba.post.api.models.protos.ThreadInfo +import com.huanchengfly.tieba.post.api.models.protos.abstractText import com.huanchengfly.tieba.post.api.models.protos.frsPage.Classify import com.huanchengfly.tieba.post.arch.BaseComposeActivity.Companion.LocalWindowSizeClass import com.huanchengfly.tieba.post.arch.ImmutableHolder diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListViewModel.kt index d6323531..16570a8e 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListViewModel.kt @@ -6,10 +6,10 @@ import com.huanchengfly.tieba.post.api.models.AgreeBean import com.huanchengfly.tieba.post.api.models.protos.ThreadInfo import com.huanchengfly.tieba.post.api.models.protos.frsPage.Classify import com.huanchengfly.tieba.post.api.models.protos.frsPage.FrsPageResponse +import com.huanchengfly.tieba.post.api.models.protos.updateAgreeStatus import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaUnknownException import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorCode import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorMessage -import com.huanchengfly.tieba.post.api.updateAgreeStatus import com.huanchengfly.tieba.post.arch.BaseViewModel import com.huanchengfly.tieba.post.arch.CommonUiEvent import com.huanchengfly.tieba.post.arch.ImmutableHolder diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernPage.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernPage.kt index 68eb551c..762b8cec 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernPage.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernPage.kt @@ -17,7 +17,7 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.huanchengfly.tieba.post.api.hasAgree +import com.huanchengfly.tieba.post.api.models.protos.hasAgree import com.huanchengfly.tieba.post.arch.BaseComposeActivity import com.huanchengfly.tieba.post.arch.CommonUiEvent.ScrollToTop.bindScrollToTopEvent import com.huanchengfly.tieba.post.arch.collectPartialAsState diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernViewModel.kt index 6eb8ce04..a9125d71 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernViewModel.kt @@ -4,10 +4,10 @@ import androidx.compose.runtime.Stable import com.huanchengfly.tieba.post.App import com.huanchengfly.tieba.post.api.TiebaApi import com.huanchengfly.tieba.post.api.models.AgreeBean +import com.huanchengfly.tieba.post.api.models.protos.updateAgreeStatus import com.huanchengfly.tieba.post.api.models.protos.userLike.ConcernData import com.huanchengfly.tieba.post.api.models.protos.userLike.UserLikeResponse import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorMessage -import com.huanchengfly.tieba.post.api.updateAgreeStatus import com.huanchengfly.tieba.post.arch.BaseViewModel import com.huanchengfly.tieba.post.arch.CommonUiEvent import com.huanchengfly.tieba.post.arch.PartialChange diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/hot/HotPage.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/hot/HotPage.kt index c7375c45..0c943c40 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/hot/HotPage.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/hot/HotPage.kt @@ -46,8 +46,8 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.google.accompanist.placeholder.material.placeholder import com.huanchengfly.tieba.post.R -import com.huanchengfly.tieba.post.api.hasAgree import com.huanchengfly.tieba.post.api.models.protos.ThreadInfo +import com.huanchengfly.tieba.post.api.models.protos.hasAgree import com.huanchengfly.tieba.post.arch.ImmutableHolder import com.huanchengfly.tieba.post.arch.collectPartialAsState import com.huanchengfly.tieba.post.arch.onEvent diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/subposts/SubPostsViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/subposts/SubPostsViewModel.kt index d68f8a07..5df752d4 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/subposts/SubPostsViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/subposts/SubPostsViewModel.kt @@ -2,14 +2,14 @@ package com.huanchengfly.tieba.post.ui.page.subposts import androidx.compose.runtime.Stable import com.huanchengfly.tieba.post.api.TiebaApi -import com.huanchengfly.tieba.post.api.contentRenders import com.huanchengfly.tieba.post.api.models.AgreeBean import com.huanchengfly.tieba.post.api.models.protos.Post import com.huanchengfly.tieba.post.api.models.protos.SimpleForum import com.huanchengfly.tieba.post.api.models.protos.SubPostList +import com.huanchengfly.tieba.post.api.models.protos.contentRenders import com.huanchengfly.tieba.post.api.models.protos.pbFloor.PbFloorResponse -import com.huanchengfly.tieba.post.api.renders -import com.huanchengfly.tieba.post.api.updateAgreeStatus +import com.huanchengfly.tieba.post.api.models.protos.renders +import com.huanchengfly.tieba.post.api.models.protos.updateAgreeStatus import com.huanchengfly.tieba.post.arch.BaseViewModel import com.huanchengfly.tieba.post.arch.ImmutableHolder import com.huanchengfly.tieba.post.arch.PartialChange diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadPage.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadPage.kt index 97870208..16a25165 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadPage.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadPage.kt @@ -99,7 +99,8 @@ import com.huanchengfly.tieba.post.api.models.protos.Post import com.huanchengfly.tieba.post.api.models.protos.SimpleForum import com.huanchengfly.tieba.post.api.models.protos.ThreadInfo import com.huanchengfly.tieba.post.api.models.protos.User -import com.huanchengfly.tieba.post.api.renders +import com.huanchengfly.tieba.post.api.models.protos.bawuType +import com.huanchengfly.tieba.post.api.models.protos.renders import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorMessage import com.huanchengfly.tieba.post.arch.ImmutableHolder import com.huanchengfly.tieba.post.arch.collectPartialAsState diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadViewModel.kt index 4f15f9b3..94e21de6 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadViewModel.kt @@ -3,19 +3,19 @@ package com.huanchengfly.tieba.post.ui.page.thread import androidx.compose.runtime.Immutable import androidx.compose.runtime.Stable import com.huanchengfly.tieba.post.api.TiebaApi -import com.huanchengfly.tieba.post.api.contentRenders import com.huanchengfly.tieba.post.api.models.AgreeBean import com.huanchengfly.tieba.post.api.models.protos.Anti import com.huanchengfly.tieba.post.api.models.protos.Post import com.huanchengfly.tieba.post.api.models.protos.SimpleForum import com.huanchengfly.tieba.post.api.models.protos.ThreadInfo import com.huanchengfly.tieba.post.api.models.protos.User -import com.huanchengfly.tieba.post.api.renders +import com.huanchengfly.tieba.post.api.models.protos.contentRenders +import com.huanchengfly.tieba.post.api.models.protos.renders +import com.huanchengfly.tieba.post.api.models.protos.updateAgreeStatus +import com.huanchengfly.tieba.post.api.models.protos.updateCollectStatus import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaUnknownException import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorCode import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorMessage -import com.huanchengfly.tieba.post.api.updateAgreeStatus -import com.huanchengfly.tieba.post.api.updateCollectStatus import com.huanchengfly.tieba.post.arch.BaseViewModel import com.huanchengfly.tieba.post.arch.ImmutableHolder import com.huanchengfly.tieba.post.arch.PartialChange diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/widgets/compose/FeedCard.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/widgets/compose/FeedCard.kt index a6910ec2..b820bf8d 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/widgets/compose/FeedCard.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/widgets/compose/FeedCard.kt @@ -60,11 +60,11 @@ import com.google.accompanist.placeholder.material.placeholder import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.huanchengfly.tieba.post.R import com.huanchengfly.tieba.post.activities.UserActivity -import com.huanchengfly.tieba.post.api.abstractText import com.huanchengfly.tieba.post.api.models.protos.Media import com.huanchengfly.tieba.post.api.models.protos.SimpleForum import com.huanchengfly.tieba.post.api.models.protos.ThreadInfo import com.huanchengfly.tieba.post.api.models.protos.User +import com.huanchengfly.tieba.post.api.models.protos.abstractText import com.huanchengfly.tieba.post.arch.ImmutableHolder import com.huanchengfly.tieba.post.arch.wrapImmutable import com.huanchengfly.tieba.post.findActivity diff --git a/app/src/main/java/com/huanchengfly/tieba/post/utils/BlockManager.kt b/app/src/main/java/com/huanchengfly/tieba/post/utils/BlockManager.kt index 35b230be..a7d95a2d 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/utils/BlockManager.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/utils/BlockManager.kt @@ -1,9 +1,9 @@ package com.huanchengfly.tieba.post.utils -import com.huanchengfly.tieba.post.api.abstractText import com.huanchengfly.tieba.post.api.models.protos.Post import com.huanchengfly.tieba.post.api.models.protos.ThreadInfo -import com.huanchengfly.tieba.post.api.plainText +import com.huanchengfly.tieba.post.api.models.protos.abstractText +import com.huanchengfly.tieba.post.api.models.protos.plainText import com.huanchengfly.tieba.post.models.database.Block import com.huanchengfly.tieba.post.models.database.Block.Companion.getKeywords import org.litepal.LitePal