diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java index 158c443ad..dd68704c9 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java @@ -637,7 +637,7 @@ public class ChatController extends BaseController implements MessagesListAdapte public void onNext(GenericOverall genericOverall) { dispose(); if (!isDestroyed()) { - getRouter().popToRoot(); + getRouter().popCurrentController(); } } diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java index a2364c24f..2a333d46c 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java @@ -282,13 +282,13 @@ public class ContactsController extends BaseController implements SearchView.OnQ bundle.putString(BundleKeys.KEY_CONVERSATION_NAME, roomOverall.getOcs().getData().getDisplayName()); conversationIntent.putExtras(bundle); - getRouter().pushController((RouterTransaction.with(new ChatController(bundle)) + getRouter().replaceTopController((RouterTransaction.with(new ChatController(bundle)) .pushChangeHandler(new HorizontalChangeHandler()) .popChangeHandler(new HorizontalChangeHandler()))); } else { conversationIntent.putExtras(bundle); startActivity(conversationIntent); - new Handler().postDelayed(() -> getRouter().popCurrentController(), 100); + getRouter().getBackstack().remove(getRouter().getBackstackSize() - 1); } } @@ -630,14 +630,10 @@ public class ContactsController extends BaseController implements SearchView.OnQ HttpException exception = (HttpException) e; switch (exception.code()) { case 401: - if (getParentController() != null && - getParentController().getRouter() != null) { - getParentController().getRouter().pushController((RouterTransaction.with - (new WebViewLoginController(currentUser.getBaseUrl(), - true)) - .pushChangeHandler(new VerticalChangeHandler()) - .popChangeHandler(new VerticalChangeHandler()))); - } + getRouter().pushController((RouterTransaction.with(new WebViewLoginController(currentUser.getBaseUrl(), + true)) + .pushChangeHandler(new VerticalChangeHandler()) + .popChangeHandler(new VerticalChangeHandler()))); break; default: break; @@ -870,13 +866,12 @@ public class ContactsController extends BaseController implements SearchView.OnQ if (currentUser.hasSpreedCapabilityWithName("chat-v2")) { bundle.putString(BundleKeys.KEY_CONVERSATION_NAME, roomOverall.getOcs().getData().getDisplayName()); - if (getParentController() != null) { - getParentController().getRouter().pushController((RouterTransaction.with(new ChatController(bundle)) - .pushChangeHandler(new HorizontalChangeHandler()) - .popChangeHandler(new HorizontalChangeHandler()))); - } + getRouter().replaceTopController((RouterTransaction.with(new ChatController(bundle)) + .pushChangeHandler(new HorizontalChangeHandler()) + .popChangeHandler(new HorizontalChangeHandler()))); } else { startActivity(conversationIntent); + new Handler().postDelayed(() -> getRouter().popCurrentController(), 100); } } }