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