Search in sources :

Example 1 with RealmSessionRepository

use of chat.rocket.persistence.realm.repositories.RealmSessionRepository 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 RealmSessionRepository

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

the class AddDirectMessageDialogFragment method onSetupDialog.

@SuppressLint("RxLeakedSubscription")
@Override
protected void onSetupDialog() {
    View buttonAddDirectMessage = getDialog().findViewById(R.id.btn_add_direct_message);
    AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) getDialog().findViewById(R.id.editor_username);
    AbsoluteUrlHelper absoluteUrlHelper = new AbsoluteUrlHelper(hostname, new RealmServerInfoRepository(), new RealmUserRepository(hostname), new SessionInteractor(new RealmSessionRepository(hostname)));
    compositeDisposable.add(absoluteUrlHelper.getRocketChatAbsoluteUrl().subscribeOn(AndroidSchedulers.from(BackgroundLooper.get())).observeOn(AndroidSchedulers.mainThread()).subscribe(this::setupView, Logger::report));
    RxTextView.textChanges(autoCompleteTextView).map(text -> !TextUtils.isEmpty(text)).compose(bindToLifecycle()).subscribe(buttonAddDirectMessage::setEnabled, Logger::report);
    buttonAddDirectMessage.setOnClickListener(view -> createRoom());
}
Also used : SessionInteractor(chat.rocket.core.interactors.SessionInteractor) AbsoluteUrlHelper(chat.rocket.android.helper.AbsoluteUrlHelper) RealmSessionRepository(chat.rocket.persistence.realm.repositories.RealmSessionRepository) Logger(chat.rocket.android.helper.Logger) RxTextView(com.jakewharton.rxbinding2.widget.RxTextView) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) View(android.view.View) RealmServerInfoRepository(chat.rocket.persistence.realm.repositories.RealmServerInfoRepository) RealmUserRepository(chat.rocket.persistence.realm.repositories.RealmUserRepository) AutoCompleteTextView(android.widget.AutoCompleteTextView) SuppressLint(android.annotation.SuppressLint)

Example 3 with RealmSessionRepository

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

the class RetryLoginFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    presenter = new RetryLoginPresenter(new SessionInteractor(new RealmSessionRepository(hostname)), new MethodCallHelper(getContext(), hostname));
}
Also used : SessionInteractor(chat.rocket.core.interactors.SessionInteractor) MethodCallHelper(chat.rocket.android.api.MethodCallHelper) RealmSessionRepository(chat.rocket.persistence.realm.repositories.RealmSessionRepository)

Example 4 with RealmSessionRepository

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

the class UsersOfRoomDialogFragment method onSetupDialog.

@Override
protected void onSetupDialog() {
    AbsoluteUrlHelper absoluteUrlHelper = new AbsoluteUrlHelper(hostname, new RealmServerInfoRepository(), new RealmUserRepository(hostname), new SessionInteractor(new RealmSessionRepository(hostname)));
    compositeDisposable.add(absoluteUrlHelper.getRocketChatAbsoluteUrl().subscribeOn(AndroidSchedulers.from(BackgroundLooper.get())).observeOn(AndroidSchedulers.mainThread()).subscribe(this::setupView, Logger::report));
}
Also used : SessionInteractor(chat.rocket.core.interactors.SessionInteractor) AbsoluteUrlHelper(chat.rocket.android.helper.AbsoluteUrlHelper) RealmSessionRepository(chat.rocket.persistence.realm.repositories.RealmSessionRepository) RealmServerInfoRepository(chat.rocket.persistence.realm.repositories.RealmServerInfoRepository) RealmUserRepository(chat.rocket.persistence.realm.repositories.RealmUserRepository)

Example 5 with RealmSessionRepository

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

the class RoomFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();
    hostname = args.getString(HOSTNAME);
    roomId = args.getString(ROOM_ID);
    roomRepository = new RealmRoomRepository(hostname);
    MessageInteractor messageInteractor = new MessageInteractor(new RealmMessageRepository(hostname), roomRepository);
    userRepository = new RealmUserRepository(hostname);
    absoluteUrlHelper = new AbsoluteUrlHelper(hostname, new RealmServerInfoRepository(), userRepository, new SessionInteractor(new RealmSessionRepository(hostname)));
    methodCallHelper = new MethodCallHelper(getContext(), hostname);
    presenter = new RoomPresenter(roomId, userRepository, messageInteractor, roomRepository, absoluteUrlHelper, methodCallHelper, ConnectivityManager.getInstance(getContext()));
    if (savedInstanceState == null) {
        presenter.loadMessages();
    }
}
Also used : SessionInteractor(chat.rocket.core.interactors.SessionInteractor) MethodCallHelper(chat.rocket.android.api.MethodCallHelper) AbsoluteUrlHelper(chat.rocket.android.helper.AbsoluteUrlHelper) RealmSessionRepository(chat.rocket.persistence.realm.repositories.RealmSessionRepository) MessageInteractor(chat.rocket.core.interactors.MessageInteractor) Bundle(android.os.Bundle) RealmRoomRepository(chat.rocket.persistence.realm.repositories.RealmRoomRepository) RealmMessageRepository(chat.rocket.persistence.realm.repositories.RealmMessageRepository) RealmServerInfoRepository(chat.rocket.persistence.realm.repositories.RealmServerInfoRepository) RealmUserRepository(chat.rocket.persistence.realm.repositories.RealmUserRepository)

Aggregations

SessionInteractor (chat.rocket.core.interactors.SessionInteractor)7 RealmSessionRepository (chat.rocket.persistence.realm.repositories.RealmSessionRepository)7 RealmUserRepository (chat.rocket.persistence.realm.repositories.RealmUserRepository)5 MethodCallHelper (chat.rocket.android.api.MethodCallHelper)4 AbsoluteUrlHelper (chat.rocket.android.helper.AbsoluteUrlHelper)4 RealmServerInfoRepository (chat.rocket.persistence.realm.repositories.RealmServerInfoRepository)4 RealmRoomRepository (chat.rocket.persistence.realm.repositories.RealmRoomRepository)3 Bundle (android.os.Bundle)2 RocketChatCache (chat.rocket.android.RocketChatCache)2 RoomInteractor (chat.rocket.core.interactors.RoomInteractor)2 SuppressLint (android.annotation.SuppressLint)1 Intent (android.content.Intent)1 View (android.view.View)1 AutoCompleteTextView (android.widget.AutoCompleteTextView)1 TextView (android.widget.TextView)1 Logger (chat.rocket.android.helper.Logger)1 CanCreateRoomInteractor (chat.rocket.core.interactors.CanCreateRoomInteractor)1 MessageInteractor (chat.rocket.core.interactors.MessageInteractor)1 RealmMessageRepository (chat.rocket.persistence.realm.repositories.RealmMessageRepository)1 RealmSpotlightRoomRepository (chat.rocket.persistence.realm.repositories.RealmSpotlightRoomRepository)1