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