Commit da33e61f authored by Aniket's avatar Aniket

resolves incorrect context issue in login activity

parent 6f80a3c4
package chat.rocket.android.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
......@@ -94,7 +95,8 @@ public class LoginActivity extends AbstractFragmentActivity implements LoginCont
protected boolean onBackPress() {
LoginFragment loginFragment = (LoginFragment) getSupportFragmentManager()
.findFragmentById(getLayoutContainerForFragment());
loginFragment.goBack();
Context loginActivityContext = this;
loginFragment.goBack(loginActivityContext);
return true;
}
}
package chat.rocket.android.fragment.server_config;
import android.content.Context;
import java.util.List;
import chat.rocket.android.shared.BaseContract;
......@@ -19,13 +22,13 @@ public interface LoginContract {
void showTwoStepAuth();
void goBack();
void goBack(Context ctx);
}
interface Presenter extends BaseContract.Presenter<View> {
void login(String username, String password);
void goBack();
void goBack(Context ctx);
}
}
package chat.rocket.android.fragment.server_config
import android.content.Context
import android.os.Bundle
import android.support.constraint.ConstraintLayout
import android.support.design.widget.Snackbar
......@@ -126,8 +127,8 @@ class LoginFragment : AbstractServerConfigFragment(), LoginContract.View {
presenter.release()
super.onPause()
}
override fun goBack() {
presenter.goBack()
override fun goBack(ctx: Context?) {
presenter.goBack(ctx)
}
}
package chat.rocket.android.fragment.server_config
import android.content.Context
import bolts.Continuation
import bolts.Task
import chat.rocket.android.BackgroundLooper
......@@ -31,7 +32,7 @@ class LoginPresenter(private val loginServiceConfigurationRepository: LoginServi
getLoginServices()
}
override fun goBack() {
override fun goBack(ctx : Context?) {
val context = RocketChatApplication.getInstance()
val hostname = RocketChatCache.getSelectedServerHostname()
hostname?.let {
......@@ -39,7 +40,7 @@ class LoginPresenter(private val loginServiceConfigurationRepository: LoginServi
RocketChatCache.clearSelectedHostnameReferences()
}
LaunchUtil.showMainActivity(context)
LaunchUtil.showMainActivity(ctx)
}
override fun login(username: String, password: String) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment