use of chat.rocket.android.api.MethodCallHelper 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));
}
use of chat.rocket.android.api.MethodCallHelper in project Rocket.Chat.Android by RocketChat.
the class AbstractAddRoomDialogFragment method handleArgs.
protected void handleArgs(@NonNull Bundle args) {
hostname = args.getString("hostname");
realmHelper = RealmStore.get(hostname);
methodCall = new MethodCallHelper(getContext(), hostname);
}
use of chat.rocket.android.api.MethodCallHelper in project Rocket.Chat.Android by RocketChat.
the class TwoStepAuthFragment method onCreate.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
if (args == null || !args.containsKey(ARG_USERNAME_OR_EMAIL) || !args.containsKey(ARG_PASSWORD)) {
finish();
return;
}
presenter = new TwoStepAuthPresenter(new MethodCallHelper(getContext(), hostname), args.getString(ARG_USERNAME_OR_EMAIL), args.getString(ARG_PASSWORD));
}
use of chat.rocket.android.api.MethodCallHelper in project Rocket.Chat.Android by RocketChat.
the class UserRegistrationDialogFragment method createDialogView.
private View createDialogView() {
View dialog = LayoutInflater.from(getContext()).inflate(R.layout.dialog_user_registration, null, false);
final TextView txtUsername = (TextView) dialog.findViewById(R.id.editor_username);
final TextView txtEmail = (TextView) dialog.findViewById(R.id.editor_email);
final TextView txtPasswd = (TextView) dialog.findViewById(R.id.editor_passwd);
if (!TextUtils.isEmpty(username)) {
txtUsername.setText(username);
}
if (!TextUtils.isEmpty(email)) {
txtEmail.setText(email);
}
if (!TextUtils.isEmpty(password)) {
txtPasswd.setText(password);
}
final View waitingView = dialog.findViewById(R.id.waiting);
waitingView.setVisibility(View.GONE);
dialog.findViewById(R.id.btn_register_user).setOnClickListener(view -> {
view.setEnabled(false);
waitingView.setVisibility(View.VISIBLE);
username = txtUsername.getText().toString();
email = txtEmail.getText().toString();
password = txtPasswd.getText().toString();
MethodCallHelper methodCallHelper = new MethodCallHelper(getContext(), hostname);
methodCallHelper.registerUser(username, email, password, password).onSuccessTask(task -> methodCallHelper.loginWithEmail(email, password)).onSuccessTask(task -> methodCallHelper.setUsername(username)).onSuccessTask(task -> methodCallHelper.joinDefaultChannels()).onSuccessTask(task -> {
dismiss();
return task;
}).continueWith(task -> {
if (task.isFaulted()) {
Exception exception = task.getError();
showError(exception.getMessage());
view.setEnabled(true);
waitingView.setVisibility(View.GONE);
}
return null;
});
});
return dialog;
}
use of chat.rocket.android.api.MethodCallHelper 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));
}
Aggregations