mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 18:05:36 +03:00
Upgrade Jitsi library from 2.9.3 to 3.1.0
This commit is contained in:
parent
1b210d42ed
commit
1ec4424c0a
7 changed files with 64 additions and 28 deletions
|
@ -6,6 +6,7 @@ Features ✨:
|
|||
|
||||
Improvements 🙌:
|
||||
- VoIP : new tiles in timeline
|
||||
- Upgrade Jitsi library from 2.9.3 to 3.1.0
|
||||
|
||||
Bugfix 🐛:
|
||||
- VoIP : fix audio devices output
|
||||
|
|
|
@ -58,9 +58,9 @@ allprojects {
|
|||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||
// Jitsi repo
|
||||
maven {
|
||||
url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-2.9.3"
|
||||
url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-3.1.0"
|
||||
// Note: to test Jitsi release you can use a local file like this:
|
||||
// url "file:///Users/bmarty/workspaces/jitsi_libre_maven/android-sdk-2.9.3"
|
||||
// url "file:///Users/bmarty/workspaces/jitsi_libre_maven/android-sdk-3.1.0"
|
||||
}
|
||||
google()
|
||||
jcenter()
|
||||
|
|
|
@ -18,7 +18,7 @@ The generated maven repository is then host in the project https://github.com/ve
|
|||
|
||||
Update the script `./tools/jitsi/build_jisti_libs.sh` with the tag of the project `https://github.com/jitsi/jitsi-meet`.
|
||||
|
||||
Currently we are building the version with the tag `android-sdk-2.9.3`.
|
||||
Currently we are building the version with the tag `android-sdk-3.1.0`.
|
||||
|
||||
### Run the build script
|
||||
|
||||
|
@ -35,21 +35,21 @@ It will build the Jitsi Meet Android library and put every generated files in th
|
|||
- Update the file `./build.gradle` to use the previously created local Maven repository. Currently we have this line:
|
||||
|
||||
```groovy
|
||||
url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-2.9.3"
|
||||
url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-3.1.0"
|
||||
```
|
||||
|
||||
You can uncomment and update the line starting with `// url "file://...` and comment the line starting with `url`, to test the library using the locally generated Maven repository.
|
||||
|
||||
- Update the dependency of the WebRTC library in the file `./matrix-sdk-android/build.gradle`. Currently we have this line:
|
||||
|
||||
```groovy
|
||||
implementation('com.facebook.react:react-native-webrtc:1.84.0-jitsi-5112273@aar')
|
||||
```
|
||||
|
||||
- Update the dependency of the Jitsi Meet library in the file `./vector/build.gradle`. Currently we have this line:
|
||||
|
||||
```groovy
|
||||
implementation('org.jitsi.react:jitsi-meet-sdk:2.9.3') { transitive = true }
|
||||
implementation('org.jitsi.react:jitsi-meet-sdk:3.1.0') { transitive = true }
|
||||
```
|
||||
|
||||
- Update the dependency of the WebRTC library in the file `./vector/build.gradle`. Currently we have this line:
|
||||
|
||||
```groovy
|
||||
implementation('com.facebook.react:react-native-webrtc:1.87.3-jitsi-6624067@aar')
|
||||
```
|
||||
|
||||
- Perform a gradle sync and build the project
|
||||
|
@ -74,9 +74,9 @@ If all the tests are passed, you can export the generated Jitsi library to our M
|
|||
- Update the file `./build.gradle` to use the previously created Maven repository. Currently we have this line:
|
||||
|
||||
```groovy
|
||||
url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-2.9.3"
|
||||
url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-3.1.0"
|
||||
```
|
||||
|
||||
- Build the project and perform the sanity tests again.
|
||||
|
||||
- Update the file `/CANGES.md` to notify about the library upgrade, and create a regular PR for project Element Android.
|
||||
- Update the file `/CHANGES.md` to notify about the library upgrade, and create a regular PR for project Element Android.
|
|
@ -25,8 +25,8 @@ cd jitsi-meet
|
|||
# This is commit after version 2.2.2, which does not compile
|
||||
# git checkout 5a934c071a5cbe64de275a25d0ed62d8193cdd03
|
||||
|
||||
# Version android-sdk-2.9.3, commit abcbbbea12e3ef88012b14723bb8cd42dbefc988
|
||||
git checkout android-sdk-2.9.3
|
||||
# Version android-sdk-3.1.0, commit 7a64bf006ea027b77564d8847570e1ac46ff0ec0
|
||||
git checkout android-sdk-3.1.0
|
||||
|
||||
echo
|
||||
echo "##################################################"
|
||||
|
|
|
@ -435,7 +435,9 @@ dependencies {
|
|||
// WebRTC
|
||||
// org.webrtc:google-webrtc is for development purposes only
|
||||
// implementation 'org.webrtc:google-webrtc:1.0.+'
|
||||
implementation('org.jitsi.react:jitsi-meet-sdk:2.9.3') { transitive = true }
|
||||
implementation('org.jitsi.react:jitsi-meet-sdk:3.1.0') { transitive = true }
|
||||
// Transitive dependency from Jitsi, but explicitly declare it
|
||||
implementation('com.facebook.react:react-native-webrtc:1.87.3-jitsi-6624067@aar')
|
||||
|
||||
// QR-code
|
||||
// Stick to 3.3.3 because of https://github.com/zxing/zxing/issues/1170
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
android:name="android.permission.WRITE_CALENDAR"
|
||||
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"/>
|
||||
|
||||
<!-- Adding CAMERA permission prevents Chromebooks to see the application on the PlayStore -->
|
||||
<!-- Tell that the Camera is not mandatory to install the application -->
|
||||
<uses-feature
|
||||
|
|
|
@ -16,12 +16,15 @@
|
|||
|
||||
package im.vector.app.features.call.conference
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import com.airbnb.mvrx.Fail
|
||||
import com.airbnb.mvrx.MvRx
|
||||
import com.airbnb.mvrx.Success
|
||||
|
@ -31,17 +34,17 @@ import im.vector.app.core.di.ScreenComponent
|
|||
import im.vector.app.core.platform.VectorBaseActivity
|
||||
import im.vector.app.databinding.ActivityJitsiBinding
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import org.jitsi.meet.sdk.BroadcastEvent
|
||||
import org.jitsi.meet.sdk.JitsiMeetActivityDelegate
|
||||
import org.jitsi.meet.sdk.JitsiMeetActivityInterface
|
||||
import org.jitsi.meet.sdk.JitsiMeetConferenceOptions
|
||||
import org.jitsi.meet.sdk.JitsiMeetView
|
||||
import org.jitsi.meet.sdk.JitsiMeetViewListener
|
||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||
import timber.log.Timber
|
||||
import java.net.URL
|
||||
import javax.inject.Inject
|
||||
|
||||
class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMeetActivityInterface, JitsiMeetViewListener {
|
||||
class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMeetActivityInterface {
|
||||
|
||||
@Parcelize
|
||||
data class Args(
|
||||
|
@ -63,12 +66,21 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
|||
injector.inject(this)
|
||||
}
|
||||
|
||||
// See https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-android-sdk#listening-for-broadcasted-events
|
||||
private val broadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
intent?.let { onBroadcastReceived(it) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
jitsiViewModel.subscribe(this) {
|
||||
renderState(it)
|
||||
}
|
||||
|
||||
registerForBroadcastMessages()
|
||||
}
|
||||
|
||||
override fun initUiAndData() {
|
||||
|
@ -76,7 +88,6 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
|||
jitsiMeetView = JitsiMeetView(this)
|
||||
val params = FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)
|
||||
views.jitsiLayout.addView(jitsiMeetView, params)
|
||||
jitsiMeetView?.listener = this
|
||||
}
|
||||
|
||||
private fun renderState(viewState: JitsiCallViewState) {
|
||||
|
@ -132,6 +143,7 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
|||
|
||||
override fun onDestroy() {
|
||||
JitsiMeetActivityDelegate.onHostDestroy(this)
|
||||
unregisterForBroadcastMessages()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
|
@ -154,21 +166,39 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
|
|||
JitsiMeetActivityDelegate.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
}
|
||||
|
||||
override fun onConferenceTerminated(p0: MutableMap<String, Any>?) {
|
||||
private fun registerForBroadcastMessages() {
|
||||
val intentFilter = IntentFilter()
|
||||
for (type in BroadcastEvent.Type.values()) {
|
||||
intentFilter.addAction(type.action)
|
||||
}
|
||||
tryOrNull("Unable to register receiver") {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, intentFilter)
|
||||
}
|
||||
}
|
||||
|
||||
private fun unregisterForBroadcastMessages() {
|
||||
tryOrNull("Unable to unregister receiver") {
|
||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(broadcastReceiver)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onBroadcastReceived(intent: Intent) {
|
||||
val event = BroadcastEvent(intent)
|
||||
Timber.v("Broadcast received: ${event.type}")
|
||||
when (event.type) {
|
||||
BroadcastEvent.Type.CONFERENCE_TERMINATED -> onConferenceTerminated(event.data)
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
private fun onConferenceTerminated(data: Map<String, Any>) {
|
||||
Timber.v("JitsiMeetViewListener.onConferenceTerminated()")
|
||||
// Do not finish if there is an error
|
||||
if (p0?.get("error") == null) {
|
||||
if (data["error"] == null) {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onConferenceJoined(p0: MutableMap<String, Any>?) {
|
||||
Timber.v("JitsiMeetViewListener.onConferenceJoined()")
|
||||
}
|
||||
|
||||
override fun onConferenceWillJoin(p0: MutableMap<String, Any>?) {
|
||||
Timber.v("JitsiMeetViewListener.onConferenceWillJoin()")
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newIntent(context: Context, roomId: String, widgetId: String, enableVideo: Boolean): Intent {
|
||||
|
|
Loading…
Reference in a new issue