Commit 287fe196 authored by Aniket's avatar Aniket

fixes #648

parent d9f9adb6
......@@ -9,6 +9,7 @@ import android.support.v4.app.Fragment;
import chat.rocket.android.R;
import chat.rocket.android.fragment.server_config.LoginFragment;
import chat.rocket.android.fragment.server_config.RetryLoginFragment;
import chat.rocket.android.helper.BackStackHelper;
import chat.rocket.android.service.ConnectivityManager;
import chat.rocket.core.interactors.SessionInteractor;
import chat.rocket.persistence.realm.repositories.RealmSessionRepository;
......@@ -93,10 +94,15 @@ public class LoginActivity extends AbstractFragmentActivity implements LoginCont
@Override
protected boolean onBackPress() {
if (BackStackHelper.FRAGMENT_TAG.equals("internal")) {
super.onBackPress();
BackStackHelper.FRAGMENT_TAG = "login";
} else if (BackStackHelper.FRAGMENT_TAG.equals("login")) {
LoginFragment loginFragment = (LoginFragment) getSupportFragmentManager()
.findFragmentById(getLayoutContainerForFragment());
Context loginActivityContext = this;
loginFragment.goBack(loginActivityContext);
}
return true;
}
}
......@@ -6,6 +6,7 @@ import android.support.v4.app.Fragment;
import chat.rocket.android.R;
import chat.rocket.android.fragment.AbstractFragment;
import chat.rocket.android.helper.BackStackHelper;
import chat.rocket.android.helper.TextUtils;
public abstract class AbstractServerConfigFragment extends AbstractFragment {
......@@ -36,6 +37,7 @@ public abstract class AbstractServerConfigFragment extends AbstractFragment {
}
protected void showFragmentWithBackStack(Fragment fragment) {
BackStackHelper.FRAGMENT_TAG = "internal";
getFragmentManager().beginTransaction()
.add(R.id.content, fragment)
.addToBackStack(null)
......
package chat.rocket.android.helper;
/**
* Created by whocares on 28/12/17.
*/
public class BackStackHelper {
public static String FRAGMENT_TAG = "login";
}
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