Skip to content
Snippets Groups Projects
Verified Commit abb3f3ca authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Removed unused functions

parent b3b54710
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,6 @@ package de.kuschku.quasseldroid.util.helper ...@@ -22,7 +22,6 @@ package de.kuschku.quasseldroid.util.helper
import androidx.annotation.MainThread import androidx.annotation.MainThread
import androidx.lifecycle.* import androidx.lifecycle.*
import io.reactivex.BackpressureStrategy
import io.reactivex.Observable import io.reactivex.Observable
@MainThread @MainThread
...@@ -77,33 +76,6 @@ inline fun <X, Y> LiveData<X>.switchMapNotNull( ...@@ -77,33 +76,6 @@ inline fun <X, Y> LiveData<X>.switchMapNotNull(
return result 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 @MainThread
inline fun <X, Y> LiveData<out X?>.map( inline fun <X, Y> LiveData<out X?>.map(
crossinline func: (X) -> Y? crossinline func: (X) -> Y?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment