Improve sending nick

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-06-21 11:32:34 +02:00
parent 6ce0d53412
commit c48e9e01a2
2 changed files with 22 additions and 7 deletions

View file

@ -1722,19 +1722,35 @@ public class CallController extends BaseController {
nickChangedPayload.put("userid", conversationUser.getUserId());
nickChangedPayload.put("name", conversationUser.getDisplayName());
dataChannelMessage.setPayload(nickChangedPayload);
final MagicPeerConnectionWrapper magicPeerConnectionWrapper;
for (int i = 0; i < magicPeerConnectionWrapperList.size(); i++) {
if (magicPeerConnectionWrapperList.get(i).isMCUPublisher()) {
int finalI = i;
magicPeerConnectionWrapper = magicPeerConnectionWrapperList.get(i);
Observable
.interval(1, TimeUnit.SECONDS)
.repeat()
.repeatWhen() -> !isConnectionEstablished() || isBeingDestroyed() || isDestroyed() || !MerlinTheWizard.isConnectedToInternet())
.observeOn(Schedulers.io())
.doOnNext(new Consumer<Long>() {
.subscribe(new Observer<Long>() {
@Override
public void accept(Long aLong) {
magicPeerConnectionWrapperList.get(finalI).sendNickChannelData(dataChannelMessage);
public void onSubscribe(Disposable d) {
}
}).subscribe();
@Override
public void onNext(Long aLong) {
magicPeerConnectionWrapper.sendNickChannelData(dataChannelMessage);
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
break;
}

View file

@ -137,7 +137,6 @@ public class MagicWebSocketInstance extends WebSocketListener {
@Override
public void onMessage(WebSocket webSocket, String text) {
Log.d(TAG, "ReceivingBEFORE : " + webSocket.toString() + " " + text);
if (webSocket == internalWebSocket) {
Log.d(TAG, "Receiving : " + webSocket.toString() + " " + text);
LoggingUtils.writeLogEntryToFile(context,