@@ -19,6 +19,7 @@ package im.vector.app.features.call.conference
19
19
import android.content.Context
20
20
import android.content.Intent
21
21
import android.content.pm.PackageManager
22
+ import android.content.res.Configuration
22
23
import android.os.Build
23
24
import android.os.Bundle
24
25
import android.os.Parcelable
@@ -46,6 +47,7 @@ import org.jitsi.meet.sdk.JitsiMeet
46
47
import org.jitsi.meet.sdk.JitsiMeetActivityDelegate
47
48
import org.jitsi.meet.sdk.JitsiMeetActivityInterface
48
49
import org.jitsi.meet.sdk.JitsiMeetConferenceOptions
50
+ import org.jitsi.meet.sdk.JitsiMeetOngoingConferenceService
49
51
import org.jitsi.meet.sdk.JitsiMeetView
50
52
import org.matrix.android.sdk.api.extensions.tryOrNull
51
53
import org.matrix.android.sdk.api.util.JsonDict
@@ -68,6 +70,13 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
68
70
69
71
private val jitsiViewModel: JitsiCallViewModel by viewModel()
70
72
73
+ override fun onConfigurationChanged (newConfig : Configuration ) {
74
+ super .onConfigurationChanged(newConfig)
75
+ val intent = Intent (" onConfigurationChanged" )
76
+ intent.putExtra(" newConfig" , newConfig)
77
+ this .sendBroadcast(intent)
78
+ }
79
+
71
80
override fun onCreate (savedInstanceState : Bundle ? ) {
72
81
super .onCreate(savedInstanceState)
73
82
addOnPictureInPictureModeChangedListener(pictureInPictureModeChangedInfoConsumer)
@@ -107,16 +116,26 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
107
116
108
117
override fun onDestroy () {
109
118
val currentConf = JitsiMeet .getCurrentConference()
119
+ handleLeaveConference()
110
120
jitsiMeetView?.dispose()
111
121
// Fake emitting CONFERENCE_TERMINATED event when currentConf is not null (probably when closing the PiP screen).
112
122
if (currentConf != null ) {
113
123
ConferenceEventEmitter (this ).emitConferenceEnded()
114
124
}
125
+ JitsiMeetOngoingConferenceService .abort(this )
115
126
JitsiMeetActivityDelegate .onHostDestroy(this )
116
127
removeOnPictureInPictureModeChangedListener(pictureInPictureModeChangedInfoConsumer)
117
128
super .onDestroy()
118
129
}
119
130
131
+ // Activity lifecycle methods
132
+ //
133
+ override fun onActivityResult (requestCode : Int , resultCode : Int , data : Intent ? ) {
134
+ @Suppress(" DEPRECATION" )
135
+ super .onActivityResult(requestCode, resultCode, data)
136
+ JitsiMeetActivityDelegate .onActivityResult(this , requestCode, resultCode, data)
137
+ }
138
+
120
139
override fun onBackPressed () {
121
140
JitsiMeetActivityDelegate .onBackPressed()
122
141
}
@@ -224,10 +243,17 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
224
243
Timber .v(" Broadcast received: $event " )
225
244
when (event) {
226
245
is ConferenceEvent .Terminated -> onConferenceTerminated(event.data)
227
- else -> Unit
246
+ is ConferenceEvent .Joined -> onConferenceJoined(event.data)
247
+ is ConferenceEvent .ReadyToClose -> onReadyToClose()
248
+ is ConferenceEvent .WillJoin -> Unit
228
249
}
229
250
}
230
251
252
+ private fun onConferenceJoined (extraData : Map <String , Any >) {
253
+ // Launch the service for the ongoing notification.
254
+ JitsiMeetOngoingConferenceService .launch(this , HashMap (extraData))
255
+ }
256
+
231
257
private fun onConferenceTerminated (data : JsonDict ) {
232
258
Timber .v(" JitsiMeetViewListener.onConferenceTerminated()" )
233
259
// Do not finish if there is an error
@@ -236,6 +262,11 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
236
262
}
237
263
}
238
264
265
+ private fun onReadyToClose () {
266
+ Timber .v(" SDK is ready to close" )
267
+ finish()
268
+ }
269
+
239
270
companion object {
240
271
fun newIntent (context : Context , roomId : String , widgetId : String , enableVideo : Boolean ): Intent {
241
272
return Intent (context, VectorJitsiActivity ::class .java).apply {
0 commit comments