Show screen sharing permission dialog.
This commit is contained in:
parent
00bbb94b3b
commit
99cab794c4
|
@ -66,6 +66,11 @@ class CallControlsBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetC
|
|||
callViewModel.handle(VectorCallViewActions.InitiateCallTransfer)
|
||||
dismiss()
|
||||
}
|
||||
|
||||
views.callControlsShareScreen.views.bottomSheetActionClickableZone.debouncedClicks {
|
||||
callViewModel.handle(VectorCallViewActions.InitiateScreenSharing)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderState(state: VectorCallViewState) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.content.Intent
|
|||
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.media.projection.MediaProjectionManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
|
@ -525,6 +526,7 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
navigator.openCallTransfer(this, callTransferActivityResultLauncher, callId)
|
||||
}
|
||||
is VectorCallViewEvents.FailToTransfer -> showSnackbar(getString(R.string.call_transfer_failure))
|
||||
is VectorCallViewEvents.ShowScreenSharingPermissionDialog -> handleShowScreenSharingPermissionDialog()
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
@ -628,6 +630,18 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
}
|
||||
}
|
||||
|
||||
private val screenSharingPermissionActivityResultLauncher = registerStartForActivityResult { activityResult ->
|
||||
if (activityResult.resultCode == Activity.RESULT_OK) {
|
||||
callViewModel.handle(VectorCallViewActions.StartScreenSharing)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleShowScreenSharingPermissionDialog() {
|
||||
getSystemService<MediaProjectionManager>()?.let {
|
||||
navigator.openScreenSharingPermissionDialog(it.createScreenCaptureIntent(), screenSharingPermissionActivityResultLauncher)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val EXTRA_MODE = "EXTRA_MODE"
|
||||
private const val FRAGMENT_DIAL_PAD_TAG = "FRAGMENT_DIAL_PAD_TAG"
|
||||
|
|
|
@ -40,4 +40,6 @@ sealed class VectorCallViewActions : VectorViewModelAction {
|
|||
object CallTransferSelectionCancelled : VectorCallViewActions()
|
||||
data class CallTransferSelectionResult(val callTransferResult: CallTransferResult) : VectorCallViewActions()
|
||||
object TransferCall : VectorCallViewActions()
|
||||
object InitiateScreenSharing : VectorCallViewActions()
|
||||
object StartScreenSharing : VectorCallViewActions()
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ sealed class VectorCallViewEvents : VectorViewEvents {
|
|||
object ShowDialPad : VectorCallViewEvents()
|
||||
object ShowCallTransferScreen : VectorCallViewEvents()
|
||||
object FailToTransfer : VectorCallViewEvents()
|
||||
object ShowScreenSharingPermissionDialog : VectorCallViewEvents()
|
||||
// data class CallAnswered(val content: CallAnswerContent) : VectorCallViewEvents()
|
||||
// data class CallHangup(val content: CallHangupContent) : VectorCallViewEvents()
|
||||
// object CallAccepted : VectorCallViewEvents()
|
||||
|
|
|
@ -341,6 +341,14 @@ class VectorCallViewModel @AssistedInject constructor(
|
|||
setState { VectorCallViewState(action.callArgs) }
|
||||
setupCallWithCurrentState()
|
||||
}
|
||||
is VectorCallViewActions.InitiateScreenSharing -> {
|
||||
_viewEvents.post(
|
||||
VectorCallViewEvents.ShowScreenSharingPermissionDialog
|
||||
)
|
||||
}
|
||||
is VectorCallViewActions.StartScreenSharing -> {
|
||||
call?.shareScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -770,6 +770,10 @@ class WebRtcCall(
|
|||
return currentCaptureFormat
|
||||
}
|
||||
|
||||
fun shareScreen() {
|
||||
// TODO. Will be handled within the next PR.
|
||||
}
|
||||
|
||||
private suspend fun release() {
|
||||
listeners.clear()
|
||||
mxCall.removeListener(this)
|
||||
|
|
|
@ -600,4 +600,9 @@ class DefaultNavigator @Inject constructor(
|
|||
roomEncryptionTrustLevel = threadTimelineArgs.roomEncryptionTrustLevel
|
||||
)))
|
||||
}
|
||||
|
||||
override fun openScreenSharingPermissionDialog(screenCaptureIntent: Intent,
|
||||
activityResultLauncher: ActivityResultLauncher<Intent>) {
|
||||
activityResultLauncher.launch(screenCaptureIntent)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,4 +168,9 @@ interface Navigator {
|
|||
fun openThread(context: Context, threadTimelineArgs: ThreadTimelineArgs, eventIdToNavigate: String? = null)
|
||||
|
||||
fun openThreadList(context: Context, threadTimelineArgs: ThreadTimelineArgs)
|
||||
|
||||
fun openScreenSharingPermissionDialog(
|
||||
screenCaptureIntent: Intent,
|
||||
activityResultLauncher: ActivityResultLauncher<Intent>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue