Hide m.call.candidates in the timeline by default.

And handle them correctly when all events are displayed
This commit is contained in:
Benoit Marty 2020-05-28 23:48:20 +02:00 committed by Valere
parent df4aab1d73
commit 0bb92e9e91
4 changed files with 9 additions and 4 deletions

View file

@ -42,7 +42,7 @@
<string name="notice_placed_video_call">%s placed a video call.</string>
<string name="notice_placed_video_call_by_you">You placed a video call.</string>
<string name="notice_placed_voice_call">%s placed a voice call.</string>
<string name="notice_placed_voice_call_by_you">You placed a voice call.</string>
<string name="notice_call_candidates">%s sent data to setup the call.</string>
<string name="notice_answered_call">%s answered the call.</string>
<string name="notice_answered_call_by_you">You answered the call.</string>
<string name="notice_ended_call">%s ended the call.</string>

View file

@ -184,6 +184,7 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
EventType.STATE_ROOM_CANONICAL_ALIAS,
EventType.STATE_ROOM_HISTORY_VISIBILITY,
EventType.CALL_INVITE,
EventType.CALL_CANDIDATES,
EventType.CALL_HANGUP,
EventType.CALL_ANSWER -> {
noticeEventFormatter.format(timelineEvent)

View file

@ -80,12 +80,15 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me
EventType.KEY_VERIFICATION_START,
EventType.KEY_VERIFICATION_KEY,
EventType.KEY_VERIFICATION_READY,
EventType.KEY_VERIFICATION_MAC -> {
EventType.KEY_VERIFICATION_MAC,
EventType.CALL_CANDIDATES -> {
// TODO These are not filtered out by timeline when encrypted
// For now manually ignore
if (userPreferencesProvider.shouldShowHiddenEvents()) {
noticeItemFactory.create(event, highlight, callback)
} else null
} else {
null
}
}
EventType.KEY_VERIFICATION_CANCEL,
EventType.KEY_VERIFICATION_DONE -> {

View file

@ -68,6 +68,7 @@ class NoticeEventFormatter @Inject constructor(private val sessionHolder: Active
EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
EventType.STATE_ROOM_POWER_LEVELS -> formatRoomPowerLevels(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
EventType.CALL_INVITE,
EventType.CALL_CANDIDATES,
EventType.CALL_HANGUP,
EventType.CALL_ANSWER -> formatCallEvent(type, timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
EventType.MESSAGE,
@ -237,7 +238,7 @@ class NoticeEventFormatter @Inject constructor(private val sessionHolder: Active
private fun formatCallEvent(type: String, event: Event, senderName: String?): CharSequence? {
return when (type) {
EventType.CALL_INVITE -> {
EventType.CALL_INVITE -> {
val content = event.getClearContent().toModel<CallInviteContent>() ?: return null
val isVideoCall = content.offer?.sdp == CallInviteContent.Offer.SDP_VIDEO
return if (isVideoCall) {