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)
|
callViewModel.handle(VectorCallViewActions.InitiateCallTransfer)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
views.callControlsShareScreen.views.bottomSheetActionClickableZone.debouncedClicks {
|
||||||
|
callViewModel.handle(VectorCallViewActions.InitiateScreenSharing)
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderState(state: VectorCallViewState) {
|
private fun renderState(state: VectorCallViewState) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import android.content.Intent
|
||||||
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP
|
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
import android.media.projection.MediaProjectionManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
|
@ -525,6 +526,7 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
||||||
navigator.openCallTransfer(this, callTransferActivityResultLauncher, callId)
|
navigator.openCallTransfer(this, callTransferActivityResultLauncher, callId)
|
||||||
}
|
}
|
||||||
is VectorCallViewEvents.FailToTransfer -> showSnackbar(getString(R.string.call_transfer_failure))
|
is VectorCallViewEvents.FailToTransfer -> showSnackbar(getString(R.string.call_transfer_failure))
|
||||||
|
is VectorCallViewEvents.ShowScreenSharingPermissionDialog -> handleShowScreenSharingPermissionDialog()
|
||||||
else -> Unit
|
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 {
|
companion object {
|
||||||
private const val EXTRA_MODE = "EXTRA_MODE"
|
private const val EXTRA_MODE = "EXTRA_MODE"
|
||||||
private const val FRAGMENT_DIAL_PAD_TAG = "FRAGMENT_DIAL_PAD_TAG"
|
private const val FRAGMENT_DIAL_PAD_TAG = "FRAGMENT_DIAL_PAD_TAG"
|
||||||
|
|
|
@ -40,4 +40,6 @@ sealed class VectorCallViewActions : VectorViewModelAction {
|
||||||
object CallTransferSelectionCancelled : VectorCallViewActions()
|
object CallTransferSelectionCancelled : VectorCallViewActions()
|
||||||
data class CallTransferSelectionResult(val callTransferResult: CallTransferResult) : VectorCallViewActions()
|
data class CallTransferSelectionResult(val callTransferResult: CallTransferResult) : VectorCallViewActions()
|
||||||
object TransferCall : VectorCallViewActions()
|
object TransferCall : VectorCallViewActions()
|
||||||
|
object InitiateScreenSharing : VectorCallViewActions()
|
||||||
|
object StartScreenSharing : VectorCallViewActions()
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ sealed class VectorCallViewEvents : VectorViewEvents {
|
||||||
object ShowDialPad : VectorCallViewEvents()
|
object ShowDialPad : VectorCallViewEvents()
|
||||||
object ShowCallTransferScreen : VectorCallViewEvents()
|
object ShowCallTransferScreen : VectorCallViewEvents()
|
||||||
object FailToTransfer : VectorCallViewEvents()
|
object FailToTransfer : VectorCallViewEvents()
|
||||||
|
object ShowScreenSharingPermissionDialog : VectorCallViewEvents()
|
||||||
// data class CallAnswered(val content: CallAnswerContent) : VectorCallViewEvents()
|
// data class CallAnswered(val content: CallAnswerContent) : VectorCallViewEvents()
|
||||||
// data class CallHangup(val content: CallHangupContent) : VectorCallViewEvents()
|
// data class CallHangup(val content: CallHangupContent) : VectorCallViewEvents()
|
||||||
// object CallAccepted : VectorCallViewEvents()
|
// object CallAccepted : VectorCallViewEvents()
|
||||||
|
|
|
@ -341,6 +341,14 @@ class VectorCallViewModel @AssistedInject constructor(
|
||||||
setState { VectorCallViewState(action.callArgs) }
|
setState { VectorCallViewState(action.callArgs) }
|
||||||
setupCallWithCurrentState()
|
setupCallWithCurrentState()
|
||||||
}
|
}
|
||||||
|
is VectorCallViewActions.InitiateScreenSharing -> {
|
||||||
|
_viewEvents.post(
|
||||||
|
VectorCallViewEvents.ShowScreenSharingPermissionDialog
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is VectorCallViewActions.StartScreenSharing -> {
|
||||||
|
call?.shareScreen()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -770,6 +770,10 @@ class WebRtcCall(
|
||||||
return currentCaptureFormat
|
return currentCaptureFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun shareScreen() {
|
||||||
|
// TODO. Will be handled within the next PR.
|
||||||
|
}
|
||||||
|
|
||||||
private suspend fun release() {
|
private suspend fun release() {
|
||||||
listeners.clear()
|
listeners.clear()
|
||||||
mxCall.removeListener(this)
|
mxCall.removeListener(this)
|
||||||
|
|
|
@ -600,4 +600,9 @@ class DefaultNavigator @Inject constructor(
|
||||||
roomEncryptionTrustLevel = threadTimelineArgs.roomEncryptionTrustLevel
|
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 openThread(context: Context, threadTimelineArgs: ThreadTimelineArgs, eventIdToNavigate: String? = null)
|
||||||
|
|
||||||
fun openThreadList(context: Context, threadTimelineArgs: ThreadTimelineArgs)
|
fun openThreadList(context: Context, threadTimelineArgs: ThreadTimelineArgs)
|
||||||
|
|
||||||
|
fun openScreenSharingPermissionDialog(
|
||||||
|
screenCaptureIntent: Intent,
|
||||||
|
activityResultLauncher: ActivityResultLauncher<Intent>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue