fix: 退出贴子页面保存历史记录时偶现闪退
This commit is contained in:
parent
17301cf540
commit
d4cad7045d
|
|
@ -392,7 +392,7 @@ object ThreadPageFrom {
|
|||
sealed interface ThreadPageExtra
|
||||
|
||||
@Serializable
|
||||
object ThreadPageNoExtra : ThreadPageExtra
|
||||
data object ThreadPageNoExtra : ThreadPageExtra
|
||||
|
||||
@Serializable
|
||||
data class ThreadPageFromStoreExtra(
|
||||
|
|
@ -772,25 +772,27 @@ fun ThreadPage(
|
|||
LaunchedEffect(threadId, threadTitle, author, lastVisibilityPostId) {
|
||||
val saveHistory = {
|
||||
thread {
|
||||
if (threadTitle.isNotBlank()) {
|
||||
HistoryUtil.saveHistory(
|
||||
History(
|
||||
title = threadTitle,
|
||||
data = threadId.toString(),
|
||||
type = HistoryUtil.TYPE_THREAD,
|
||||
extras = ThreadHistoryInfoBean(
|
||||
isSeeLz = isSeeLz,
|
||||
pid = lastVisibilityPostId.toString(),
|
||||
forumName = forum?.get { name },
|
||||
floor = lastVisibilityPost?.get { floor }?.toString()
|
||||
).toJson(),
|
||||
avatar = StringUtil.getAvatarUrl(author?.get { portrait }),
|
||||
username = author?.get { nameShow }
|
||||
),
|
||||
async = true
|
||||
)
|
||||
savedHistory = true
|
||||
Log.i("ThreadPage", "saveHistory $lastVisibilityPostId")
|
||||
runCatching {
|
||||
if (threadTitle.isNotBlank()) {
|
||||
HistoryUtil.saveHistory(
|
||||
History(
|
||||
title = threadTitle,
|
||||
data = threadId.toString(),
|
||||
type = HistoryUtil.TYPE_THREAD,
|
||||
extras = ThreadHistoryInfoBean(
|
||||
isSeeLz = isSeeLz,
|
||||
pid = lastVisibilityPostId.toString(),
|
||||
forumName = forum?.get { name },
|
||||
floor = lastVisibilityPost?.get { floor }?.toString()
|
||||
).toJson(),
|
||||
avatar = StringUtil.getAvatarUrl(author?.get { portrait }),
|
||||
username = author?.get { nameShow }
|
||||
),
|
||||
async = true
|
||||
)
|
||||
savedHistory = true
|
||||
Log.i("ThreadPage", "saveHistory $lastVisibilityPostId")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue