Skip to content

Commit

Permalink
Renames call option to be more agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
ericdecanini committed Mar 22, 2022
1 parent f722b2e commit bfd31de
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import org.matrix.android.sdk.api.session.room.model.Membership
fun render(roomDetailViewState: RoomDetailViewState) {
val summary = roomDetailViewState.asyncRoomSummary()
val newState = if (summary?.membership != Membership.JOIN ||
roomDetailViewState.isWebRTCCallOptionAvailable() ||
roomDetailViewState.isCallOptionAvailable() ||
!roomDetailViewState.isAllowedToManageWidgets ||
roomDetailViewState.jitsiState.widgetId == null) {
State.Unmount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ data class RoomDetailViewState(
rootThreadEventId = args.threadTimelineArgs?.rootThreadEventId
)

fun isWebRTCCallOptionAvailable() = asyncRoomSummary.invoke()?.isDirect ?: true
fun isCallOptionAvailable() = asyncRoomSummary.invoke()?.isDirect ?: true

fun isSearchAvailable() = asyncRoomSummary()?.isEncrypted == false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,10 +714,10 @@ class TimelineViewModel @AssistedInject constructor(
R.id.timeline_setting -> true
R.id.invite -> state.canInvite
R.id.open_matrix_apps -> true
R.id.voice_call -> state.isWebRTCCallOptionAvailable()
R.id.video_call -> state.isWebRTCCallOptionAvailable() || state.jitsiState.confId == null || state.jitsiState.hasJoined
R.id.voice_call -> state.isCallOptionAvailable()
R.id.video_call -> state.isCallOptionAvailable() || state.jitsiState.confId == null || state.jitsiState.hasJoined
// Show Join conference button only if there is an active conf id not joined. Otherwise fallback to default video disabled. ^
R.id.join_conference -> !state.isWebRTCCallOptionAvailable() && state.jitsiState.confId != null && !state.jitsiState.hasJoined
R.id.join_conference -> !state.isCallOptionAvailable() && state.jitsiState.confId != null && !state.jitsiState.hasJoined
R.id.search -> state.isSearchAvailable()
R.id.menu_timeline_thread_list -> vectorPreferences.areThreadMessagesEnabled()
R.id.dev_tools -> vectorPreferences.developerMode()
Expand Down
6 changes: 3 additions & 3 deletions vector/src/main/res/menu/menu_timeline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
android:title="@string/action_video_call"
android:visible="false"
app:iconTint="?colorPrimary"
app:showAsAction="always"
app:showAsAction="ifRoom"
tools:visible="true" />

<item
Expand All @@ -34,7 +34,7 @@
android:title="@string/call"
android:visible="false"
app:iconTint="?colorPrimary"
app:showAsAction="always"
app:showAsAction="ifRoom"
tools:visible="true" />

<item
Expand All @@ -43,7 +43,7 @@
android:visible="false"
app:iconTint="?colorPrimary"
app:actionLayout="@layout/view_thread_notification_badge"
app:showAsAction="always"
app:showAsAction="ifRoom"
tools:visible="true" />

<item android:id="@+id/join_conference"
Expand Down

0 comments on commit bfd31de

Please sign in to comment.