From 5fbf0462fadbe1038352fca7f69ec7b65a00c323 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 14 Aug 2024 15:04:51 -0400 Subject: [PATCH] No need to check for the MainThread in every updateFeedWith --- .../com/vitorpamplona/amethyst/ui/feeds/FeedContentState.kt | 2 -- .../amethyst/ui/screen/loggedIn/AccountFeedContentStates.kt | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/FeedContentState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/FeedContentState.kt index 93ab79d35..7b65a94f0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/FeedContentState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/FeedContentState.kt @@ -183,8 +183,6 @@ class FeedContentState( } fun updateFeedWith(newNotes: Set) { - checkNotInMainThread() - if ( localFilter is AdditiveFeedFilter && (_feedContent.value is FeedState.Loaded || _feedContent.value is FeedState.Empty) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountFeedContentStates.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountFeedContentStates.kt index 91f25c276..ebc612847 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountFeedContentStates.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountFeedContentStates.kt @@ -22,6 +22,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn import androidx.lifecycle.viewModelScope import com.vitorpamplona.amethyst.model.Note +import com.vitorpamplona.amethyst.service.checkNotInMainThread import com.vitorpamplona.amethyst.ui.dal.ChatroomListKnownFeedFilter import com.vitorpamplona.amethyst.ui.dal.ChatroomListNewFeedFilter import com.vitorpamplona.amethyst.ui.dal.DiscoverChatFeedFilter @@ -66,6 +67,8 @@ class AccountFeedContentStates( } fun updateFeedsWith(newNotes: Set) { + checkNotInMainThread() + homeNewThreads.updateFeedWith(newNotes) homeReplies.updateFeedWith(newNotes)