From d4b34274935de45ca112a72fadf41a9494984b04 Mon Sep 17 00:00:00 2001 From: Filipe de Lima Brito <filipedelimabrito@gmail.com> Date: Thu, 18 Apr 2019 12:51:16 -0300 Subject: [PATCH] Update VideoConferenceActivity.kt and jitsi version --- .../ui/VideoConferenceActivity.kt | 28 ++++++++----------- dependencies.gradle | 2 +- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/chat/rocket/android/videoconference/ui/VideoConferenceActivity.kt b/app/src/main/java/chat/rocket/android/videoconference/ui/VideoConferenceActivity.kt index 3cf9df6f3..94e9a5704 100644 --- a/app/src/main/java/chat/rocket/android/videoconference/ui/VideoConferenceActivity.kt +++ b/app/src/main/java/chat/rocket/android/videoconference/ui/VideoConferenceActivity.kt @@ -24,8 +24,7 @@ private const val INTENT_CHAT_ROOM_TYPE = "chat_room_type" class VideoConferenceActivity : JitsiMeetActivity(), JitsiVideoConferenceView, JitsiMeetViewListener { - @Inject - lateinit var presenter: VideoConferencePresenter + @Inject lateinit var presenter: VideoConferencePresenter private lateinit var chatRoomId: String private lateinit var chatRoomType: String private var view: JitsiMeetView? = null @@ -35,9 +34,7 @@ class VideoConferenceActivity : JitsiMeetActivity(), JitsiVideoConferenceView, super.onCreate(savedInstanceState) chatRoomId = intent.getStringExtra(INTENT_CHAT_ROOM_ID) - requireNotNull(chatRoomId) { "no chat_room_id provided in Intent extras" } chatRoomType = intent.getStringExtra(INTENT_CHAT_ROOM_TYPE) - requireNotNull(chatRoomType) { "no chat_room_type provided in Intent extras" } view = JitsiMeetView(this) view?.listener = this @@ -54,26 +51,23 @@ class VideoConferenceActivity : JitsiMeetActivity(), JitsiVideoConferenceView, logJitsiMeetViewState("Joined video conferencing", map) override fun onConferenceTerminated(map: MutableMap<String, Any>?) { - if(!map.isNullOrEmpty()){ - if(map.containsKey("error")) { + map?.let { + if (it.containsKey("error")) { logJitsiMeetViewState("Terminated video conferencing with error", map) - } - else{ + } else { logJitsiMeetViewState("Terminated video conferencing", map) - finishJitsiVideoConference() } } + finishJitsiVideoConference() } override fun startJitsiVideoConference(url: String, name: String?) { - var options = JitsiMeetConferenceOptions.Builder() - .setAudioMuted(true) - .setVideoMuted(true) - .setServerURL(URL(url)) - .setAudioOnly(false) - .build() - - view?.join(options) + JitsiMeetConferenceOptions.Builder() + .setAudioMuted(true) + .setVideoMuted(true) + .setServerURL(URL(url)) + .setAudioOnly(false) + .build().let { view?.join(it) } } override fun finishJitsiVideoConference() { diff --git a/dependencies.gradle b/dependencies.gradle index b30ff64e5..1d5ea6347 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -56,7 +56,7 @@ ext { glide : '4.8.0', glideTransformations : '4.0.0', - jitsi : '+', // TODO Avoid using + (https://github.com/jitsi/jitsi-meet/issues/3987) + jitsi : '2.1.0', // For testing junit : '4.12', -- 2.21.0