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