Skip to content

Commit

Permalink
Enable visio for DINUM instance
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Jul 23, 2024
1 parent 217e6e2 commit cb2f00f
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DebugVectorFeatures(

private val dataStore = context.dataStore

override fun tchapIsVoipSupported(homeServerUrl: String) = vectorFeatures.tchapIsVoipSupported(homeServerUrl)
override fun tchapIsVisioSupported(homeServerUrl: String) = vectorFeatures.tchapIsVisioSupported(homeServerUrl)

override fun tchapIsCrossSigningEnabled() = vectorFeatures.tchapIsCrossSigningEnabled()

Expand Down
2 changes: 1 addition & 1 deletion vector-config/src/btchap/res/values/config-features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<bool name="tchap_is_thread_enabled">false</bool>
<bool name="tchap_is_secure_backup_required">true</bool>

<string-array name="tchap_is_voip_supported_homeservers" translatable="false" />
<string-array name="tchap_is_visio_supported_homeservers" translatable="false" />
</resources>
2 changes: 1 addition & 1 deletion vector-config/src/devTchap/res/values/config-features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<bool name="tchap_is_thread_enabled">false</bool>
<bool name="tchap_is_secure_backup_required">true</bool>

<string-array name="tchap_is_voip_supported_homeservers" translatable="false" />
<string-array name="tchap_is_visio_supported_homeservers" translatable="false" />
</resources>
4 changes: 3 additions & 1 deletion vector-config/src/tchap/res/values/config-features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
<bool name="tchap_is_thread_enabled">false</bool>
<bool name="tchap_is_secure_backup_required">true</bool>

<string-array name="tchap_is_voip_supported_homeservers" translatable="false" />
<string-array name="tchap_is_visio_supported_homeservers" translatable="false">
<item>agent.dinum.tchap.gouv.fr</item>
</string-array>
</resources>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="tchap_is_voip_supported">true</bool>
<bool name="tchap_is_visio_supported">true</bool>
</resources>
2 changes: 1 addition & 1 deletion vector-config/src/withvoip/res/values/config-features.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="tchap_is_voip_supported">true</bool>
<bool name="tchap_is_visio_supported">true</bool>
</resources>
6 changes: 3 additions & 3 deletions vector/src/main/java/im/vector/app/features/VectorFeatures.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import javax.inject.Inject

interface VectorFeatures {

fun tchapIsVoipSupported(homeServerUrl: String): Boolean
fun tchapIsVisioSupported(homeServerUrl: String): Boolean
fun tchapIsCrossSigningEnabled(): Boolean
fun tchapIsKeyBackupEnabled(): Boolean
fun tchapIsThreadEnabled(): Boolean
Expand Down Expand Up @@ -63,8 +63,8 @@ class DefaultVectorFeatures @Inject constructor(
private val stringArrayProvider: StringArrayProvider,
private val booleanProvider: BooleanProvider
) : VectorFeatures {
override fun tchapIsVoipSupported(homeServerUrl: String) = booleanProvider.getBoolean(R.bool.tchap_is_voip_supported) &&
stringArrayProvider.getStringArray(R.array.tchap_is_voip_supported_homeservers).let { homeServerUrls ->
override fun tchapIsVisioSupported(homeServerUrl: String) = booleanProvider.getBoolean(R.bool.tchap_is_visio_supported) &&
stringArrayProvider.getStringArray(R.array.tchap_is_visio_supported_homeservers).let { homeServerUrls ->
homeServerUrls.isEmpty() || homeServerUrls.any { homeServerUrl.contains(it) }
}
override fun tchapIsCrossSigningEnabled() = booleanProvider.getBoolean(R.bool.tchap_is_cross_signing_enabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,12 +863,12 @@ class TimelineViewModel @AssistedInject constructor(
R.id.timeline_setting -> true
R.id.invite -> state.canInvite
R.id.open_matrix_apps -> false // TCHAP there are no matrix apps
// TCHAP check if voip is enabled
R.id.video_call -> vectorPreferences.developerMode() && vectorFeatures.tchapIsVoipSupported(session.sessionParams.homeServerUrl)
R.id.voice_call -> vectorFeatures.tchapIsVoipSupported(session.sessionParams.homeServerUrl) &&
(state.isCallOptionAvailable() || state.hasActiveElementCallWidget())
R.id.voice_call -> state.isCallOptionAvailable() || state.hasActiveElementCallWidget()
// TCHAP check if visio is enabled
R.id.video_call -> vectorFeatures.tchapIsVisioSupported(session.sessionParams.homeServerUrl) &&
(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 -> vectorFeatures.tchapIsVoipSupported(session.sessionParams.homeServerUrl) && !state.isCallOptionAvailable() &&
R.id.join_conference -> vectorFeatures.tchapIsVisioSupported(session.sessionParams.homeServerUrl) && !state.isCallOptionAvailable() &&
state.jitsiState.confId != null && !state.jitsiState.hasJoined
R.id.search -> state.isSearchAvailable()
R.id.menu_timeline_thread_list -> vectorPreferences.areThreadMessagesEnabled()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class CallItemFactory @Inject constructor(
val userOfInterest = roomSummary.toMatrixItem()
val attributes = messageItemAttributesFactory.create(null, informationData, callback, reactionsSummaryEvents).let {
CallTileTimelineItem.Attributes(
isVoipSupported = vectorFeatures.tchapIsVoipSupported(session.sessionParams.homeServerUrl),
isCallSupported = vectorFeatures.tchapIsVisioSupported(session.sessionParams.homeServerUrl) || callKind.isVoiceCall,
callId = callId,
callKind = callKind,
callStatus = callStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class WidgetItemFactory @Inject constructor(
CallTileTimelineItem.CallStatus.ENDED
}
val attributes = CallTileTimelineItem.Attributes(
isVoipSupported = vectorFeatures.tchapIsVoipSupported(session.sessionParams.homeServerUrl),
isCallSupported = vectorFeatures.tchapIsVisioSupported(session.sessionParams.homeServerUrl),
callId = jitsiWidgetEventsGroup.callId,
callKind = CallTileTimelineItem.CallKind.CONFERENCE,
callStatus = callStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ abstract class CallTileTimelineItem : AbsBaseMessageItem<CallTileTimelineItem.Ho
}

private fun renderCallSupportState(holder: Holder) {
val error = if (!attributes.isVoipSupported) holder.resources.getString(R.string.tchap_call_not_supported) else null
holder.acceptView.isEnabled = attributes.isVoipSupported
holder.rejectView.isEnabled = attributes.isVoipSupported
val error = if (!attributes.isCallSupported) holder.resources.getString(R.string.tchap_call_not_supported) else null
holder.acceptView.isEnabled = attributes.isCallSupported
holder.rejectView.isEnabled = attributes.isCallSupported
holder.errorView.setTextOrHide(error)
}

Expand Down Expand Up @@ -269,7 +269,7 @@ abstract class CallTileTimelineItem : AbsBaseMessageItem<CallTileTimelineItem.Ho
}

data class Attributes(
val isVoipSupported: Boolean,
val isCallSupported: Boolean,
val callId: String,
val callKind: CallKind,
val callStatus: CallStatus,
Expand Down
2 changes: 1 addition & 1 deletion vector/src/main/res/xml/vector_settings_root.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:icon="@drawable/ic_settings_root_call"
android:title="@string/preference_voice_and_video"
app:fragment="im.vector.app.features.settings.VectorSettingsVoiceVideoFragment"
app:isPreferenceVisible="@bool/tchap_is_voip_supported" />
app:isPreferenceVisible="@bool/tchap_is_visio_supported" />

<im.vector.app.core.preference.VectorPreference
android:icon="@drawable/ic_settings_root_security_privacy"
Expand Down

0 comments on commit cb2f00f

Please sign in to comment.