mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Pip
This commit is contained in:
parent
9db644afa2
commit
486815b9ab
6 changed files with 79 additions and 58 deletions
|
@ -7,6 +7,7 @@ Features ✨:
|
|||
Improvements 🙌:
|
||||
- Fetch homeserver type and version and display in a new setting screen and add info in rageshakes (#2831)
|
||||
- Improve initial sync performance (#983)
|
||||
- PIP support for Jitsi call (#2418)
|
||||
|
||||
Bugfix 🐛:
|
||||
-
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
tools:node="remove" />
|
||||
|
||||
<!-- Jitsi SDK is now API23+ -->
|
||||
<uses-sdk tools:overrideLibrary="org.jitsi.meet.sdk,com.oney.WebRTCModule,com.learnium.RNDeviceInfo,com.reactnativecommunity.asyncstorage,com.ocetnik.timer,com.calendarevents,com.reactnativecommunity.netinfo,com.kevinresol.react_native_default_preference,com.rnimmersive,com.corbt.keepawake,com.BV.LinearGradient,com.horcrux.svg"/>
|
||||
<uses-sdk tools:overrideLibrary="org.jitsi.meet.sdk,com.oney.WebRTCModule,com.learnium.RNDeviceInfo,com.reactnativecommunity.asyncstorage,com.ocetnik.timer,com.calendarevents,com.reactnativecommunity.netinfo,com.kevinresol.react_native_default_preference,com.rnimmersive,com.corbt.keepawake,com.BV.LinearGradient,com.horcrux.svg" />
|
||||
|
||||
<!-- Adding CAMERA permission prevents Chromebooks to see the application on the PlayStore -->
|
||||
<!-- Tell that the Camera is not mandatory to install the application -->
|
||||
|
@ -83,8 +83,7 @@
|
|||
android:resource="@xml/shortcuts" />
|
||||
</activity-alias>
|
||||
|
||||
<activity
|
||||
android:name=".features.home.HomeActivity" />
|
||||
<activity android:name=".features.home.HomeActivity" />
|
||||
<activity
|
||||
android:name=".features.login.LoginActivity"
|
||||
android:launchMode="singleTask"
|
||||
|
@ -233,11 +232,14 @@
|
|||
<activity
|
||||
android:name=".features.attachments.preview.AttachmentsPreviewActivity"
|
||||
android:theme="@style/AppTheme.AttachmentsPreview" />
|
||||
<activity android:name=".features.call.VectorCallActivity"
|
||||
android:excludeFromRecents="true"/>
|
||||
<activity
|
||||
android:name=".features.call.VectorCallActivity"
|
||||
android:excludeFromRecents="true" />
|
||||
<activity
|
||||
android:name=".features.call.conference.VectorJitsiActivity"
|
||||
android:configChanges="orientation|screenSize" />
|
||||
android:configChanges="orientation|smallestScreenSize|screenLayout|screenSize"
|
||||
android:resizeableActivity="true"
|
||||
android:supportsPictureInPicture="true" />
|
||||
|
||||
<activity android:name=".features.terms.ReviewTermsActivity" />
|
||||
<activity android:name=".features.widgets.WidgetActivity" />
|
||||
|
@ -247,27 +249,28 @@
|
|||
<activity android:name=".features.call.transfer.CallTransferActivity" />
|
||||
|
||||
<!-- Single instance is very important for the custom scheme callback-->
|
||||
<activity android:name=".features.auth.ReAuthActivity"
|
||||
android:launchMode="singleInstance"
|
||||
android:exported="false">
|
||||
<activity
|
||||
android:name=".features.auth.ReAuthActivity"
|
||||
android:exported="false"
|
||||
android:launchMode="singleInstance">
|
||||
|
||||
<!-- XXX: UIA SSO has only web fallback, i.e no url redirect, so for now we comment this out
|
||||
hopefully, we would use it when finally available
|
||||
-->
|
||||
<!-- Add intent filter to handle redirection URL after SSO login in external browser -->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.VIEW" />-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.VIEW" />-->
|
||||
|
||||
<!-- <category android:name="android.intent.category.DEFAULT" />-->
|
||||
<!-- <category android:name="android.intent.category.BROWSABLE" />-->
|
||||
<!-- <category android:name="android.intent.category.DEFAULT" />-->
|
||||
<!-- <category android:name="android.intent.category.BROWSABLE" />-->
|
||||
|
||||
<!-- <data-->
|
||||
<!-- android:host="reauth"-->
|
||||
<!-- android:scheme="element" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- <data-->
|
||||
<!-- android:host="reauth"-->
|
||||
<!-- android:scheme="element" />-->
|
||||
<!-- </intent-filter>-->
|
||||
</activity>
|
||||
|
||||
<activity android:name=".features.devtools.RoomDevToolActivity"/>
|
||||
<activity android:name=".features.devtools.RoomDevToolActivity" />
|
||||
<!-- Services -->
|
||||
|
||||
<service
|
||||
|
|
|
@ -17,5 +17,14 @@
|
|||
package im.vector.app.features.call.conference
|
||||
|
||||
import im.vector.app.core.platform.VectorViewEvents
|
||||
import org.jitsi.meet.sdk.JitsiMeetUserInfo
|
||||
|
||||
sealed class JitsiCallViewEvents : VectorViewEvents
|
||||
sealed class JitsiCallViewEvents : VectorViewEvents {
|
||||
data class StartConference(
|
||||
val enableVideo: Boolean,
|
||||
val jitsiUrl: String,
|
||||
val subject: String,
|
||||
val confId: String,
|
||||
val userInfo: JitsiMeetUserInfo
|
||||
) : JitsiCallViewEvents()
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import im.vector.app.features.themes.ThemeProvider
|
|||
import org.jitsi.meet.sdk.JitsiMeetUserInfo
|
||||
import org.matrix.android.sdk.api.query.QueryStringValue
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
import org.matrix.android.sdk.api.session.widgets.model.Widget
|
||||
import org.matrix.android.sdk.api.session.widgets.model.WidgetType
|
||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||
import org.matrix.android.sdk.rx.asObservable
|
||||
|
@ -35,7 +36,7 @@ import java.net.URL
|
|||
|
||||
class JitsiCallViewModel @AssistedInject constructor(
|
||||
@Assisted initialState: JitsiCallViewState,
|
||||
@Assisted val args: VectorJitsiActivity.Args,
|
||||
@Assisted private val args: VectorJitsiActivity.Args,
|
||||
private val session: Session,
|
||||
private val jitsiMeetPropertiesFactory: JitsiWidgetPropertiesFactory,
|
||||
private val themeProvider: ThemeProvider
|
||||
|
@ -48,33 +49,22 @@ class JitsiCallViewModel @AssistedInject constructor(
|
|||
|
||||
private val widgetService = session.widgetService()
|
||||
|
||||
private var confIsStarted = false
|
||||
|
||||
init {
|
||||
val me = session.getRoomMember(session.myUserId, args.roomId)?.toMatrixItem()
|
||||
val userInfo = JitsiMeetUserInfo().apply {
|
||||
displayName = me?.getBestName()
|
||||
avatar = me?.avatarUrl?.let { session.contentUrlResolver().resolveFullSize(it) }?.let { URL(it) }
|
||||
}
|
||||
val roomName = session.getRoomSummary(args.roomId)?.displayName
|
||||
|
||||
setState {
|
||||
copy(userInfo = userInfo)
|
||||
}
|
||||
|
||||
widgetService.getRoomWidgetsLive(args.roomId, QueryStringValue.Equals(args.widgetId), WidgetType.Jitsi.values())
|
||||
.asObservable()
|
||||
.distinctUntilChanged()
|
||||
.subscribe {
|
||||
val jitsiWidget = it.firstOrNull()
|
||||
if (jitsiWidget != null) {
|
||||
val ppt = widgetService.getWidgetComputedUrl(jitsiWidget, themeProvider.isLightTheme())
|
||||
?.let { url -> jitsiMeetPropertiesFactory.create(url) }
|
||||
setState {
|
||||
copy(
|
||||
widget = Success(jitsiWidget),
|
||||
jitsiUrl = "https://${ppt?.domain}",
|
||||
confId = ppt?.confId ?: "",
|
||||
subject = roomName ?: ""
|
||||
)
|
||||
copy(widget = Success(jitsiWidget))
|
||||
}
|
||||
|
||||
if (!confIsStarted) {
|
||||
confIsStarted = true
|
||||
startConference(jitsiWidget)
|
||||
}
|
||||
} else {
|
||||
setState {
|
||||
|
@ -87,6 +77,26 @@ class JitsiCallViewModel @AssistedInject constructor(
|
|||
.disposeOnClear()
|
||||
}
|
||||
|
||||
private fun startConference(jitsiWidget: Widget) {
|
||||
val me = session.getRoomMember(session.myUserId, args.roomId)?.toMatrixItem()
|
||||
val userInfo = JitsiMeetUserInfo().apply {
|
||||
displayName = me?.getBestName()
|
||||
avatar = me?.avatarUrl?.let { session.contentUrlResolver().resolveFullSize(it) }?.let { URL(it) }
|
||||
}
|
||||
val roomName = session.getRoomSummary(args.roomId)?.displayName
|
||||
|
||||
val ppt = widgetService.getWidgetComputedUrl(jitsiWidget, themeProvider.isLightTheme())
|
||||
?.let { url -> jitsiMeetPropertiesFactory.create(url) }
|
||||
|
||||
_viewEvents.post(JitsiCallViewEvents.StartConference(
|
||||
enableVideo = args.enableVideo,
|
||||
jitsiUrl = "https://${ppt?.domain}",
|
||||
subject = roomName ?: "",
|
||||
confId = ppt?.confId ?: "",
|
||||
userInfo = userInfo
|
||||
))
|
||||
}
|
||||
|
||||
override fun handle(action: JitsiCallViewActions) {
|
||||
}
|
||||
|
||||
|
@ -106,8 +116,7 @@ class JitsiCallViewModel @AssistedInject constructor(
|
|||
|
||||
return JitsiCallViewState(
|
||||
roomId = args.roomId,
|
||||
widgetId = args.widgetId,
|
||||
enableVideo = args.enableVideo
|
||||
widgetId = args.widgetId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,16 +19,10 @@ package im.vector.app.features.call.conference
|
|||
import com.airbnb.mvrx.Async
|
||||
import com.airbnb.mvrx.MvRxState
|
||||
import com.airbnb.mvrx.Uninitialized
|
||||
import org.jitsi.meet.sdk.JitsiMeetUserInfo
|
||||
import org.matrix.android.sdk.api.session.widgets.model.Widget
|
||||
|
||||
data class JitsiCallViewState(
|
||||
val roomId: String = "",
|
||||
val widgetId: String = "",
|
||||
val enableVideo: Boolean = true,
|
||||
val jitsiUrl: String = "",
|
||||
val subject: String = "",
|
||||
val confId: String = "",
|
||||
val userInfo: JitsiMeetUserInfo = JitsiMeetUserInfo(),
|
||||
val widget: Async<Widget> = Uninitialized
|
||||
) : MvRxState
|
||||
|
|
|
@ -80,6 +80,12 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
|||
renderState(it)
|
||||
}
|
||||
|
||||
jitsiViewModel.observeViewEvents {
|
||||
when(it) {
|
||||
is JitsiCallViewEvents.StartConference -> configureJitsiView(it)
|
||||
}
|
||||
}
|
||||
|
||||
registerForBroadcastMessages()
|
||||
}
|
||||
|
||||
|
@ -96,7 +102,6 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
|||
is Success -> {
|
||||
views.jitsiProgressLayout.isVisible = false
|
||||
jitsiMeetView?.isVisible = true
|
||||
configureJitsiView(viewState)
|
||||
}
|
||||
else -> {
|
||||
jitsiMeetView?.isVisible = false
|
||||
|
@ -105,12 +110,12 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
|||
}
|
||||
}
|
||||
|
||||
private fun configureJitsiView(viewState: JitsiCallViewState) {
|
||||
private fun configureJitsiView(startConference: JitsiCallViewEvents.StartConference) {
|
||||
val jitsiMeetConferenceOptions = JitsiMeetConferenceOptions.Builder()
|
||||
.setVideoMuted(!viewState.enableVideo)
|
||||
.setUserInfo(viewState.userInfo)
|
||||
.setVideoMuted(!startConference.enableVideo)
|
||||
.setUserInfo(startConference.userInfo)
|
||||
.apply {
|
||||
tryOrNull { URL(viewState.jitsiUrl) }?.let {
|
||||
tryOrNull { URL(startConference.jitsiUrl) }?.let {
|
||||
setServerURL(it)
|
||||
}
|
||||
}
|
||||
|
@ -120,8 +125,8 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
|||
.setFeatureFlag("add-people.enabled", false)
|
||||
.setFeatureFlag("video-share.enabled", false)
|
||||
.setFeatureFlag("call-integration.enabled", false)
|
||||
.setRoom(viewState.confId)
|
||||
.setSubject(viewState.subject)
|
||||
.setRoom(startConference.confId)
|
||||
.setSubject(startConference.subject)
|
||||
.build()
|
||||
jitsiMeetView?.join(jitsiMeetConferenceOptions)
|
||||
}
|
||||
|
@ -147,10 +152,10 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
|||
super.onDestroy()
|
||||
}
|
||||
|
||||
// override fun onUserLeaveHint() {
|
||||
// super.onUserLeaveHint()
|
||||
// jitsiMeetView?.enterPictureInPicture()
|
||||
// }
|
||||
override fun onUserLeaveHint() {
|
||||
super.onUserLeaveHint()
|
||||
jitsiMeetView?.enterPictureInPicture()
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
JitsiMeetActivityDelegate.onNewIntent(intent)
|
||||
|
|
Loading…
Reference in a new issue