2021-05-20 21:54:03 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React from 'react';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { LocalizerType } from '../types/Util';
|
2021-05-20 21:54:03 +00:00
|
|
|
import { Theme } from '../util/theme';
|
|
|
|
import { Modal } from './Modal';
|
|
|
|
import { Button, ButtonVariant } from './Button';
|
|
|
|
|
|
|
|
type PropsType = {
|
|
|
|
i18n: LocalizerType;
|
|
|
|
openSystemPreferencesAction: () => unknown;
|
|
|
|
toggleScreenRecordingPermissionsDialog: () => unknown;
|
|
|
|
};
|
|
|
|
|
|
|
|
function focusRef(el: HTMLElement | null) {
|
|
|
|
if (el) {
|
|
|
|
el.focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
export function NeedsScreenRecordingPermissionsModal({
|
2021-05-20 21:54:03 +00:00
|
|
|
i18n,
|
|
|
|
openSystemPreferencesAction,
|
|
|
|
toggleScreenRecordingPermissionsDialog,
|
2022-11-18 00:45:19 +00:00
|
|
|
}: PropsType): JSX.Element {
|
2022-09-29 22:40:09 +00:00
|
|
|
const footer = (
|
|
|
|
<>
|
|
|
|
<Button
|
|
|
|
onClick={toggleScreenRecordingPermissionsDialog}
|
|
|
|
ref={focusRef}
|
|
|
|
variant={ButtonVariant.Secondary}
|
|
|
|
>
|
|
|
|
{i18n('calling__presenting--permission-cancel')}
|
|
|
|
</Button>
|
|
|
|
<Button
|
|
|
|
onClick={() => {
|
|
|
|
openSystemPreferencesAction();
|
|
|
|
toggleScreenRecordingPermissionsDialog();
|
|
|
|
}}
|
|
|
|
variant={ButtonVariant.Primary}
|
|
|
|
>
|
|
|
|
{i18n('calling__presenting--permission-open')}
|
|
|
|
</Button>
|
|
|
|
</>
|
|
|
|
);
|
2021-05-20 21:54:03 +00:00
|
|
|
return (
|
|
|
|
<Modal
|
2022-09-27 20:24:21 +00:00
|
|
|
modalName="NeedsScreenRecordingPermissionsModal"
|
2021-05-20 21:54:03 +00:00
|
|
|
i18n={i18n}
|
|
|
|
title={i18n('calling__presenting--permission-title')}
|
|
|
|
theme={Theme.Dark}
|
2021-07-30 20:30:59 +00:00
|
|
|
onClose={toggleScreenRecordingPermissionsDialog}
|
2022-09-29 22:40:09 +00:00
|
|
|
modalFooter={footer}
|
2021-05-20 21:54:03 +00:00
|
|
|
>
|
|
|
|
<p>{i18n('calling__presenting--macos-permission-description')}</p>
|
|
|
|
<ol style={{ paddingLeft: 16 }}>
|
|
|
|
<li>{i18n('calling__presenting--permission-instruction-step1')}</li>
|
|
|
|
<li>{i18n('calling__presenting--permission-instruction-step2')}</li>
|
|
|
|
<li>{i18n('calling__presenting--permission-instruction-step3')}</li>
|
|
|
|
</ol>
|
|
|
|
</Modal>
|
|
|
|
);
|
2022-11-18 00:45:19 +00:00
|
|
|
}
|