Apply f6a7b97e
once again
This commit is contained in:
parent
f28a4d524b
commit
603bae05f4
1 changed files with 7 additions and 2 deletions
|
@ -13,6 +13,7 @@ import kotlinx.coroutines.Deferred
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import java.lang.Exception
|
||||||
|
|
||||||
class AlbumDetailsViewModel(
|
class AlbumDetailsViewModel(
|
||||||
private val repository: RepositoryImpl,
|
private val repository: RepositoryImpl,
|
||||||
|
@ -37,8 +38,12 @@ class AlbumDetailsViewModel(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadAlbumInfo(album: Album) = viewModelScope.launch(Dispatchers.IO) {
|
fun loadAlbumInfo(album: Album) = viewModelScope.launch(Dispatchers.IO) {
|
||||||
val lastFmAlbum = repository.albumInfo(album.artistName ?: "-", album.title ?: "-")
|
try {
|
||||||
|
val lastFmAlbum = repository.albumInfo(
|
||||||
|
album.artistName ?: "-", album.title ?: "-"
|
||||||
|
)
|
||||||
_lastFmAlbum.postValue(lastFmAlbum)
|
_lastFmAlbum.postValue(lastFmAlbum)
|
||||||
|
} catch (ignored: Exception) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadArtist(artistId: Int) = viewModelScope.launch(Dispatchers.IO) {
|
fun loadArtist(artistId: Int) = viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue