Fix conversation creation process

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-09-03 10:51:01 +02:00
parent 4e76a5e83e
commit ccb554e1f5
3 changed files with 64 additions and 10 deletions

View File

@ -358,7 +358,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
}
private void loadAvatarForStatusBar() {
if (currentConversation != null && currentConversation.getType().equals(Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) && getActivity() != null && conversationVoiceCallMenuItem != null) {
if (currentConversation != null && currentConversation.getType() != null && currentConversation.getType().equals(Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) && getActivity() != null && conversationVoiceCallMenuItem != null) {
int avatarSize =
(int) DisplayUtils.convertDpToPixel(conversationVoiceCallMenuItem.getIcon().getIntrinsicWidth(), getActivity());

View File

@ -264,11 +264,37 @@ public class ContactsController extends BaseController implements SearchView.OnQ
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), roomOverall.getOcs().getData().getRoomId());
if (currentUser.hasSpreedFeatureCapability("chat-v2")) {
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ACTIVE_CONVERSATION(),
Parcels.wrap(roomOverall.getOcs().getData()));
ncApi.getRoom(credentials,
ApiUtils.getRoom(currentUser.getBaseUrl(),
roomOverall.getOcs().getData().getToken()))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomOverall>() {
ConductorRemapping.INSTANCE.remapChatController(getRouter(), currentUser.getId(),
roomOverall.getOcs().getData().getToken(), bundle, true);
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(RoomOverall roomOverall) {
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ACTIVE_CONVERSATION(),
Parcels.wrap(roomOverall.getOcs().getData()));
ConductorRemapping.INSTANCE.remapChatController(getRouter(), currentUser.getId(),
roomOverall.getOcs().getData().getToken(), bundle, true);
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
} else {
conversationIntent.putExtras(bundle);
startActivity(conversationIntent);

View File

@ -296,11 +296,39 @@ public class OperationsMenuController extends BaseController {
@Override
public void onNext(RoomOverall roomOverall) {
conversation = roomOverall.getOcs().getData();
if (conversationType.equals(Conversation.ConversationType.ROOM_PUBLIC_CALL) && isGroupCallWorkaroundFinal) {
performGroupCallWorkaround(credentials);
} else {
inviteUsersToAConversation();
}
ncApi.getRoom(credentials,
ApiUtils.getRoom(currentUser.getBaseUrl(), conversation.getToken()))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomOverall>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(RoomOverall roomOverall) {
conversation = roomOverall.getOcs().getData();
if (conversationType.equals(Conversation.ConversationType.ROOM_PUBLIC_CALL) && isGroupCallWorkaroundFinal) {
performGroupCallWorkaround(credentials);
} else {
inviteUsersToAConversation();
}
}
@Override
public void onError(Throwable e) {
showResultImage(false, false);
dispose();
}
@Override
public void onComplete() {
}
});
}
@Override