Fix call sometimes not working

This commit is contained in:
Mario Danic 2018-10-25 11:34:25 +02:00
parent 85769f5d06
commit 61de45464b
3 changed files with 20 additions and 27 deletions

View file

@ -260,7 +260,6 @@ public class CallController extends BaseController {
conversationUser = userUtils.getCurrentUser();
}
callSession = args.getString(BundleKeys.KEY_CALL_SESSION, "0");
credentials = ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken());
isVoiceOnlyCall = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false);
@ -1025,36 +1024,32 @@ public class CallController extends BaseController {
}
private void joinRoomAndCall() {
if ("0".equals(callSession)) {
ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, roomToken), null)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.retry(3)
.subscribe(new Observer<CallOverall>() {
@Override
public void onSubscribe(Disposable d) {
ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, roomToken), null)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.retry(3)
.subscribe(new Observer<CallOverall>() {
@Override
public void onSubscribe(Disposable d) {
}
}
@Override
public void onNext(CallOverall callOverall) {
callSession = callOverall.getOcs().getData().getSessionId();
callOrJoinRoomViaWebSocket();
}
@Override
public void onNext(CallOverall callOverall) {
callSession = callOverall.getOcs().getData().getSessionId();
callOrJoinRoomViaWebSocket();
}
@Override
public void onError(Throwable e) {
@Override
public void onError(Throwable e) {
}
}
@Override
public void onComplete() {
@Override
public void onComplete() {
}
});
} else {
callOrJoinRoomViaWebSocket();
}
}
});
}
private void callOrJoinRoomViaWebSocket() {

View file

@ -1002,7 +1002,6 @@ public class ChatController extends BaseController implements MessagesListAdapte
bundle.putString(BundleKeys.KEY_ROOM_ID, roomId);
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(conversationUser));
bundle.putString(BundleKeys.KEY_CONVERSATION_PASSWORD, roomPassword);
bundle.putString(BundleKeys.KEY_CALL_SESSION, currentCall.getSessionId());
bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL, baseUrl);
if (isVoiceOnlyCall) {

View file

@ -33,7 +33,6 @@ public class BundleKeys {
public static final String KEY_APP_ITEM_PACKAGE_NAME = "KEY_APP_ITEM_PACKAGE_NAME";
public static final String KEY_APP_ITEM_NAME = "KEY_APP_ITEM_NAME";
public static final String KEY_CONVERSATION_PASSWORD = "KEY_CONVERSATION_PASSWORD";
public static final String KEY_CALL_SESSION = "KEY_CONVERSATION_SESSION";
public static final String KEY_ROOM_TOKEN = "KEY_ROOM_TOKEN";
public static final String KEY_USER_ENTITY = "KEY_USER_ENTITY";
public static final String KEY_NEW_CONVERSATION = "KEY_NEW_CONVERSATION";