Adds more checks for not in the main thread

pull/469/head
Vitor Pamplona 2023-06-22 15:23:04 -04:00
rodzic baf0372537
commit e9e0b0f57f
1 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -13,6 +13,7 @@ import androidx.navigation.navArgument
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.model.Account
import com.vitorpamplona.amethyst.model.Note
import com.vitorpamplona.amethyst.service.checkNotInMainThread
import com.vitorpamplona.amethyst.service.model.PrivateDmEvent
import com.vitorpamplona.amethyst.ui.dal.AdditiveFeedFilter
import com.vitorpamplona.amethyst.ui.dal.ChatroomListKnownFeedFilter
@ -165,6 +166,8 @@ object HomeLatestItem : LatestItem() {
account: Account,
newNotes: Set<Note>
): Boolean {
checkNotInMainThread()
val lastTime = account.loadLastRead("HomeFollows")
val newestItem = updateNewestItem(newNotes, account, HomeNewThreadFeedFilter(account))
@ -178,6 +181,8 @@ object NotificationLatestItem : LatestItem() {
account: Account,
newNotes: Set<Note>
): Boolean {
checkNotInMainThread()
val lastTime = account.loadLastRead("Notification")
val newestItem = updateNewestItem(newNotes, account, NotificationFeedFilter(account))
@ -191,6 +196,8 @@ object MessagesLatestItem : LatestItem() {
account: Account,
newNotes: Set<Note>
): Boolean {
checkNotInMainThread()
// Checks if the current newest item is still unread.
// If so, there is no need to check anything else
if (isNew(getNewestItem(account), account)) {