package com.yidian.common.http

import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.ObservableTransformer
import io.reactivex.rxjava3.schedulers.Schedulers

class TransformUtil {

    companion object{
        fun <T> defaultSchedulers(): ObservableTransformer<T, T>? {
            return ObservableTransformer { upstream: Observable<T> ->
                upstream.observeOn(
                    AndroidSchedulers.mainThread()
                ).subscribeOn(Schedulers.io())
            }
        }

        fun <T> allIo(): ObservableTransformer<T, T>? {
            return ObservableTransformer { upstream: Observable<T> ->
                upstream.observeOn(
                    Schedulers.io()
                ).subscribeOn(Schedulers.io())
            }
        }
    }
}