chore(Live chat): small improvements

This commit is contained in:
TobiGr authored and Tobi committed 2026-11-03 23:04:48 +01:00
1 parent fa962d3469
commit 22495750b9
4 files changed
+9 -4

No files matched your search

@@ -3,12 +3,13 @@ package org.schabi.newpipe.ui.components.video.comment
import androidx.compose.runtime.Immutable
import org.schabi.newpipe.extractor.Page
import org.schabi.newpipe.extractor.comments.CommentsInfo
import org.schabi.newpipe.extractor.comments.CommentsInfoItem
@Immutable
class CommentInfo(
val serviceId: Int,
val url: String,
val comments: List<org.schabi.newpipe.extractor.comments.CommentsInfoItem>,
val comments: List<CommentsInfoItem>,
val nextPage: Page?,
val commentCount: Int,
val isCommentsDisabled: Boolean
@@ -30,6 +30,7 @@ import kotlinx.coroutines.flow.flowOf
import org.schabi.newpipe.R
import org.schabi.newpipe.error.ErrorInfo
import org.schabi.newpipe.error.UserAction
import org.schabi.newpipe.extractor.Page
import org.schabi.newpipe.extractor.comments.CommentsInfoItem
import org.schabi.newpipe.extractor.stream.Description
import org.schabi.newpipe.ui.components.common.ErrorPanel
@@ -231,7 +232,7 @@ private fun CommentSectionSuccessPreview() {
Description.Type.PLAIN_TEXT
),
uploaderName = "Test",
replies = org.schabi.newpipe.extractor.Page(""),
replies = Page(""),
replyCount = 10
)
) + (2..10).map {
@@ -28,10 +28,12 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import kotlinx.coroutines.launch
import org.schabi.newpipe.R
import org.schabi.newpipe.ui.components.common.LazyColumnThemedScrollbar
import org.schabi.newpipe.ui.components.common.LoadingIndicator
import org.schabi.newpipe.viewmodels.LiveChatViewModel
@@ -65,7 +67,7 @@ fun LiveChatSection(liveChatViewModel: LiveChatViewModel = viewModel()) {
item {
Text(
modifier = Modifier.padding(start = 12.dp, end = 12.dp, bottom = 4.dp),
text = "Live Chat",
text = stringResource(id = R.string.live_chat_tab_description),
style = MaterialTheme.typography.titleMedium
)
}
@@ -17,6 +17,7 @@ import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import org.schabi.newpipe.extractor.comments.CommentsInfo
import org.schabi.newpipe.extractor.comments.CommentsInfoItem
import org.schabi.newpipe.paging.CommentsSource
import org.schabi.newpipe.ui.components.video.comment.CommentInfo
import org.schabi.newpipe.util.KEY_URL
@@ -36,7 +37,7 @@ class CommentsViewModel(savedStateHandle: SavedStateHandle) : ViewModel() {
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), Resource.Loading)
@OptIn(ExperimentalCoroutinesApi::class)
val comments: Flow<PagingData<org.schabi.newpipe.extractor.comments.CommentsInfoItem>> = uiState
val comments: Flow<PagingData<CommentsInfoItem>> = uiState
.filterIsInstance<Resource.Success<CommentInfo>>()
.flatMapLatest {
Pager(PagingConfig(pageSize = 20, enablePlaceholders = false)) {