mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-22 04:59:34 +01:00
get recording status by signaling
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
4834afaf7e
commit
1aafc9989d
@ -98,6 +98,7 @@ import com.nextcloud.talk.utils.ApiUtils;
|
|||||||
import com.nextcloud.talk.utils.DisplayUtils;
|
import com.nextcloud.talk.utils.DisplayUtils;
|
||||||
import com.nextcloud.talk.utils.NotificationUtils;
|
import com.nextcloud.talk.utils.NotificationUtils;
|
||||||
import com.nextcloud.talk.utils.animations.PulseAnimation;
|
import com.nextcloud.talk.utils.animations.PulseAnimation;
|
||||||
|
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||||
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew;
|
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew;
|
||||||
import com.nextcloud.talk.utils.permissions.PlatformPermissionUtil;
|
import com.nextcloud.talk.utils.permissions.PlatformPermissionUtil;
|
||||||
import com.nextcloud.talk.utils.power.PowerManagerUtils;
|
import com.nextcloud.talk.utils.power.PowerManagerUtils;
|
||||||
@ -1674,26 +1675,42 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (webSocketCommunicationEvent.getType()) {
|
if (webSocketCommunicationEvent.getHashMap() != null) {
|
||||||
case "hello":
|
switch (webSocketCommunicationEvent.getType()) {
|
||||||
Log.d(TAG, "onMessageEvent 'hello'");
|
case "hello":
|
||||||
if (!webSocketCommunicationEvent.getHashMap().containsKey("oldResumeId")) {
|
Log.d(TAG, "onMessageEvent 'hello'");
|
||||||
if (currentCallStatus == CallStatus.RECONNECTING) {
|
if (!webSocketCommunicationEvent.getHashMap().containsKey("oldResumeId")) {
|
||||||
hangup(false);
|
if (currentCallStatus == CallStatus.RECONNECTING) {
|
||||||
} else {
|
hangup(false);
|
||||||
setCallState(CallStatus.RECONNECTING);
|
} else {
|
||||||
runOnUiThread(this::initiateCall);
|
setCallState(CallStatus.RECONNECTING);
|
||||||
|
runOnUiThread(this::initiateCall);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case "roomJoined":
|
||||||
case "roomJoined":
|
Log.d(TAG, "onMessageEvent 'roomJoined'");
|
||||||
Log.d(TAG, "onMessageEvent 'roomJoined'");
|
startSendingNick();
|
||||||
startSendingNick();
|
|
||||||
|
|
||||||
if (webSocketCommunicationEvent.getHashMap().get("roomToken").equals(roomToken)) {
|
if (webSocketCommunicationEvent.getHashMap().get("roomToken").equals(roomToken)) {
|
||||||
performCall();
|
performCall();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "recordingStatus":
|
||||||
|
Log.d(TAG, "onMessageEvent 'recordingStatus'");
|
||||||
|
|
||||||
|
if (webSocketCommunicationEvent.getHashMap().containsKey(BundleKeys.KEY_RECORDING_STATE)) {
|
||||||
|
String recordingStateString =
|
||||||
|
webSocketCommunicationEvent.getHashMap().get(BundleKeys.KEY_RECORDING_STATE);
|
||||||
|
|
||||||
|
if (recordingStateString != null) {
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
callRecordingViewModel.setRecordingState(Integer.parseInt(recordingStateString));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +108,7 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec
|
|||||||
when (state) {
|
when (state) {
|
||||||
0 -> _viewState.value = RecordingStoppedState
|
0 -> _viewState.value = RecordingStoppedState
|
||||||
1 -> _viewState.value = RecordingStartedState
|
1 -> _viewState.value = RecordingStartedState
|
||||||
|
2 -> _viewState.value = RecordingStartedState
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,13 +266,15 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|||||||
refreshChatHashMap.put(BundleKeys.KEY_INTERNAL_USER_ID, Long.toString(conversationUser.getId()));
|
refreshChatHashMap.put(BundleKeys.KEY_INTERNAL_USER_ID, Long.toString(conversationUser.getId()));
|
||||||
eventBus.post(new WebSocketCommunicationEvent("refreshChat", refreshChatHashMap));
|
eventBus.post(new WebSocketCommunicationEvent("refreshChat", refreshChatHashMap));
|
||||||
}
|
}
|
||||||
} else if (dataHashMap.containsKey("recording")) {
|
} else if (dataHashMap != null && dataHashMap.containsKey("recording")) {
|
||||||
Map<String, Object> recordingMap = (Map<String, Object>) dataHashMap.get("recording");
|
Map<String, Object> recordingMap = (Map<String, Object>) dataHashMap.get("recording");
|
||||||
if (recordingMap != null && recordingMap.containsKey("status")) {
|
if (recordingMap != null && recordingMap.containsKey("status")) {
|
||||||
int status = ((Long) recordingMap.get("status")).intValue();
|
int status = ((Long) recordingMap.get("status")).intValue();
|
||||||
Log.d(TAG, "status is " + status);
|
Log.d(TAG, "status is " + status);
|
||||||
|
|
||||||
// TODO: inform ChatController about state (after Daniels PRs are merged..)
|
HashMap<String, String> recordingHashMap = new HashMap<>();
|
||||||
|
recordingHashMap.put(BundleKeys.KEY_RECORDING_STATE, Integer.toString(status));
|
||||||
|
eventBus.post(new WebSocketCommunicationEvent("recordingStatus", recordingHashMap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user