Show connecting state before ringing for direct calls

Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2024-11-20 18:49:02 -06:00 committed by GitHub
parent 6e46411ae4
commit 4eba508c5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 4 deletions

View file

@ -3635,6 +3635,10 @@
"messageformat": "{ringer} is calling you, {first}, {second}, and {remaining, plural, one {# other} other {# others}}",
"description": "Shown in the incoming call bar when someone is ringing you for a group call"
},
"icu:outgoingCallConnecting": {
"messageformat": "Connecting...",
"description": "Shown in the call screen when placing an outgoing call that is connecting (prior to ringing)"
},
"icu:outgoingCallRinging": {
"messageformat": "Ringing...",
"description": "Shown in the call screen when placing an outgoing call that is now ringing"

View file

@ -365,6 +365,7 @@ export function CallScreen({
let isRinging: boolean;
let hasCallStarted: boolean;
let isConnecting: boolean;
let isConnected: boolean;
let participantCount: number;
let conversationsByDemuxId: ConversationsByDemuxIdType;
@ -372,10 +373,11 @@ export function CallScreen({
switch (activeCall.callMode) {
case CallMode.Direct: {
isRinging =
activeCall.callState === CallState.Prering ||
activeCall.callState === CallState.Ringing;
hasCallStarted = !isRinging;
isConnecting = activeCall.callState === CallState.Prering;
isRinging = activeCall.callState === CallState.Ringing;
hasCallStarted =
activeCall.callState !== CallState.Prering &&
activeCall.callState !== CallState.Ringing;
isConnected = activeCall.callState === CallState.Accepted;
participantCount = isConnected ? 2 : 0;
conversationsByDemuxId = new Map();
@ -394,6 +396,8 @@ export function CallScreen({
isConnected =
activeCall.connectionState === GroupCallConnectionState.Connected;
isConnecting =
activeCall.connectionState === GroupCallConnectionState.Connecting;
break;
default:
throw missingCaseError(activeCall);
@ -644,6 +648,9 @@ export function CallScreen({
const raisedHandsCount: number = raisedHands?.size ?? 0;
const callStatus: ReactNode | string = React.useMemo(() => {
if (isConnecting) {
return i18n('icu:outgoingCallConnecting');
}
if (isRinging) {
return i18n('icu:outgoingCallRinging');
}
@ -672,6 +679,7 @@ export function CallScreen({
return null;
}, [
i18n,
isConnecting,
isRinging,
isConnected,
activeCall.callMode,