Jitsi conf: show join button

This commit is contained in:
ganfra 2021-07-27 16:41:23 +02:00
parent 1f3da38eb0
commit e259b44449
5 changed files with 34 additions and 5 deletions

View File

@ -64,6 +64,7 @@ import com.airbnb.mvrx.MvRx
import com.airbnb.mvrx.args
import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState
import com.google.android.material.button.MaterialButton
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.jakewharton.rxbinding3.view.focusChanges
import com.jakewharton.rxbinding3.widget.textChanges
@ -806,6 +807,10 @@ class RoomDetailFragment @Inject constructor(
onOptionsItemSelected(menuItem)
}
}
val joinConfItem = menu.findItem(R.id.join_conference)
joinConfItem.actionView.findViewById<MaterialButton>(R.id.join_conference_button).setOnClickListener {
roomDetailViewModel.handle(RoomDetailAction.JoinJitsiCall)
}
}
override fun onPrepareOptionsMenu(menu: Menu) {
@ -814,7 +819,7 @@ class RoomDetailFragment @Inject constructor(
}
withState(roomDetailViewModel) { state ->
// Set the visual state of the call buttons (voice/video) to enabled/disabled according to user permissions
val hasCallInRoom = callManager.getCallsByRoomId(state.roomId).isNotEmpty()
val hasCallInRoom = callManager.getCallsByRoomId(state.roomId).isNotEmpty() || state.jitsiState.hasJoined
val callButtonsEnabled = !hasCallInRoom && when (state.asyncRoomSummary.invoke()?.joinedMembersCount) {
1 -> false
2 -> state.isAllowedToStartWebRTCCall

View File

@ -60,7 +60,6 @@ import io.reactivex.Observable
import io.reactivex.rxkotlin.subscribeBy
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.commonmark.parser.Parser
@ -684,7 +683,8 @@ class RoomDetailViewModel @AssistedInject constructor(
R.id.invite -> state.canInvite
R.id.open_matrix_apps -> true
R.id.voice_call -> state.isWebRTCCallOptionAvailable()
R.id.video_call -> true
R.id.video_call -> state.isWebRTCCallOptionAvailable() || state.jitsiState.widgetId == null || state.jitsiState.hasJoined
R.id.join_conference -> state.jitsiState.widgetId != null && !state.jitsiState.hasJoined
R.id.search -> true
R.id.dev_tools -> vectorPreferences.developerMode()
else -> false

View File

@ -88,8 +88,7 @@ class StartCallActionsHandler(
))
} else {
if (state.hasActiveJitsiWidget()) {
// A conference is already in progress!
showDialogWithMessage(fragment.getString(R.string.conference_call_in_progress))
// A conference is already in progress, return
} else {
MaterialAlertDialogBuilder(fragment.requireContext())
.setTitle(if (isVideoCall) R.string.video_meeting else R.string.audio_meeting)

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:paddingEnd="4dp"
android:paddingStart="4dp"
android:layout_width="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/join_conference_button"
android:layout_width="56dp"
android:layout_height="wrap_content"
android:minHeight="32dp"
app:iconPadding="0dp"
app:iconGravity="textStart"
app:icon="@drawable/ic_call_video_small"
app:iconTint="@color/element_background_light" />
</FrameLayout>

View File

@ -37,6 +37,12 @@
app:showAsAction="always"
tools:visible="true" />
<item android:id="@+id/join_conference"
android:title="@string/join"
app:actionLayout="@layout/view_join_conference"
app:showAsAction="always"
/>
<item
android:id="@+id/open_matrix_apps"
android:title="@string/room_add_matrix_apps"