mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +00:00
fix: stream section key
This commit is contained in:
parent
8020e15a40
commit
bd0540df72
1 changed files with 32 additions and 5 deletions
|
|
@ -745,8 +745,9 @@ internal fun StreamList(
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
filteredGroups.forEach { group ->
|
filteredGroups.forEachIndexed { groupIndex, group ->
|
||||||
streamSection(
|
streamSection(
|
||||||
|
sectionKey = streamSectionRenderKey(groupIndex = groupIndex, group = group),
|
||||||
group = group,
|
group = group,
|
||||||
showHeader = uiState.selectedFilter == null,
|
showHeader = uiState.selectedFilter == null,
|
||||||
onStreamSelected = onStreamSelected,
|
onStreamSelected = onStreamSelected,
|
||||||
|
|
@ -769,6 +770,7 @@ internal fun StreamList(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun LazyListScope.streamSection(
|
private fun LazyListScope.streamSection(
|
||||||
|
sectionKey: String,
|
||||||
group: AddonStreamGroup,
|
group: AddonStreamGroup,
|
||||||
showHeader: Boolean,
|
showHeader: Boolean,
|
||||||
onStreamSelected: (stream: StreamItem, resumePositionMs: Long?, resumeProgressFraction: Float?) -> Unit,
|
onStreamSelected: (stream: StreamItem, resumePositionMs: Long?, resumeProgressFraction: Float?) -> Unit,
|
||||||
|
|
@ -779,7 +781,7 @@ private fun LazyListScope.streamSection(
|
||||||
if (group.streams.isEmpty() && !group.isLoading) return
|
if (group.streams.isEmpty() && !group.isLoading) return
|
||||||
|
|
||||||
if (showHeader) {
|
if (showHeader) {
|
||||||
item(key = "header_${group.addonId}") {
|
item(key = "header_$sectionKey") {
|
||||||
StreamSectionHeader(
|
StreamSectionHeader(
|
||||||
addonName = group.addonName,
|
addonName = group.addonName,
|
||||||
isLoading = group.isLoading,
|
isLoading = group.isLoading,
|
||||||
|
|
@ -793,10 +795,10 @@ private fun LazyListScope.streamSection(
|
||||||
val sortedSources = streamsBySource.keys.sortedBy { it.lowercase() }
|
val sortedSources = streamsBySource.keys.sortedBy { it.lowercase() }
|
||||||
val showSourceHeaders = sortedSources.size > 1
|
val showSourceHeaders = sortedSources.size > 1
|
||||||
|
|
||||||
sortedSources.forEach { sourceName ->
|
sortedSources.forEachIndexed { sourceIndex, sourceName ->
|
||||||
val sourceStreams = streamsBySource[sourceName].orEmpty()
|
val sourceStreams = streamsBySource[sourceName].orEmpty()
|
||||||
if (showSourceHeaders) {
|
if (showSourceHeaders) {
|
||||||
item(key = "source_${group.addonId}_${sourceName}") {
|
item(key = "source_${sectionKey}_$sourceIndex") {
|
||||||
StreamSourceHeader(sourceName = sourceName)
|
StreamSourceHeader(sourceName = sourceName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -804,7 +806,12 @@ private fun LazyListScope.streamSection(
|
||||||
itemsIndexed(
|
itemsIndexed(
|
||||||
items = sourceStreams,
|
items = sourceStreams,
|
||||||
key = { index, stream ->
|
key = { index, stream ->
|
||||||
"${group.addonId}_${sourceName}_${index}_${stream.url ?: stream.infoHash ?: stream.streamLabel}"
|
streamCardRenderKey(
|
||||||
|
sectionKey = sectionKey,
|
||||||
|
sourceIndex = sourceIndex,
|
||||||
|
itemIndex = index,
|
||||||
|
stream = stream,
|
||||||
|
)
|
||||||
},
|
},
|
||||||
) { _, stream ->
|
) { _, stream ->
|
||||||
StreamCard(
|
StreamCard(
|
||||||
|
|
@ -825,6 +832,26 @@ private fun LazyListScope.streamSection(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun streamSectionRenderKey(
|
||||||
|
groupIndex: Int,
|
||||||
|
group: AddonStreamGroup,
|
||||||
|
): String = "$groupIndex:${group.addonId}"
|
||||||
|
|
||||||
|
internal fun streamCardRenderKey(
|
||||||
|
sectionKey: String,
|
||||||
|
sourceIndex: Int,
|
||||||
|
itemIndex: Int,
|
||||||
|
stream: StreamItem,
|
||||||
|
): String = buildString {
|
||||||
|
append(sectionKey)
|
||||||
|
append(':')
|
||||||
|
append(sourceIndex)
|
||||||
|
append(':')
|
||||||
|
append(itemIndex)
|
||||||
|
append(':')
|
||||||
|
append(stream.url ?: stream.infoHash ?: stream.streamLabel)
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Stream Section Header
|
// Stream Section Header
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue