Skip to content

Commit

Permalink
Show default codec conversion if it's not set (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
chvp authored Jul 19, 2021
1 parent 7630fc9 commit aeedee1
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ class PreferencesViewModel(application: Application) : AndroidViewModel(applicat
val server: LiveData<String> = authenticationRepository.server
val imageCacheSize: LiveData<Long> = preferencesDataSource.imageCacheSize
val musicCacheSize: LiveData<Long> = preferencesDataSource.musicCacheSize
val conversion: LiveData<CodecConversion> = switchMap(codecConversionRepository.allCodecConversionsById) { ccs ->
map(conversionId) { it?.let { ccs[it] } }
val conversion: LiveData<CodecConversion> = switchMap(codecConversionRepository.allCodecConversionsById) { ccsMap ->
switchMap(codecConversionRepository.allCodecConversions) { ccs ->
map(conversionId) { it?.let { ccsMap[it] } ?: ccs.firstOrNull() }
}
}
val possibleConversions = codecConversionRepository.allCodecConversions

Expand Down

0 comments on commit aeedee1

Please sign in to comment.