Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
refactor: performance and stability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed Oct 12, 2023
1 parent edf017d commit f04843c
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package app.suhasdissa.vibeyou.backend.viewmodel

import android.util.Log
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
Expand All @@ -22,9 +23,25 @@ class LocalSongViewModel(private val musicRepository: LocalMusicRepository) : Vi

init {
viewModelScope.launch {
songs = musicRepository.getAllSongs()
albums = musicRepository.getAllAlbums()
artists = musicRepository.getAllArtists()
try {
songs = musicRepository.getAllSongs()
} catch (e: Exception) {
Log.e("Get All Songs", e.message, e)
}
}
viewModelScope.launch {
try {
albums = musicRepository.getAllAlbums()
} catch (e: Exception) {
Log.e("Get All Albums", e.message, e)
}
}
viewModelScope.launch {
try {
artists = musicRepository.getAllArtists()
} catch (e: Exception) {
Log.e("Get All Artists", e.message, e)
}
}
}

Expand Down

0 comments on commit f04843c

Please sign in to comment.