refactor: Replace `getOrElse { null }` with get() (#820)

`getOrElse { null }` is synonymous with `get()` when using
kotlin-result.
This commit is contained in:
Nik Clayton 2024-07-14 23:42:59 +02:00 committed by GitHub
parent 8aa521890f
commit af11e3d3a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -128,7 +128,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.target.CustomTarget
import com.bumptech.glide.request.target.FixedSizeDrawable
import com.bumptech.glide.request.transition.Transition
import com.github.michaelbull.result.getOrElse
import com.github.michaelbull.result.get
import com.github.michaelbull.result.onFailure
import com.github.michaelbull.result.onSuccess
import com.google.android.material.color.MaterialColors
@ -605,7 +605,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {
}
private fun refreshMainDrawerItems(addSearchButton: Boolean) {
val (listsDrawerItems, listsSectionTitle) = listsRepository.lists.value.getOrElse { null }?.let { result ->
val (listsDrawerItems, listsSectionTitle) = listsRepository.lists.value.get()?.let { result ->
when (result) {
Lists.Loading -> Pair(emptyList(), R.string.title_lists_loading)
is Lists.Loaded -> Pair(