read recording state when enter call.

prepare to set recording state by signaling message (waiting for PRs from Daniel)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-01-06 18:01:56 +01:00
parent 1d002b6a4d
commit 4834afaf7e
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
6 changed files with 29 additions and 2 deletions

View File

@ -177,6 +177,7 @@ import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FROM_NOTIFICATION_S
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_MODIFIED_BASE_URL;
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO;
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO;
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE;
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID;
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN;
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_USER_ENTITY;
@ -389,6 +390,7 @@ public class CallActivity extends CallBaseActivity {
callRecordingViewModel = new ViewModelProvider(this, viewModelFactory).get((CallRecordingViewModel.class));
callRecordingViewModel.setData(roomToken);
callRecordingViewModel.setRecordingState(extras.getInt(KEY_RECORDING_STATE));
callRecordingViewModel.getViewState().observe(this, viewState -> {
if (viewState instanceof CallRecordingViewModel.RecordingStartedState) {
@ -1482,7 +1484,10 @@ public class CallActivity extends CallBaseActivity {
@Override
public void onNext(@io.reactivex.annotations.NonNull RoomOverall roomOverall) {
callSession = roomOverall.getOcs().getData().getSessionId();
Conversation conversation = roomOverall.getOcs().getData();
callRecordingViewModel.setRecordingState(conversation.getCallRecording());
callSession = conversation.getSessionId();
Log.d(TAG, " new callSession by joinRoom= " + callSession);
ApplicationWideCurrentRoomHolder.getInstance().setSession(callSession);

View File

@ -174,6 +174,7 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ACTIVE_CONVERSATION
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CONVERSATION_NAME
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FILE_PATHS
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_USER_ENTITY
@ -2738,6 +2739,7 @@ class ChatController(args: Bundle) :
bundle.putString(BundleKeys.KEY_CONVERSATION_PASSWORD, roomPassword)
bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL, conversationUser?.baseUrl)
bundle.putString(KEY_CONVERSATION_NAME, it.displayName)
bundle.putInt(KEY_RECORDING_STATE, it.callRecording)
bundle.putBoolean(
BundleKeys.KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO,
participantPermissions.canPublishAudio()

View File

@ -139,7 +139,10 @@ data class Conversation(
var statusMessage: String? = null,
@JsonField(name = ["statusClearAt"])
var statusClearAt: Long? = 0
var statusClearAt: Long? = 0,
@JsonField(name = ["callRecording"])
var callRecording: Int = 0
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'

View File

@ -55,6 +55,7 @@ object BundleKeys {
const val KEY_INVITED_GROUP = "KEY_INVITED_GROUP"
const val KEY_INVITED_EMAIL = "KEY_INVITED_EMAIL"
const val KEY_CONVERSATION_NAME = "KEY_CONVERSATION_NAME"
const val KEY_RECORDING_STATE = "KEY_RECORDING_STATE"
const val KEY_CALL_VOICE_ONLY = "KEY_CALL_VOICE_ONLY"
const val KEY_CALL_WITHOUT_NOTIFICATION = "KEY_CALL_WITHOUT_NOTIFICATION"
const val KEY_ACTIVE_CONVERSATION = "KEY_ACTIVE_CONVERSATION"

View File

@ -104,6 +104,14 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec
this.roomToken = roomToken
}
fun setRecordingState(state: Int) {
when (state) {
0 -> _viewState.value = RecordingStoppedState
1 -> _viewState.value = RecordingStartedState
else -> {}
}
}
inner class CallStartRecordingObserver : Observer<StartCallRecordingModel> {
override fun onSubscribe(d: Disposable) {
// unused atm

View File

@ -266,6 +266,14 @@ public class MagicWebSocketInstance extends WebSocketListener {
refreshChatHashMap.put(BundleKeys.KEY_INTERNAL_USER_ID, Long.toString(conversationUser.getId()));
eventBus.post(new WebSocketCommunicationEvent("refreshChat", refreshChatHashMap));
}
} else if (dataHashMap.containsKey("recording")) {
Map<String, Object> recordingMap = (Map<String, Object>) dataHashMap.get("recording");
if (recordingMap != null && recordingMap.containsKey("status")) {
int status = ((Long) recordingMap.get("status")).intValue();
Log.d(TAG, "status is " + status);
// TODO: inform ChatController about state (after Daniels PRs are merged..)
}
}
}
}