Skip to content

Commit

Permalink
Merge branch 'release/2.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Jul 25, 2024
2 parents fe41cb0 + 1023070 commit 7b86894
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 29 deletions.
11 changes: 11 additions & 0 deletions TCHAP_CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Changes in Tchap 2.13.0 (2024-07-25)
====================================

Features ✨
----------
- Activation des appels vidéos pour DINUM. ([#1078](https://github.com/tchapgouv/tchap-android/issues/1078))

Bugfixes 🐛
----------
- Correction de l'affichage des fichiers dans une réponse ou un thread. ([#1080](https://github.com/tchapgouv/tchap-android/issues/1080))

Changes in Tchap 2.12.0 (2024-07-22)
====================================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.session.room.timeline.decorator
import io.realm.Realm
import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.api.session.events.model.isTextMessage
import org.matrix.android.sdk.api.session.events.model.isThread
import org.matrix.android.sdk.api.session.events.model.toContent
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
Expand All @@ -40,7 +41,8 @@ internal class UpdatedReplyDecorator(
) : TimelineEventDecorator {

override fun decorate(timelineEvent: TimelineEvent): TimelineEvent {
return if (timelineEvent.isReply() && !timelineEvent.root.isThread()) {
// TCHAP Display reply to only if the root event is a text message.
return if (timelineEvent.isReply() && !timelineEvent.root.isThread() && timelineEvent.root.isTextMessage()) {
val newRepliedEvent = createNewRepliedEvent(timelineEvent) ?: return timelineEvent
timelineEvent.copy(root = newRepliedEvent)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.matrix.android.sdk.api.session.events.model.RelationType
import org.matrix.android.sdk.api.session.events.model.getRelationContentForType
import org.matrix.android.sdk.api.session.events.model.getRootThreadEventId
import org.matrix.android.sdk.api.session.events.model.isSticker
import org.matrix.android.sdk.api.session.events.model.isTextMessage
import org.matrix.android.sdk.api.session.events.model.toContent
import org.matrix.android.sdk.api.session.events.model.toModel
import org.matrix.android.sdk.api.session.room.model.message.MessageFormat
Expand Down Expand Up @@ -168,7 +169,8 @@ internal class ThreadsAwarenessHandler @Inject constructor(
roomId ?: return null
if (lightweightSettingsStorage.areThreadMessagesEnabled() && !isReplyEvent(event)) return null
handleRootThreadEventsIfNeeded(realm, roomId, eventEntity, event)
if (!isThreadEvent(event)) return null
// TCHAP Display reply to only if the root event is a text message.
if (!isThreadEvent(event) || !event.isTextMessage()) return null
val eventPayload = if (!event.isEncrypted()) {
event.content?.toMutableMap() ?: return null
} else {
Expand Down
2 changes: 1 addition & 1 deletion towncrier.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.towncrier]
version = "2.12.0"
version = "2.13.0"
directory = "changelog.d"
filename = "TCHAP_CHANGES.md"
name = "Changes in Tchap"
Expand Down
2 changes: 1 addition & 1 deletion vector-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ knit {

// Note: 2 digits max for each value
ext.versionMajor = 2
ext.versionMinor = 12
ext.versionMinor = 13
// Note: even values are reserved for regular release, odd values for hotfix release.
// When creating a hotfix, you should decrease the value, since the current value
// is the value for the next regular release.
Expand Down
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>
5 changes: 1 addition & 4 deletions vector-config/src/main/res/values/config-settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
<bool name="settings_root_general_visible">true</bool>
<bool name="settings_root_notification_visible">true</bool>
<bool name="settings_root_preferences_visible">true</bool>

<!-- Tchap: use gradle config -->
<!-- <bool name="settings_root_voice_video_visible">true</bool>-->

<bool name="settings_root_voice_video_visible">true</bool>
<bool name="settings_root_security_privacy_visible">true</bool>
<bool name="settings_root_labs_visible">false</bool>
<bool name="settings_root_advanced_visible">true</bool>
Expand Down
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/settings_root_voice_video_visible" />

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

0 comments on commit 7b86894

Please sign in to comment.