mirror of
https://github.com/accelforce/Yuito
synced 2025-01-03 11:30:29 +01:00
Fix inserted placeholder on streaming causes corruption
This commit is contained in:
parent
b4b9a62ada
commit
5986bd80b2
@ -221,7 +221,7 @@ class CachedTimelineViewModel @Inject constructor(
|
||||
|
||||
db.withTransaction {
|
||||
if (isFirstOfStreaming) {
|
||||
val placeholderId = (timelineDao.getTopId(activeAccount.id) ?: "0").inc()
|
||||
val placeholderId = status.id.dec()
|
||||
timelineDao.insertStatus(Placeholder(placeholderId, loading = false).toEntity(activeAccount.id))
|
||||
isFirstOfStreaming = false
|
||||
}
|
||||
@ -231,7 +231,8 @@ class CachedTimelineViewModel @Inject constructor(
|
||||
timelineDao.insertAccount(rebloggedAccount)
|
||||
}
|
||||
timelineDao.insertStatus(
|
||||
status.toEntity(activeAccount.id,
|
||||
status.toEntity(
|
||||
activeAccount.id,
|
||||
gson,
|
||||
expanded = activeAccount.alwaysOpenSpoiler,
|
||||
contentShowing = activeAccount.alwaysShowSensitiveMedia || !status.actionableStatus.sensitive,
|
||||
|
@ -28,14 +28,13 @@ import com.keylesspalace.tusky.appstore.EventHub
|
||||
import com.keylesspalace.tusky.appstore.FavoriteEvent
|
||||
import com.keylesspalace.tusky.appstore.PinEvent
|
||||
import com.keylesspalace.tusky.appstore.ReblogEvent
|
||||
import com.keylesspalace.tusky.components.timeline.Placeholder
|
||||
import com.keylesspalace.tusky.components.timeline.toEntity
|
||||
import com.keylesspalace.tusky.db.AccountManager
|
||||
import com.keylesspalace.tusky.entity.Poll
|
||||
import com.keylesspalace.tusky.entity.Status
|
||||
import com.keylesspalace.tusky.network.FilterModel
|
||||
import com.keylesspalace.tusky.network.MastodonApi
|
||||
import com.keylesspalace.tusky.network.TimelineCases
|
||||
import com.keylesspalace.tusky.util.dec
|
||||
import com.keylesspalace.tusky.util.getDomain
|
||||
import com.keylesspalace.tusky.util.inc
|
||||
import com.keylesspalace.tusky.util.toViewData
|
||||
@ -218,10 +217,7 @@ class NetworkTimelineViewModel @Inject constructor(
|
||||
val activeAccount = accountManager.activeAccount!!
|
||||
|
||||
if (isFirstOfStreaming) {
|
||||
val placeholderId = when (val top = statusData.first()) {
|
||||
is StatusViewData.Concrete -> top.id
|
||||
is StatusViewData.Placeholder -> top.id
|
||||
}
|
||||
val placeholderId = status.id.dec()
|
||||
statusData.add(0, StatusViewData.Placeholder(placeholderId, isLoading = false))
|
||||
isFirstOfStreaming = false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user