Skip to content

Commit

Permalink
Fix bug where download buttons / menu items are shows when no downloa…
Browse files Browse the repository at this point in the history
…d qualities available
  • Loading branch information
cemrich committed Sep 23, 2024
1 parent 7a3cadf commit 87a8d1b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import de.christinecoenen.code.zapp.models.shows.MediathekShow
import de.christinecoenen.code.zapp.models.shows.Quality
import de.christinecoenen.code.zapp.repositories.MediathekRepository
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.onStart

@OptIn(ExperimentalCoroutinesApi::class)
class ShowMenuHelperViewModel(
Expand Down Expand Up @@ -45,7 +50,7 @@ class ShowMenuHelperViewModel(
DownloadStatus.DELETED,
DownloadStatus.CANCELLED,
DownloadStatus.REMOVED,
)),
) && show.hasAnyDownloadQuality()),
R.id.menu_remove_download to
(it.downloadStatus in listOf(
DownloadStatus.FAILED,
Expand All @@ -65,7 +70,9 @@ class ShowMenuHelperViewModel(
}
.onStart {
// for when the show has not yet been persisted
emit(defaultMapping)
emit(defaultMapping.toMutableMap().apply {
this[R.id.menu_start_download] = show.hasAnyDownloadQuality()
})
}
.distinctUntilChanged()
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/raw-en/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v-next
* Fixed bug where download buttons were shows when no download available

# 8.5.4
* Updated support and crash report email address

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/raw/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v-next
* Fehler behoben, bei dem Download-Buttons bei Sendungen ohne Downloads angezeigt wurden

# 8.5.4
* Mail-Adresse für Support-Anfragen und Crash-Reports aktualisiert

Expand Down

0 comments on commit 87a8d1b

Please sign in to comment.