Skip to content

Commit

Permalink
[#82] 사용하지 않는 코드 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
JIWON1923 committed Apr 20, 2024
1 parent aa207f5 commit 6708fe6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 28 deletions.
16 changes: 0 additions & 16 deletions app/src/main/java/com/soi/moya/models/UserPreferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ class UserPreferences(private val context: Context) {
preferences[APP_VERSION] ?: BuildConfig.VERSION_NAME
}

val showMiniPlayer: Flow<Boolean> = context.dataStore.data
.map { preference ->
preference[SHOW_MINI_PLAYER] ?: true
}
val currentPlaySongId: Flow<String?> = context.dataStore.data
.map {
it[CURRENT_PLAY_SONG_ID]
Expand All @@ -52,16 +48,4 @@ class UserPreferences(private val context: Context) {
}
}
}

suspend fun showingMiniPlayer() {
context.dataStore.edit { preference ->
preference[SHOW_MINI_PLAYER] = true
}
}

suspend fun setSongId(music: MusicInfo) {
context.dataStore.edit {preference ->
preference[CURRENT_PLAY_SONG_ID] = music.id
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ fun MusicListScreen(
music = music,
team = team,
image = albumImageResourceId,
navController = navController,
viewModel = viewModel,
musicViewModel = musicViewModel
)
}
Expand Down Expand Up @@ -234,8 +232,6 @@ fun MusicListItemView(
music: MusicInfo,
team: Team,
image: Int,
navController: NavHostController,
viewModel: MusicListViewModel,
musicViewModel: MusicViewModel
) {
val sheetState = rememberModalBottomSheetState()
Expand All @@ -249,7 +245,6 @@ fun MusicListItemView(
image = image,
onClickCell = {
musicViewModel.setSelectedMusic(music = music)
viewModel.onSongSelected(music = music)
},
onClickExtraButton = {
showBottomSheet = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ class MusicListViewModel(
observeSelectedTeam()
}

fun onSongSelected(music: MusicInfo) {
viewModelScope.launch {
_userPreferences.showingMiniPlayer()
_userPreferences.setSongId(music = music)
}
}

private fun observeUserPreference() {
viewModelScope.launch {
_userPreferences.getSelectedTeam.collect { team ->
Expand Down

0 comments on commit 6708fe6

Please sign in to comment.