package de.beyondsoft.ownchat.utils.rx;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by imarneanu on 2/9/17.
 */
public abstract class RxUtils {

    private RxUtils() {

    }

    /**
     * This method applies the io(background)thread for the observable
     * and makes the subscriber work on the main thread one.
     *
     * @return Observable.
     */
    public static <T> Observable.Transformer<T, T> provideDefaultTransformer() {
        return observable -> observable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}
