Search in sources :

Example 1 with Settings

use of chat.rocket.core.models.Settings in project Rocket.Chat.Android by RocketChat.

the class RoomPresenter method getUserPreferences.

private void getUserPreferences() {
    final Disposable subscription = userRepository.getCurrent().filter(Optional::isPresent).map(Optional::get).filter(user -> user.getSettings() != null).map(User::getSettings).filter(settings -> settings.getPreferences() != null).map(Settings::getPreferences).distinctUntilChanged().subscribeOn(AndroidSchedulers.from(BackgroundLooper.get())).observeOn(AndroidSchedulers.mainThread()).subscribe(preferences -> {
        if (preferences.isAutoImageLoad()) {
            view.autoloadImages();
        } else {
            view.manualLoadImages();
        }
    }, Logger::report);
    addSubscription(subscription);
}
Also used : Disposable(io.reactivex.disposables.Disposable) User(chat.rocket.core.models.User) Settings(chat.rocket.core.models.Settings) Optional(com.fernandocejas.arrow.optional.Optional) UserRepository(chat.rocket.core.repositories.UserRepository) RoomRepository(chat.rocket.core.repositories.RoomRepository) Logger(chat.rocket.android.helper.Logger) NonNull(android.support.annotation.NonNull) Single(io.reactivex.Single) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) LogIfError(chat.rocket.android.helper.LogIfError) MessageInteractor(chat.rocket.core.interactors.MessageInteractor) Message(chat.rocket.core.models.Message) MethodCallHelper(chat.rocket.android.api.MethodCallHelper) Disposable(io.reactivex.disposables.Disposable) ConnectivityManagerApi(chat.rocket.android.service.ConnectivityManagerApi) Pair(android.support.v4.util.Pair) Room(chat.rocket.core.models.Room) SyncState(chat.rocket.core.SyncState) Nullable(android.support.annotation.Nullable) BackgroundLooper(chat.rocket.android.BackgroundLooper) BasePresenter(chat.rocket.android.shared.BasePresenter) AbsoluteUrlHelper(chat.rocket.android.helper.AbsoluteUrlHelper) User(chat.rocket.core.models.User) Optional(com.fernandocejas.arrow.optional.Optional) Logger(chat.rocket.android.helper.Logger) Settings(chat.rocket.core.models.Settings)

Aggregations

NonNull (android.support.annotation.NonNull)1 Nullable (android.support.annotation.Nullable)1 Pair (android.support.v4.util.Pair)1 BackgroundLooper (chat.rocket.android.BackgroundLooper)1 MethodCallHelper (chat.rocket.android.api.MethodCallHelper)1 AbsoluteUrlHelper (chat.rocket.android.helper.AbsoluteUrlHelper)1 LogIfError (chat.rocket.android.helper.LogIfError)1 Logger (chat.rocket.android.helper.Logger)1 ConnectivityManagerApi (chat.rocket.android.service.ConnectivityManagerApi)1 BasePresenter (chat.rocket.android.shared.BasePresenter)1 SyncState (chat.rocket.core.SyncState)1 MessageInteractor (chat.rocket.core.interactors.MessageInteractor)1 Message (chat.rocket.core.models.Message)1 Room (chat.rocket.core.models.Room)1 Settings (chat.rocket.core.models.Settings)1 User (chat.rocket.core.models.User)1 RoomRepository (chat.rocket.core.repositories.RoomRepository)1 UserRepository (chat.rocket.core.repositories.UserRepository)1 Optional (com.fernandocejas.arrow.optional.Optional)1 Single (io.reactivex.Single)1