Handle contacts -> chat better

This commit is contained in:
Mario Danic 2018-11-29 10:49:19 +01:00
parent b1889abb1b
commit 844b0b4942
2 changed files with 11 additions and 16 deletions

View file

@ -637,7 +637,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
public void onNext(GenericOverall genericOverall) {
dispose();
if (!isDestroyed()) {
getRouter().popToRoot();
getRouter().popCurrentController();
}
}

View file

@ -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(),
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))
getRouter().replaceTopController((RouterTransaction.with(new ChatController(bundle))
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler())));
}
} else {
startActivity(conversationIntent);
new Handler().postDelayed(() -> getRouter().popCurrentController(), 100);
}
}
}