Fixed issue with call video update dialog
This commit is contained in:
parent
62083bc5c0
commit
3dffd6b39c
4 changed files with 12 additions and 8 deletions
|
@ -93,7 +93,9 @@ class ControlsFragment : GenericFragment<CallControlsFragmentBinding>() {
|
|||
if (call.state == Call.State.StreamsRunning) {
|
||||
dialog?.dismiss()
|
||||
} else if (call.state == Call.State.UpdatedByRemote) {
|
||||
showCallUpdateDialog(call)
|
||||
if (call.currentParams.videoEnabled() != call.remoteParams?.videoEnabled()) {
|
||||
showCallVideoUpdateDialog(call)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -219,17 +221,17 @@ class ControlsFragment : GenericFragment<CallControlsFragmentBinding>() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun showCallUpdateDialog(call: Call) {
|
||||
private fun showCallVideoUpdateDialog(call: Call) {
|
||||
val viewModel = DialogViewModel(AppUtils.getString(R.string.call_video_update_requested_dialog))
|
||||
dialog = DialogUtils.getDialog(requireContext(), viewModel)
|
||||
|
||||
viewModel.showCancelButton({
|
||||
callsViewModel.answerCallUpdateRequest(call, false)
|
||||
callsViewModel.answerCallVideoUpdateRequest(call, false)
|
||||
dialog?.dismiss()
|
||||
}, getString(R.string.dialog_decline))
|
||||
|
||||
viewModel.showOkButton({
|
||||
callsViewModel.answerCallUpdateRequest(call, true)
|
||||
callsViewModel.answerCallVideoUpdateRequest(call, true)
|
||||
dialog?.dismiss()
|
||||
}, getString(R.string.dialog_accept))
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ open class CallViewModel(val call: Call) : GenericContactViewModel(call.remoteAd
|
|||
// Decline call update
|
||||
viewModelScope.launch {
|
||||
withContext(Dispatchers.Main) {
|
||||
coreContext.answerCallUpdateRequest(call, false)
|
||||
coreContext.answerCallVideoUpdateRequest(call, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,8 +128,8 @@ class CallsViewModel : ViewModel() {
|
|||
super.onCleared()
|
||||
}
|
||||
|
||||
fun answerCallUpdateRequest(call: Call, accept: Boolean) {
|
||||
coreContext.answerCallUpdateRequest(call, accept)
|
||||
fun answerCallVideoUpdateRequest(call: Call, accept: Boolean) {
|
||||
coreContext.answerCallVideoUpdateRequest(call, accept)
|
||||
}
|
||||
|
||||
fun pauseConference() {
|
||||
|
|
|
@ -313,13 +313,15 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
|||
|
||||
/* Call related functions */
|
||||
|
||||
fun answerCallUpdateRequest(call: Call, accept: Boolean) {
|
||||
fun answerCallVideoUpdateRequest(call: Call, accept: Boolean) {
|
||||
val params = core.createCallParams(call)
|
||||
|
||||
if (accept) {
|
||||
params?.enableVideo(true)
|
||||
core.enableVideoCapture(true)
|
||||
core.enableVideoDisplay(true)
|
||||
} else {
|
||||
params?.enableVideo(false)
|
||||
}
|
||||
|
||||
call.acceptUpdate(params)
|
||||
|
|
Loading…
Reference in a new issue