Disable "Call Again" if already on a call
This commit is contained in:
parent
ae3b12bea8
commit
eed3e8e316
3 changed files with 18 additions and 6 deletions
|
@ -114,6 +114,7 @@ function renderCallingNotificationButton(
|
||||||
props: Readonly<PropsType>
|
props: Readonly<PropsType>
|
||||||
): ReactNode {
|
): ReactNode {
|
||||||
const {
|
const {
|
||||||
|
activeCallConversationId,
|
||||||
conversationId,
|
conversationId,
|
||||||
i18n,
|
i18n,
|
||||||
nextItem,
|
nextItem,
|
||||||
|
@ -135,16 +136,23 @@ function renderCallingNotificationButton(
|
||||||
buttonText = wasIncoming
|
buttonText = wasIncoming
|
||||||
? i18n('calling__call-back')
|
? i18n('calling__call-back')
|
||||||
: i18n('calling__call-again');
|
: i18n('calling__call-again');
|
||||||
onClick = () => {
|
if (activeCallConversationId) {
|
||||||
startCallingLobby({ conversationId, isVideoCall: wasVideoCall });
|
disabledTooltipText = i18n(
|
||||||
};
|
'calling__call-notification__button__in-another-call-tooltip'
|
||||||
|
);
|
||||||
|
onClick = noop;
|
||||||
|
} else {
|
||||||
|
onClick = () => {
|
||||||
|
startCallingLobby({ conversationId, isVideoCall: wasVideoCall });
|
||||||
|
};
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CallMode.Group: {
|
case CallMode.Group: {
|
||||||
if (props.ended) {
|
if (props.ended) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const { activeCallConversationId, deviceCount, maxDevices } = props;
|
const { deviceCount, maxDevices } = props;
|
||||||
if (activeCallConversationId) {
|
if (activeCallConversationId) {
|
||||||
if (activeCallConversationId === conversationId) {
|
if (activeCallConversationId === conversationId) {
|
||||||
buttonText = i18n('calling__return');
|
buttonText = i18n('calling__return');
|
||||||
|
|
|
@ -1124,12 +1124,15 @@ export function getPropsForCallHistory(
|
||||||
throw new Error('getPropsForCallHistory: Missing callHistoryDetails');
|
throw new Error('getPropsForCallHistory: Missing callHistoryDetails');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const activeCallConversationId = activeCall?.conversationId;
|
||||||
|
|
||||||
switch (callHistoryDetails.callMode) {
|
switch (callHistoryDetails.callMode) {
|
||||||
// Old messages weren't saved with a call mode.
|
// Old messages weren't saved with a call mode.
|
||||||
case undefined:
|
case undefined:
|
||||||
case CallMode.Direct:
|
case CallMode.Direct:
|
||||||
return {
|
return {
|
||||||
...callHistoryDetails,
|
...callHistoryDetails,
|
||||||
|
activeCallConversationId,
|
||||||
callMode: CallMode.Direct,
|
callMode: CallMode.Direct,
|
||||||
};
|
};
|
||||||
case CallMode.Group: {
|
case CallMode.Group: {
|
||||||
|
@ -1150,7 +1153,7 @@ export function getPropsForCallHistory(
|
||||||
const deviceCount = call?.peekInfo?.deviceCount ?? 0;
|
const deviceCount = call?.peekInfo?.deviceCount ?? 0;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
activeCallConversationId: activeCall?.conversationId,
|
activeCallConversationId,
|
||||||
callMode: CallMode.Group,
|
callMode: CallMode.Group,
|
||||||
conversationId,
|
conversationId,
|
||||||
creator,
|
creator,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020-2021 Signal Messenger, LLC
|
// Copyright 2020-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { LocalizerType } from '../types/Util';
|
import type { LocalizerType } from '../types/Util';
|
||||||
|
@ -8,6 +8,7 @@ import * as log from '../logging/log';
|
||||||
|
|
||||||
type DirectCallNotificationType = {
|
type DirectCallNotificationType = {
|
||||||
callMode: CallMode.Direct;
|
callMode: CallMode.Direct;
|
||||||
|
activeCallConversationId?: string;
|
||||||
wasIncoming: boolean;
|
wasIncoming: boolean;
|
||||||
wasVideoCall: boolean;
|
wasVideoCall: boolean;
|
||||||
wasDeclined: boolean;
|
wasDeclined: boolean;
|
||||||
|
|
Loading…
Reference in a new issue