Fix a few bugs

This commit is contained in:
Mario Danic 2018-10-25 00:28:48 +02:00
parent 8af64364b7
commit 91d0d829e0
5 changed files with 13 additions and 8 deletions

View file

@ -365,9 +365,11 @@ public class AccountVerificationController extends BaseController {
fetchAndStoreExternalSignalingSettings(); fetchAndStoreExternalSignalingSettings();
} }
} else if (eventStatus.getEventType().equals(EventStatus.EventType.SIGNALING_SETTINGS)) { } else if (eventStatus.getEventType().equals(EventStatus.EventType.SIGNALING_SETTINGS)) {
if (getActivity() != null) { if (eventStatus.isAllGood()) {
getActivity().runOnUiThread(() -> progressText.setText(progressText.getText().toString() + "\n" + if (getActivity() != null) {
getResources().getString(R.string.nc_external_server_failed))); getActivity().runOnUiThread(() -> progressText.setText(progressText.getText().toString() + "\n" +
getResources().getString(R.string.nc_external_server_failed)));
}
} }
proceedWithLogin(); proceedWithLogin();

View file

@ -1194,7 +1194,7 @@ public class CallController extends BaseController {
private void setupAndInitiateWebSocketsConnection() { private void setupAndInitiateWebSocketsConnection() {
webSocketConnectionHelper = new WebSocketConnectionHelper(); webSocketConnectionHelper = new WebSocketConnectionHelper();
webSocketClient = webSocketConnectionHelper.getExternalSignalingInstanceForServer( webSocketClient = webSocketConnectionHelper.getExternalSignalingInstanceForServer(
externalSignalingServer.getExternalSignalingServer(), false, externalSignalingServer.getExternalSignalingServer(),
conversationUser, externalSignalingServer.getExternalSignalingTicket()); conversationUser, externalSignalingServer.getExternalSignalingTicket());
} }

View file

@ -66,7 +66,7 @@ public class WebsocketConnectionsWorker extends Worker {
if (!TextUtils.isEmpty(externalSignalingServer.getExternalSignalingServer()) && if (!TextUtils.isEmpty(externalSignalingServer.getExternalSignalingServer()) &&
!TextUtils.isEmpty(externalSignalingServer.getExternalSignalingTicket())) { !TextUtils.isEmpty(externalSignalingServer.getExternalSignalingTicket())) {
webSocketConnectionHelper.getExternalSignalingInstanceForServer( webSocketConnectionHelper.getExternalSignalingInstanceForServer(
externalSignalingServer.getExternalSignalingServer(), false, externalSignalingServer.getExternalSignalingServer(),
userEntity, externalSignalingServer.getExternalSignalingTicket()); userEntity, externalSignalingServer.getExternalSignalingTicket());
} }
} catch (IOException e) { } catch (IOException e) {

View file

@ -77,7 +77,6 @@ public class MagicWebSocketInstance extends WebSocketListener {
Request request = new Request.Builder().url(connectionUrl).build(); Request request = new Request.Builder().url(connectionUrl).build();
this.webSocket = okHttpClient.newWebSocket(request, this); this.webSocket = okHttpClient.newWebSocket(request, this);
this.conversationUser = conversationUser; this.conversationUser = conversationUser;
this.webSocketTicket = webSocketTicket; this.webSocketTicket = webSocketTicket;
this.webSocketConnectionHelper = new WebSocketConnectionHelper(); this.webSocketConnectionHelper = new WebSocketConnectionHelper();
@ -231,4 +230,8 @@ public class MagicWebSocketInstance extends WebSocketListener {
Log.e(TAG, "Failed to offer request"); Log.e(TAG, "Failed to offer request");
} }
} }
public boolean isConnected() {
return connected;
}
} }

View file

@ -69,11 +69,11 @@ public class WebSocketConnectionHelper {
return generatedURL; return generatedURL;
} }
public MagicWebSocketInstance getExternalSignalingInstanceForServer(String url, boolean forceReconnect, UserEntity userEntity, String webSocketTicket) { public synchronized MagicWebSocketInstance getExternalSignalingInstanceForServer(String url, UserEntity userEntity, String webSocketTicket) {
String connectionUrl = getExternalSignalingServerUrlFromSettingsUrl(url); String connectionUrl = getExternalSignalingServerUrlFromSettingsUrl(url);
if (magicWebSocketInstanceMap.containsKey(userEntity.getUserId()) && !forceReconnect) { if (magicWebSocketInstanceMap.containsKey(userEntity.getUserId())) {
return magicWebSocketInstanceMap.get(userEntity.getUserId()); return magicWebSocketInstanceMap.get(userEntity.getUserId());
} else { } else {
MagicWebSocketInstance magicWebSocketInstance = new MagicWebSocketInstance(userEntity, connectionUrl, webSocketTicket); MagicWebSocketInstance magicWebSocketInstance = new MagicWebSocketInstance(userEntity, connectionUrl, webSocketTicket);