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) { public void onNext(GenericOverall genericOverall) {
dispose(); dispose();
if (!isDestroyed()) { 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, bundle.putString(BundleKeys.KEY_CONVERSATION_NAME,
roomOverall.getOcs().getData().getDisplayName()); roomOverall.getOcs().getData().getDisplayName());
conversationIntent.putExtras(bundle); conversationIntent.putExtras(bundle);
getRouter().pushController((RouterTransaction.with(new ChatController(bundle)) getRouter().replaceTopController((RouterTransaction.with(new ChatController(bundle))
.pushChangeHandler(new HorizontalChangeHandler()) .pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()))); .popChangeHandler(new HorizontalChangeHandler())));
} else { } else {
conversationIntent.putExtras(bundle); conversationIntent.putExtras(bundle);
startActivity(conversationIntent); 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; HttpException exception = (HttpException) e;
switch (exception.code()) { switch (exception.code()) {
case 401: case 401:
if (getParentController() != null && getRouter().pushController((RouterTransaction.with(new WebViewLoginController(currentUser.getBaseUrl(),
getParentController().getRouter() != null) {
getParentController().getRouter().pushController((RouterTransaction.with
(new WebViewLoginController(currentUser.getBaseUrl(),
true)) true))
.pushChangeHandler(new VerticalChangeHandler()) .pushChangeHandler(new VerticalChangeHandler())
.popChangeHandler(new VerticalChangeHandler()))); .popChangeHandler(new VerticalChangeHandler())));
}
break; break;
default: default:
break; break;
@ -870,13 +866,12 @@ public class ContactsController extends BaseController implements SearchView.OnQ
if (currentUser.hasSpreedCapabilityWithName("chat-v2")) { if (currentUser.hasSpreedCapabilityWithName("chat-v2")) {
bundle.putString(BundleKeys.KEY_CONVERSATION_NAME, bundle.putString(BundleKeys.KEY_CONVERSATION_NAME,
roomOverall.getOcs().getData().getDisplayName()); roomOverall.getOcs().getData().getDisplayName());
if (getParentController() != null) { getRouter().replaceTopController((RouterTransaction.with(new ChatController(bundle))
getParentController().getRouter().pushController((RouterTransaction.with(new ChatController(bundle))
.pushChangeHandler(new HorizontalChangeHandler()) .pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()))); .popChangeHandler(new HorizontalChangeHandler())));
}
} else { } else {
startActivity(conversationIntent); startActivity(conversationIntent);
new Handler().postDelayed(() -> getRouter().popCurrentController(), 100);
} }
} }
} }