Removed unused functions

parent b3b54710
......@@ -22,7 +22,6 @@ package de.kuschku.quasseldroid.util.helper
import androidx.annotation.MainThread
import androidx.lifecycle.*
import io.reactivex.BackpressureStrategy
import io.reactivex.Observable
@MainThread
......@@ -77,33 +76,6 @@ inline fun <X, Y> LiveData<X>.switchMapNotNull(
return result
}
@MainThread
inline fun <X, Y> LiveData<X?>.switchMapRx(
strategy: BackpressureStrategy,
crossinline func: (X) -> Observable<Y>?
): LiveData<Y?> {
val result = MediatorLiveData<Y>()
result.addSource(
this, object : Observer<X?> {
var mSource: LiveData<Y>? = null
override fun onChanged(x: X?) {
val newLiveData = if (x == null) null else func(x)?.toLiveData(strategy)
if (mSource === newLiveData) {
return
}
mSource?.let(result::removeSource)
mSource = newLiveData
if (newLiveData != null) {
result.addSource(newLiveData) { y -> result.value = y }
} else {
result.value = null
}
}
})
return result
}
@MainThread
inline fun <X, Y> LiveData<out X?>.map(
crossinline func: (X) -> Y?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment