Merge pull request #3857 from element-hq/feature/bma/legacyCallIteration

Update the strings for unsupported calls
This commit is contained in:
Benoit Marty 2024-11-12 20:45:05 +01:00 committed by GitHub
commit 624093061d
11 changed files with 18 additions and 21 deletions

View file

@ -7,24 +7,21 @@
package io.element.android.features.messages.impl.timeline.components.event package io.element.android.features.messages.impl.timeline.components.event
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.features.messages.impl.R
import io.element.android.libraries.designsystem.preview.ElementPreview import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.theme.components.Icon import io.element.android.libraries.designsystem.theme.components.Icon
import io.element.android.libraries.designsystem.theme.components.Text import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.ui.strings.CommonStrings
@Composable @Composable
fun TimelineItemLegacyCallInviteView( fun TimelineItemLegacyCallInviteView(
@ -32,20 +29,18 @@ fun TimelineItemLegacyCallInviteView(
) { ) {
Row( Row(
modifier = modifier, modifier = modifier,
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
) { ) {
Icon( Icon(
imageVector = CompoundIcons.VoiceCall(), imageVector = CompoundIcons.VoiceCall(),
contentDescription = null, contentDescription = null,
tint = MaterialTheme.colorScheme.secondary, tint = ElementTheme.colors.iconSecondary,
) )
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(8.dp))
Text( Text(
color = MaterialTheme.colorScheme.secondary, color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodyMdRegular, style = ElementTheme.typography.fontBodyMdRegular,
text = stringResource(CommonStrings.common_call_invite), text = stringResource(R.string.screen_room_timeline_legacy_call),
textAlign = TextAlign.Center, textAlign = TextAlign.Start,
) )
} }
} }

View file

@ -56,7 +56,7 @@ class DefaultMessageSummaryFormatter @Inject constructor(
is TimelineItemVideoContent -> context.getString(CommonStrings.common_video) is TimelineItemVideoContent -> context.getString(CommonStrings.common_video)
is TimelineItemFileContent -> context.getString(CommonStrings.common_file) is TimelineItemFileContent -> context.getString(CommonStrings.common_file)
is TimelineItemAudioContent -> context.getString(CommonStrings.common_audio) is TimelineItemAudioContent -> context.getString(CommonStrings.common_audio)
is TimelineItemLegacyCallInviteContent -> context.getString(CommonStrings.common_call_invite) is TimelineItemLegacyCallInviteContent -> context.getString(CommonStrings.common_unsupported_call)
is TimelineItemCallNotifyContent -> context.getString(CommonStrings.common_call_started) is TimelineItemCallNotifyContent -> context.getString(CommonStrings.common_call_started)
}.take(MAX_SAFE_LENGTH) }.take(MAX_SAFE_LENGTH)
} }

View file

@ -31,6 +31,7 @@
<string name="screen_room_timeline_add_reaction">"Add emoji"</string> <string name="screen_room_timeline_add_reaction">"Add emoji"</string>
<string name="screen_room_timeline_beginning_of_room">"This is the beginning of %1$s."</string> <string name="screen_room_timeline_beginning_of_room">"This is the beginning of %1$s."</string>
<string name="screen_room_timeline_beginning_of_room_no_name">"This is the beginning of this conversation."</string> <string name="screen_room_timeline_beginning_of_room_no_name">"This is the beginning of this conversation."</string>
<string name="screen_room_timeline_legacy_call">"Unsupported call. Ask if the caller can use the new Element X app."</string>
<string name="screen_room_timeline_less_reactions">"Show less"</string> <string name="screen_room_timeline_less_reactions">"Show less"</string>
<string name="screen_room_timeline_message_copied">"Message copied"</string> <string name="screen_room_timeline_message_copied">"Message copied"</string>
<string name="screen_room_timeline_no_permission_to_post">"You do not have permission to post to this room"</string> <string name="screen_room_timeline_no_permission_to_post">"You do not have permission to post to this room"</string>

View file

@ -91,7 +91,7 @@ class DefaultRoomLastMessageFormatter @Inject constructor(
val message = sp.getString(CommonStrings.common_unsupported_event) val message = sp.getString(CommonStrings.common_unsupported_event)
message.prefixIfNeeded(senderDisambiguatedDisplayName, isDmRoom, isOutgoing) message.prefixIfNeeded(senderDisambiguatedDisplayName, isDmRoom, isOutgoing)
} }
is LegacyCallInviteContent -> sp.getString(CommonStrings.common_call_invite) is LegacyCallInviteContent -> sp.getString(CommonStrings.common_unsupported_call)
is CallNotifyContent -> sp.getString(CommonStrings.common_call_started) is CallNotifyContent -> sp.getString(CommonStrings.common_call_started)
}?.take(MAX_SAFE_LENGTH) }?.take(MAX_SAFE_LENGTH)
} }

View file

@ -52,13 +52,11 @@ class DefaultTimelineEventFormatter @Inject constructor(
is StateContent -> { is StateContent -> {
stateContentFormatter.format(content, senderDisambiguatedDisplayName, isOutgoing, RenderingMode.Timeline) stateContentFormatter.format(content, senderDisambiguatedDisplayName, isOutgoing, RenderingMode.Timeline)
} }
is LegacyCallInviteContent -> {
sp.getString(CommonStrings.common_call_invite)
}
is CallNotifyContent -> { is CallNotifyContent -> {
sp.getString(CommonStrings.common_call_started) sp.getString(CommonStrings.common_call_started)
} }
RedactedContent, RedactedContent,
is LegacyCallInviteContent,
is StickerContent, is StickerContent,
is PollContent, is PollContent,
is UnableToDecryptContent, is UnableToDecryptContent,

View file

@ -151,7 +151,7 @@ class DefaultNotifiableEventResolver @Inject constructor(
noisy = isNoisy, noisy = isNoisy,
timestamp = this.timestamp, timestamp = this.timestamp,
senderDisambiguatedDisplayName = getDisambiguatedDisplayName(content.senderId), senderDisambiguatedDisplayName = getDisambiguatedDisplayName(content.senderId),
body = stringProvider.getString(CommonStrings.common_call_invite), body = stringProvider.getString(CommonStrings.common_unsupported_call),
roomName = roomDisplayName, roomName = roomDisplayName,
roomIsDm = isDm, roomIsDm = isDm,
roomAvatarPath = roomAvatarUrl, roomAvatarPath = roomAvatarUrl,

View file

@ -588,7 +588,7 @@ class DefaultNotifiableEventResolverTest {
noisy = false, noisy = false,
timestamp = A_TIMESTAMP, timestamp = A_TIMESTAMP,
senderDisambiguatedDisplayName = A_USER_NAME_2, senderDisambiguatedDisplayName = A_USER_NAME_2,
body = "Call in progress (unsupported)", body = "Unsupported call",
imageUriString = null, imageUriString = null,
imageMimeType = null, imageMimeType = null,
threadId = null, threadId = null,

View file

@ -247,6 +247,7 @@ Reason: %1$s."</string>
<string name="common_unable_to_invite_title">"Unable to send invite(s)"</string> <string name="common_unable_to_invite_title">"Unable to send invite(s)"</string>
<string name="common_unlock">"Unlock"</string> <string name="common_unlock">"Unlock"</string>
<string name="common_unmute">"Unmute"</string> <string name="common_unmute">"Unmute"</string>
<string name="common_unsupported_call">"Unsupported call"</string>
<string name="common_unsupported_event">"Unsupported event"</string> <string name="common_unsupported_event">"Unsupported event"</string>
<string name="common_username">"Username"</string> <string name="common_username">"Username"</string>
<string name="common_verification_cancelled">"Verification cancelled"</string> <string name="common_verification_cancelled">"Verification cancelled"</string>

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:a18ab0b1b73878ccb52efccbad03cec0a47cd2e48628248b82bd4b6af53bbf21 oid sha256:d0e53ece51bf03c62b187ae05bc4fdd71d9f30dcc9b4c18a50cfcb4619419091
size 8665 size 12673

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:45b9560a7e0bca74f9d9e8c308a79943bcd34371e0ee6918bc496cadaadf94d1 oid sha256:f1bbb9c0beb334a94920f3f9f7f6458fa2ea164661a5d78cebb71470368f98ee
size 8642 size 12565

View file

@ -23,6 +23,8 @@ forbiddenTerms = {
"screen_onboarding_welcome_title", "screen_onboarding_welcome_title",
# Contains "Element Call" # Contains "Element Call"
"screen_incoming_call_subtitle_android", "screen_incoming_call_subtitle_android",
# Contains "Element X"
"screen_room_timeline_legacy_call",
] ]
} }