mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-11 01:13:46 +01:00
False positive
This commit is contained in:
parent
250ac42fa3
commit
7e3acaa987
@ -42,9 +42,11 @@ abstract class VectorViewModel<S : MvRxState, VA : VectorViewModelAction, VE : V
|
|||||||
* This method does the same thing as the execute function, but it doesn't subscribe to the stream
|
* This method does the same thing as the execute function, but it doesn't subscribe to the stream
|
||||||
* so you can use this in a switchMap or a flatMap
|
* so you can use this in a switchMap or a flatMap
|
||||||
*/
|
*/
|
||||||
|
// False positive
|
||||||
|
@Suppress("USELESS_CAST")
|
||||||
fun <T> Single<T>.toAsync(stateReducer: S.(Async<T>) -> S): Single<Async<T>> {
|
fun <T> Single<T>.toAsync(stateReducer: S.(Async<T>) -> S): Single<Async<T>> {
|
||||||
setState { stateReducer(Loading()) }
|
setState { stateReducer(Loading()) }
|
||||||
return this.map { Success(it) as Async<T> }
|
return map { Success(it) as Async<T> }
|
||||||
.onErrorReturn { Fail(it) }
|
.onErrorReturn { Fail(it) }
|
||||||
.doOnSuccess { setState { stateReducer(it) } }
|
.doOnSuccess { setState { stateReducer(it) } }
|
||||||
}
|
}
|
||||||
@ -53,9 +55,11 @@ abstract class VectorViewModel<S : MvRxState, VA : VectorViewModelAction, VE : V
|
|||||||
* This method does the same thing as the execute function, but it doesn't subscribe to the stream
|
* This method does the same thing as the execute function, but it doesn't subscribe to the stream
|
||||||
* so you can use this in a switchMap or a flatMap
|
* so you can use this in a switchMap or a flatMap
|
||||||
*/
|
*/
|
||||||
|
// False positive
|
||||||
|
@Suppress("USELESS_CAST")
|
||||||
fun <T> Observable<T>.toAsync(stateReducer: S.(Async<T>) -> S): Observable<Async<T>> {
|
fun <T> Observable<T>.toAsync(stateReducer: S.(Async<T>) -> S): Observable<Async<T>> {
|
||||||
setState { stateReducer(Loading()) }
|
setState { stateReducer(Loading()) }
|
||||||
return this.map { Success(it) as Async<T> }
|
return map { Success(it) as Async<T> }
|
||||||
.onErrorReturn { Fail(it) }
|
.onErrorReturn { Fail(it) }
|
||||||
.doOnNext { setState { stateReducer(it) } }
|
.doOnNext { setState { stateReducer(it) } }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user