From f8c053cc96116fe0b8a1bc3f32ed9a7c24606204 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Thu, 14 Jan 2021 07:03:19 -0400 Subject: [PATCH] Add 'on another device' to participants description --- .../components/webrtc/CallParticipantsState.java | 12 ++++++------ .../securesms/events/CallParticipant.java | 12 ++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsState.java b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsState.java index 842973a4be..0842fe59af 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsState.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsState.java @@ -107,20 +107,20 @@ public final class CallParticipantsState { return context.getString(R.string.WebRtcCallView__no_one_else_is_here); case 1: if (callState == WebRtcViewModel.State.CALL_PRE_JOIN && groupCallState.isNotIdle()) { - return context.getString(R.string.WebRtcCallView__s_is_in_this_call, remoteParticipants.get(0).getRecipient().getShortDisplayName(context)); + return context.getString(R.string.WebRtcCallView__s_is_in_this_call, remoteParticipants.get(0).getShortRecipientDisplayName(context)); } else { - return remoteParticipants.get(0).getRecipient().getDisplayName(context); + return remoteParticipants.get(0).getRecipientDisplayName(context); } case 2: return context.getString(R.string.WebRtcCallView__s_and_s_are_in_this_call, - remoteParticipants.get(0).getRecipient().getShortDisplayName(context), - remoteParticipants.get(1).getRecipient().getShortDisplayName(context)); + remoteParticipants.get(0).getShortRecipientDisplayName(context), + remoteParticipants.get(1).getShortRecipientDisplayName(context)); default: int others = remoteParticipants.size() - 2; return context.getResources().getQuantityString(R.plurals.WebRtcCallView__s_s_and_d_others_are_in_this_call, others, - remoteParticipants.get(0).getRecipient().getShortDisplayName(context), - remoteParticipants.get(1).getRecipient().getShortDisplayName(context), + remoteParticipants.get(0).getShortRecipientDisplayName(context), + remoteParticipants.get(1).getShortRecipientDisplayName(context), others); } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/events/CallParticipant.java b/app/src/main/java/org/thoughtcrime/securesms/events/CallParticipant.java index b19c288040..e71389066e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/events/CallParticipant.java +++ b/app/src/main/java/org/thoughtcrime/securesms/events/CallParticipant.java @@ -113,6 +113,18 @@ public final class CallParticipant { } } + public @NonNull String getShortRecipientDisplayName(@NonNull Context context) { + if (recipient.isSelf() && isPrimary()) { + return context.getString(R.string.CallParticipant__you); + } else if (recipient.isSelf()) { + return context.getString(R.string.CallParticipant__you_on_another_device); + } else if (isPrimary()) { + return recipient.getShortDisplayName(context); + } else { + return context.getString(R.string.CallParticipant__s_on_another_device, recipient.getShortDisplayName(context)); + } + } + public @Nullable IdentityKey getIdentityKey() { return identityKey; }