// Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React, { useRef, useEffect } from 'react'; import { LocalizerType } from '../types/Util'; import { Avatar } from './Avatar'; import { Intl } from './Intl'; import { ContactName } from './conversation/ContactName'; import { ColorType } from '../types/Colors'; type Props = { conversation: { avatarPath?: string; color?: ColorType; name?: string; phoneNumber?: string; profileName?: string; title: string; }; i18n: LocalizerType; close: () => void; }; const AUTO_CLOSE_MS = 10000; export const CallNeedPermissionScreen: React.FC = ({ conversation, i18n, close, }) => { const title = conversation.title || i18n('unknownContact'); const autoCloseAtRef = useRef(Date.now() + AUTO_CLOSE_MS); useEffect(() => { const timeout = setTimeout(close, autoCloseAtRef.current - Date.now()); return clearTimeout.bind(null, timeout); }, [autoCloseAtRef, close]); return (

]} />

); };