Search in sources :

Example 1 with RealmSpotlightRoomRepository

use of chat.rocket.persistence.realm.repositories.RealmSpotlightRoomRepository in project Rocket.Chat.Android by RocketChat.

the class SidebarMainFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();
    hostname = args == null ? null : args.getString(HOSTNAME);
    methodCallHelper = new MethodCallHelper(getContext(), hostname);
    realmSpotlightRoomRepository = new RealmSpotlightRoomRepository(hostname);
    RealmUserRepository userRepository = new RealmUserRepository(hostname);
    AbsoluteUrlHelper absoluteUrlHelper = new AbsoluteUrlHelper(hostname, new RealmServerInfoRepository(), userRepository, new SessionInteractor(new RealmSessionRepository(hostname)));
    presenter = new SidebarMainPresenter(hostname, new RoomInteractor(new RealmRoomRepository(hostname)), userRepository, new RocketChatCache(getContext()), absoluteUrlHelper, TextUtils.isEmpty(hostname) ? null : new MethodCallHelper(getContext(), hostname));
}
Also used : SessionInteractor(chat.rocket.core.interactors.SessionInteractor) MethodCallHelper(chat.rocket.android.api.MethodCallHelper) RealmSpotlightRoomRepository(chat.rocket.persistence.realm.repositories.RealmSpotlightRoomRepository) AbsoluteUrlHelper(chat.rocket.android.helper.AbsoluteUrlHelper) RealmSessionRepository(chat.rocket.persistence.realm.repositories.RealmSessionRepository) RoomInteractor(chat.rocket.core.interactors.RoomInteractor) Bundle(android.os.Bundle) RocketChatCache(chat.rocket.android.RocketChatCache) RealmRoomRepository(chat.rocket.persistence.realm.repositories.RealmRoomRepository) RealmServerInfoRepository(chat.rocket.persistence.realm.repositories.RealmServerInfoRepository) RealmUserRepository(chat.rocket.persistence.realm.repositories.RealmUserRepository)

Example 2 with RealmSpotlightRoomRepository

use of chat.rocket.persistence.realm.repositories.RealmSpotlightRoomRepository in project Rocket.Chat.Android by RocketChat.

the class RoomFragment method setupMessageComposer.

private void setupMessageComposer() {
    final MessageFormLayout messageFormLayout = (MessageFormLayout) rootView.findViewById(R.id.message_composer);
    messageFormManager = new MessageFormManager(messageFormLayout, this::showExtraActionSelectionDialog);
    messageFormManager.setSendMessageCallback(this::sendMessage);
    messageFormLayout.setEditTextCommitContentListener(this::onCommitContent);
    autocompleteManager = new AutocompleteManager((ViewGroup) rootView.findViewById(R.id.message_list_root));
    autocompleteManager.registerSource(new ChannelSource(new AutocompleteChannelInteractor(roomRepository, new RealmSpotlightRoomRepository(hostname), new DeafultTempSpotlightRoomCaller(methodCallHelper)), AndroidSchedulers.from(BackgroundLooper.get()), AndroidSchedulers.mainThread()));
    Disposable disposable = Single.zip(absoluteUrlHelper.getRocketChatAbsoluteUrl(), roomRepository.getById(roomId).first(Optional.absent()), Pair::create).subscribe(pair -> {
        if (pair.first.isPresent() && pair.second.isPresent()) {
            autocompleteManager.registerSource(new UserSource(new AutocompleteUserInteractor(pair.second.get(), userRepository, new RealmMessageRepository(hostname), new RealmSpotlightUserRepository(hostname), new DefaultTempSpotlightUserCaller(methodCallHelper)), pair.first.get(), RocketChatUserStatusProvider.getInstance(), AndroidSchedulers.from(BackgroundLooper.get()), AndroidSchedulers.mainThread()));
        }
    }, throwable -> {
    });
    compositeDisposable.add(disposable);
    autocompleteManager.bindTo(messageFormLayout.getEditText(), messageFormLayout);
}
Also used : CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) RealmSpotlightRoomRepository(chat.rocket.persistence.realm.repositories.RealmSpotlightRoomRepository) AutocompleteChannelInteractor(chat.rocket.core.interactors.AutocompleteChannelInteractor) ViewGroup(android.view.ViewGroup) RealmMessageRepository(chat.rocket.persistence.realm.repositories.RealmMessageRepository) MessageFormLayout(chat.rocket.android.widget.message.MessageFormLayout) AutocompleteUserInteractor(chat.rocket.core.interactors.AutocompleteUserInteractor) RealmSpotlightUserRepository(chat.rocket.persistence.realm.repositories.RealmSpotlightUserRepository) DefaultTempSpotlightUserCaller(chat.rocket.android.service.temp.DefaultTempSpotlightUserCaller) MessageFormManager(chat.rocket.android.layouthelper.chatroom.MessageFormManager) UserSource(chat.rocket.android.widget.message.autocomplete.user.UserSource) DeafultTempSpotlightRoomCaller(chat.rocket.android.service.temp.DeafultTempSpotlightRoomCaller) AutocompleteManager(chat.rocket.android.widget.message.autocomplete.AutocompleteManager) ChannelSource(chat.rocket.android.widget.message.autocomplete.channel.ChannelSource)

Aggregations

RealmSpotlightRoomRepository (chat.rocket.persistence.realm.repositories.RealmSpotlightRoomRepository)2 Bundle (android.os.Bundle)1 ViewGroup (android.view.ViewGroup)1 RocketChatCache (chat.rocket.android.RocketChatCache)1 MethodCallHelper (chat.rocket.android.api.MethodCallHelper)1 AbsoluteUrlHelper (chat.rocket.android.helper.AbsoluteUrlHelper)1 MessageFormManager (chat.rocket.android.layouthelper.chatroom.MessageFormManager)1 DeafultTempSpotlightRoomCaller (chat.rocket.android.service.temp.DeafultTempSpotlightRoomCaller)1 DefaultTempSpotlightUserCaller (chat.rocket.android.service.temp.DefaultTempSpotlightUserCaller)1 MessageFormLayout (chat.rocket.android.widget.message.MessageFormLayout)1 AutocompleteManager (chat.rocket.android.widget.message.autocomplete.AutocompleteManager)1 ChannelSource (chat.rocket.android.widget.message.autocomplete.channel.ChannelSource)1 UserSource (chat.rocket.android.widget.message.autocomplete.user.UserSource)1 AutocompleteChannelInteractor (chat.rocket.core.interactors.AutocompleteChannelInteractor)1 AutocompleteUserInteractor (chat.rocket.core.interactors.AutocompleteUserInteractor)1 RoomInteractor (chat.rocket.core.interactors.RoomInteractor)1 SessionInteractor (chat.rocket.core.interactors.SessionInteractor)1 RealmMessageRepository (chat.rocket.persistence.realm.repositories.RealmMessageRepository)1 RealmRoomRepository (chat.rocket.persistence.realm.repositories.RealmRoomRepository)1 RealmServerInfoRepository (chat.rocket.persistence.realm.repositories.RealmServerInfoRepository)1