use of chat.rocket.core.models.User 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);
}
use of chat.rocket.core.models.User in project Rocket.Chat.Android by RocketChat.
the class RoomPresenter method resendMessage.
@Override
public void resendMessage(Message message) {
final Disposable subscription = getCurrentUser().flatMap(user -> messageInteractor.resend(message, user)).subscribeOn(AndroidSchedulers.from(BackgroundLooper.get())).observeOn(AndroidSchedulers.mainThread()).subscribe();
addSubscription(subscription);
}
use of chat.rocket.core.models.User in project Rocket.Chat.Android by RocketChat.
the class RoomPresenter method updateMessage.
@Override
public void updateMessage(Message message, String content) {
final Disposable subscription = getCurrentUser().flatMap(user -> messageInteractor.update(message, user, content)).subscribeOn(AndroidSchedulers.from(BackgroundLooper.get())).observeOn(AndroidSchedulers.mainThread()).subscribe(success -> {
if (success) {
view.onMessageSendSuccessfully();
}
}, Logger::report);
addSubscription(subscription);
}
use of chat.rocket.core.models.User in project Rocket.Chat.Android by RocketChat.
the class RoomUserAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RoomUserViewHolder holder, int position) {
String username = usernames.get(position);
if (TextUtils.isEmpty(username)) {
return;
}
RealmUser realmUser = realmHelper.executeTransactionForRead(realm -> realm.where(RealmUser.class).equalTo(RealmUser.USERNAME, username).findFirst());
if (realmUser == null) {
User user = User.builder().setId("some-local-is").setUsername(username).setUtcOffset(0).build();
new UserRenderer(context, user).avatarInto(holder.avatar, absoluteUrl).usernameInto(holder.username);
} else {
new UserRenderer(context, realmUser.asUser()).statusColorInto(holder.status).avatarInto(holder.avatar, absoluteUrl).usernameInto(holder.username);
}
}
Aggregations