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