mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
Open element call widget.
This commit is contained in:
parent
f5ec7a312f
commit
fd3b082a2c
4 changed files with 15 additions and 0 deletions
|
@ -84,4 +84,5 @@ sealed class RoomDetailViewEvents : VectorViewEvents {
|
||||||
data class StartChatEffect(val type: ChatEffect) : RoomDetailViewEvents()
|
data class StartChatEffect(val type: ChatEffect) : RoomDetailViewEvents()
|
||||||
object StopChatEffects : RoomDetailViewEvents()
|
object StopChatEffects : RoomDetailViewEvents()
|
||||||
object RoomReplacementStarted : RoomDetailViewEvents()
|
object RoomReplacementStarted : RoomDetailViewEvents()
|
||||||
|
object OpenElementCallWidget : RoomDetailViewEvents()
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,8 @@ data class RoomDetailViewState(
|
||||||
// It can differs for a short period of time on the JitsiState as its computed async.
|
// It can differs for a short period of time on the JitsiState as its computed async.
|
||||||
fun hasActiveJitsiWidget() = activeRoomWidgets()?.any { it.type == WidgetType.Jitsi && it.isActive }.orFalse()
|
fun hasActiveJitsiWidget() = activeRoomWidgets()?.any { it.type == WidgetType.Jitsi && it.isActive }.orFalse()
|
||||||
|
|
||||||
|
fun hasActiveElementCallWidget() = activeRoomWidgets()?.any { it.type == WidgetType.ElementCall && it.isActive }.orFalse()
|
||||||
|
|
||||||
fun isDm() = asyncRoomSummary()?.isDirect == true
|
fun isDm() = asyncRoomSummary()?.isDirect == true
|
||||||
|
|
||||||
fun isThreadTimeline() = rootThreadEventId != null
|
fun isThreadTimeline() = rootThreadEventId != null
|
||||||
|
|
|
@ -498,6 +498,7 @@ class TimelineFragment @Inject constructor(
|
||||||
RoomDetailViewEvents.StopChatEffects -> handleStopChatEffects()
|
RoomDetailViewEvents.StopChatEffects -> handleStopChatEffects()
|
||||||
is RoomDetailViewEvents.DisplayAndAcceptCall -> acceptIncomingCall(it)
|
is RoomDetailViewEvents.DisplayAndAcceptCall -> acceptIncomingCall(it)
|
||||||
RoomDetailViewEvents.RoomReplacementStarted -> handleRoomReplacement()
|
RoomDetailViewEvents.RoomReplacementStarted -> handleRoomReplacement()
|
||||||
|
RoomDetailViewEvents.OpenElementCallWidget -> handleOpenElementCallWidget()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2653,6 +2654,15 @@ class TimelineFragment @Inject constructor(
|
||||||
.show(childFragmentManager, "ROOM_WIDGETS_BOTTOM_SHEET")
|
.show(childFragmentManager, "ROOM_WIDGETS_BOTTOM_SHEET")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun handleOpenElementCallWidget() = withState(timelineViewModel) { state ->
|
||||||
|
state
|
||||||
|
.activeRoomWidgets()
|
||||||
|
?.find { it.type == WidgetType.ElementCall }
|
||||||
|
?.also { widget ->
|
||||||
|
navigator.openRoomWidget(requireContext(), state.roomId, widget)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onTapToReturnToCall() {
|
override fun onTapToReturnToCall() {
|
||||||
callManager.getCurrentCall()?.let { call ->
|
callManager.getCurrentCall()?.let { call ->
|
||||||
VectorCallActivity.newIntent(
|
VectorCallActivity.newIntent(
|
||||||
|
|
|
@ -58,6 +58,8 @@ fun WebView.setupForWidget(activity: Activity, eventListener: WebEventListener)
|
||||||
|
|
||||||
settings.displayZoomControls = false
|
settings.displayZoomControls = false
|
||||||
|
|
||||||
|
settings.mediaPlaybackRequiresUserGesture = false
|
||||||
|
|
||||||
// Permission requests
|
// Permission requests
|
||||||
webChromeClient = object : WebChromeClient() {
|
webChromeClient = object : WebChromeClient() {
|
||||||
override fun onPermissionRequest(request: PermissionRequest) {
|
override fun onPermissionRequest(request: PermissionRequest) {
|
||||||
|
|
Loading…
Reference in a new issue