Fix music load failure [Resolves #4]

Remove the `check` statements from `applyAlbum` and `applyGenre` that could cause the music loading to fail on some devices. Now only the first album/genre applied will stick. This resolves issue #4.
This commit is contained in:
OxygenCobalt 2021-02-19 10:10:40 -07:00
parent e3e0015237
commit 0a7fbeca6d
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 7 additions and 11 deletions

View file

@ -56,9 +56,7 @@ class LoadingFragment : Fragment() {
null -> showLoading(binding) null -> showLoading(binding)
// Anything else is an error // Anything else is an error
else -> { else -> showError(binding, response)
showError(binding, response)
}
} }
} }

View file

@ -55,22 +55,20 @@ data class Song(
/** /**
* Apply a genre to a song. * Apply a genre to a song.
* @throws IllegalStateException When a genre is already applied.
*/ */
fun applyGenre(genre: Genre) { fun applyGenre(genre: Genre) {
check(mGenre == null) { "Genre is already applied" } if (mGenre == null) {
mGenre = genre
mGenre = genre }
} }
/** /**
* Apply an album to a song. * Apply an album to a song.
* @throws IllegalStateException When an album is already applied.
*/ */
fun applyAlbum(album: Album) { fun applyAlbum(album: Album) {
check(mAlbum == null) { "Album is already applied" } if (mAlbum == null) {
mAlbum = album
mAlbum = album }
} }
val seconds = duration / 1000 val seconds = duration / 1000