MM-54866 - Calls: Transcription notifications (#7704)

This commit is contained in:
Christopher Poile 2023-12-21 17:19:28 -05:00 committed by GitHub
parent 2c1f318868
commit d6566b591a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 14 deletions

View file

@ -243,7 +243,7 @@ export const needsRecordingAlert = () => {
recordingAlertLock = false;
};
export const recordingAlert = (isHost: boolean, intl: IntlShape) => {
export const recordingAlert = (isHost: boolean, transcriptionsEnabled: boolean, intl: IntlShape) => {
if (recordingAlertLock) {
return;
}
@ -251,22 +251,46 @@ export const recordingAlert = (isHost: boolean, intl: IntlShape) => {
const {formatMessage} = intl;
const participantTitle = formatMessage({
id: 'mobile.calls_participant_rec_title',
defaultMessage: 'Recording is in progress',
});
const hostTitle = formatMessage({
id: 'mobile.calls_host_rec_title',
defaultMessage: 'You are recording',
});
const hostMessage = formatMessage({
id: 'mobile.calls_host_rec',
defaultMessage: 'Consider letting everyone know that this meeting is being recorded.',
});
const participantTitle = formatMessage({
id: 'mobile.calls_participant_rec_title',
defaultMessage: 'Recording is in progress',
});
const participantMessage = formatMessage({
id: 'mobile.calls_participant_rec',
defaultMessage: 'The host has started recording this meeting. By staying in the meeting you give consent to being recorded.',
});
const hostMessage = formatMessage({
id: 'mobile.calls_host_rec',
defaultMessage: 'You are recording this meeting. Consider letting everyone know that this meeting is being recorded.',
const hostTranscriptionTitle = formatMessage({
id: 'mobile.calls_host_transcription_title',
defaultMessage: 'Recording and transcription has started',
});
const hostTranscriptionMessage = formatMessage({
id: 'mobile.calls_host_transcription',
defaultMessage: 'Consider letting everyone know that this meeting is being recorded and transcribed.',
});
const participantTranscriptionTitle = formatMessage({
id: 'mobile.calls_participant_transcription_title',
defaultMessage: 'Recording and transcription is in progress',
});
const participantTranscriptionMessage = formatMessage({
id: 'mobile.calls_participant_transcription',
defaultMessage: 'The host has started recording and transcription for this meeting. By staying in the meeting, you give consent to being recorded and transcribed.',
});
const hTitle = transcriptionsEnabled ? hostTranscriptionTitle : hostTitle;
const hMessage = transcriptionsEnabled ? hostTranscriptionMessage : hostMessage;
const pTitle = transcriptionsEnabled ? participantTranscriptionTitle : participantTitle;
const pMessage = transcriptionsEnabled ? participantTranscriptionMessage : participantMessage;
const participantButtons = [
{
@ -295,8 +319,8 @@ export const recordingAlert = (isHost: boolean, intl: IntlShape) => {
}];
Alert.alert(
isHost ? hostTitle : participantTitle,
isHost ? hostMessage : participantMessage,
isHost ? hTitle : pTitle,
isHost ? hMessage : pMessage,
isHost ? hostButton : participantButtons,
);
};

View file

@ -12,11 +12,12 @@ import CallDuration from '@calls/components/call_duration';
import MessageBar from '@calls/components/message_bar';
import UnavailableIconWrapper from '@calls/components/unavailable_icon_wrapper';
import {usePermissionsChecker} from '@calls/hooks';
import {setCallQualityAlertDismissed, setMicPermissionsErrorDismissed} from '@calls/state';
import {setCallQualityAlertDismissed, setMicPermissionsErrorDismissed, useCallsConfig} from '@calls/state';
import {makeCallsTheme} from '@calls/utils';
import CompassIcon from '@components/compass_icon';
import {Calls, Screens} from '@constants';
import {CURRENT_CALL_BAR_HEIGHT} from '@constants/view';
import {useServerUrl} from '@context/server';
import {useTheme} from '@context/theme';
import {allOrientations, dismissAllModalsAndPopToScreen} from '@screens/navigation';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
@ -140,6 +141,8 @@ const CurrentCallBar = ({
threadScreen,
}: Props) => {
const theme = useTheme();
const serverUrl = useServerUrl();
const {EnableTranscriptions} = useCallsConfig(serverUrl);
const callsTheme = useMemo(() => makeCallsTheme(theme), [theme]);
const style = getStyleSheet(callsTheme);
const intl = useIntl();
@ -209,7 +212,7 @@ const CurrentCallBar = ({
// - Recording has started and recording has not ended.
const isHost = Boolean(currentCall?.hostId === mySession?.userId);
if (currentCall?.recState?.start_at && !currentCall?.recState?.end_at) {
recordingAlert(isHost, intl);
recordingAlert(isHost, EnableTranscriptions, intl);
}
// The user should receive a recording finished alert if all of the following conditions apply:

View file

@ -328,7 +328,7 @@ const CallScreen = ({
const {width, height} = useWindowDimensions();
const isTablet = useIsTablet();
const serverUrl = useServerUrl();
const {EnableRecordings} = useCallsConfig(serverUrl);
const {EnableRecordings, EnableTranscriptions} = useCallsConfig(serverUrl);
usePermissionsChecker(micPermissionsGranted);
const incomingCalls = useIncomingCalls();
@ -453,7 +453,7 @@ const CallScreen = ({
const isHost = Boolean(currentCall?.hostId === mySession?.userId);
const recording = Boolean(currentCall?.recState?.start_at && !currentCall.recState.end_at);
if (recording) {
recordingAlert(isHost, intl);
recordingAlert(isHost, EnableTranscriptions, intl);
}
// The user should receive a recording finished alert if all of the following conditions apply:

View file

@ -466,6 +466,8 @@
"mobile.calls_host_rec_stopped": "You can find the recording in this call's chat thread once it's finished processing.",
"mobile.calls_host_rec_stopped_title": "Recording has stopped. Processing...",
"mobile.calls_host_rec_title": "You are recording",
"mobile.calls_host_transcription": "Consider letting everyone know that this meeting is being recorded and transcribed.",
"mobile.calls_host_transcription_title": "Recording and transcription has started",
"mobile.calls_incoming_dm": "<b>{name}</b> is inviting you to a call",
"mobile.calls_incoming_gm": "<b>{name}</b> is inviting you to a call with <b>{num, plural, one {# other} other {# others}}</b>",
"mobile.calls_join_call": "Join call",
@ -492,6 +494,8 @@
"mobile.calls_participant_limit_title_GA": "This call is at capacity",
"mobile.calls_participant_rec": "The host has started recording this meeting. By staying in the meeting you give consent to being recorded.",
"mobile.calls_participant_rec_title": "Recording is in progress",
"mobile.calls_participant_transcription": "The host has started recording and transcription for this meeting. By staying in the meeting, you give consent to being recorded and transcribed.",
"mobile.calls_participant_transcription_title": "Recording and transcription is in progress",
"mobile.calls_phone": "Phone",
"mobile.calls_quality_warning": "Call quality may be degraded due to unstable network conditions.",
"mobile.calls_raise_hand": "Raise hand",