Skip to content

Commit

Permalink
fix on hide items w/o tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
GrakovNe committed Dec 17, 2024
1 parent 208e2f1 commit 11de64f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
applicationId = "org.grakovne.lissen"
minSdk = 28
targetSdk = 35
versionCode = 52
versionName = "1.1.21"
versionCode = 53
versionName = "1.1.22"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LibraryPageResponseConverter @Inject constructor() {
.mapNotNull {
val title = it.media.metadata.title ?: return@mapNotNull null

val hasMediaItems = (it.media.numAudioFiles ?: 0) > 0
val hasMediaItems = it.media.numAudioFiles?.let { it > 0 } ?: true
if (hasMediaItems.not()) {
return@mapNotNull null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class LibrarySearchItemsConverter @Inject constructor() {
.mapNotNull {
val title = it.media.metadata.title ?: return@mapNotNull null

val hasMediaItems = (it.media.numAudioFiles ?: 0) > 0
val hasMediaItems = it.media.numAudioFiles?.let { it > 0 } ?: true
if (hasMediaItems.not()) {
return@mapNotNull null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PodcastPageResponseConverter @Inject constructor() {
.mapNotNull {
val title = it.media.metadata.title ?: return@mapNotNull null

val hasMediaItems = (it.media.numAudioFiles ?: 0) > 0
val hasMediaItems = it.media.numAudioFiles?.let { it > 0 } ?: true
if (hasMediaItems.not()) {
return@mapNotNull null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PodcastSearchItemsConverter @Inject constructor() {
.mapNotNull {
val title = it.media.metadata.title ?: return@mapNotNull null

val hasMediaItems = (it.media.numAudioFiles ?: 0) > 0
val hasMediaItems = it.media.numAudioFiles?.let { it > 0 } ?: true
if (hasMediaItems.not()) {
return@mapNotNull null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.distinctUntilChanged
import javax.inject.Inject
import javax.inject.Singleton

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
Expand All @@ -51,6 +52,7 @@ import androidx.paging.compose.collectAsLazyPagingItems
import coil.ImageLoader
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.launch
import org.grakovne.lissen.R
import org.grakovne.lissen.channel.common.LibraryType
Expand Down Expand Up @@ -129,8 +131,12 @@ fun LibraryScreen(
}
}

LaunchedEffect(networkStatus) {
refreshContent(false)
LaunchedEffect(Unit) {
snapshotFlow { networkStatus }
.distinctUntilChanged()
.collect { status ->
refreshContent(false)
}
}

LaunchedEffect(preparingError) {
Expand Down

0 comments on commit 11de64f

Please sign in to comment.