Skip to content

Commit

Permalink
Thread: Hide non-visible threads
Browse files Browse the repository at this point in the history
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
  • Loading branch information
theimpulson committed Mar 25, 2024
1 parent a07f3a0 commit b564cd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.paging.LoadState
import androidx.paging.compose.collectAsLazyPagingItems
import androidx.paging.compose.itemContentType
import androidx.paging.compose.itemKey
import io.aayush.relabs.network.data.thread.State
import io.aayush.relabs.ui.components.MainTopAppBar
import io.aayush.relabs.ui.components.ThreadPreviewItem
import io.aayush.relabs.ui.navigation.Screen
Expand Down Expand Up @@ -64,6 +65,8 @@ fun NodeScreen(
contentType = threads.itemContentType { "Threads" }
) { index ->
val thread = threads[index] ?: return@items
if (thread.state != State.VISIBLE) return@items

ThreadPreviewItem(
modifier = Modifier.padding(10.dp),
avatarURL = thread.user?.avatar?.data?.medium ?: String(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.paging.compose.collectAsLazyPagingItems
import androidx.paging.compose.itemContentType
import androidx.paging.compose.itemKey
import io.aayush.relabs.R
import io.aayush.relabs.network.data.thread.State
import io.aayush.relabs.network.data.thread.Thread
import io.aayush.relabs.ui.components.MainTopAppBar
import io.aayush.relabs.ui.components.ThreadPreviewItem
Expand Down Expand Up @@ -100,6 +101,8 @@ fun ThreadPreviewScreen(
contentType = currentThreads.itemContentType { Thread::class.java },
) { index ->
val thread = currentThreads[index] ?: return@items
if (thread.state != State.VISIBLE) return@items

ThreadPreviewItem(
modifier = Modifier.padding(10.dp),
avatarURL = thread.user?.avatar?.data?.medium ?: String(),
Expand Down

0 comments on commit b564cd5

Please sign in to comment.