2021-01-14 18:07:05 +00:00
|
|
|
// Copyright 2020-2021 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-02-12 21:30:58 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import { Dialogs } from '../types/Dialogs';
|
|
|
|
import { Intl } from './Intl';
|
|
|
|
import { LocalizerType } from '../types/Util';
|
|
|
|
|
2021-01-14 18:07:05 +00:00
|
|
|
export type PropsType = {
|
2020-02-12 21:30:58 +00:00
|
|
|
ackRender: () => void;
|
|
|
|
dialogType: Dialogs;
|
2020-02-21 00:09:50 +00:00
|
|
|
didSnooze: boolean;
|
2020-02-12 21:30:58 +00:00
|
|
|
dismissDialog: () => void;
|
|
|
|
hasNetworkDialog: boolean;
|
|
|
|
i18n: LocalizerType;
|
2020-02-21 00:09:50 +00:00
|
|
|
showEventsCount: number;
|
|
|
|
snoozeUpdate: () => void;
|
2020-02-12 21:30:58 +00:00
|
|
|
startUpdate: () => void;
|
2021-01-14 18:07:05 +00:00
|
|
|
};
|
2020-02-12 21:30:58 +00:00
|
|
|
|
|
|
|
export const UpdateDialog = ({
|
|
|
|
ackRender,
|
|
|
|
dialogType,
|
2020-02-21 00:09:50 +00:00
|
|
|
didSnooze,
|
2020-02-12 21:30:58 +00:00
|
|
|
dismissDialog,
|
|
|
|
hasNetworkDialog,
|
|
|
|
i18n,
|
2020-02-21 00:09:50 +00:00
|
|
|
snoozeUpdate,
|
2020-02-12 21:30:58 +00:00
|
|
|
startUpdate,
|
|
|
|
}: PropsType): JSX.Element | null => {
|
|
|
|
React.useEffect(() => {
|
|
|
|
ackRender();
|
|
|
|
});
|
|
|
|
|
|
|
|
if (hasNetworkDialog) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-02-21 00:09:50 +00:00
|
|
|
if (dialogType === Dialogs.None) {
|
2020-02-12 21:30:58 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dialogType === Dialogs.Cannot_Update) {
|
|
|
|
return (
|
|
|
|
<div className="module-left-pane-dialog module-left-pane-dialog--warning">
|
|
|
|
<div className="module-left-pane-dialog__message">
|
|
|
|
<h3>{i18n('cannotUpdate')}</h3>
|
|
|
|
<span>
|
|
|
|
<Intl
|
|
|
|
components={[
|
|
|
|
<a
|
|
|
|
key="signal-download"
|
|
|
|
href="https://signal.org/download/"
|
|
|
|
rel="noreferrer"
|
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
https://signal.org/download/
|
|
|
|
</a>,
|
|
|
|
]}
|
|
|
|
i18n={i18n}
|
|
|
|
id="cannotUpdateDetail"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dialogType === Dialogs.MacOS_Read_Only) {
|
|
|
|
return (
|
|
|
|
<div className="module-left-pane-dialog module-left-pane-dialog--warning">
|
|
|
|
<div className="module-left-pane-dialog__message">
|
|
|
|
<h3>{i18n('cannotUpdate')}</h3>
|
|
|
|
<span>
|
|
|
|
<Intl
|
2020-07-29 23:20:05 +00:00
|
|
|
components={{
|
|
|
|
app: <strong key="app">Signal.app</strong>,
|
|
|
|
folder: <strong key="folder">/Applications</strong>,
|
|
|
|
}}
|
2020-02-12 21:30:58 +00:00
|
|
|
i18n={i18n}
|
|
|
|
id="readOnlyVolume"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div className="module-left-pane-dialog__actions">
|
2020-09-12 00:46:52 +00:00
|
|
|
<button type="button" onClick={dismissDialog}>
|
|
|
|
{i18n('ok')}
|
|
|
|
</button>
|
2020-02-12 21:30:58 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="module-left-pane-dialog">
|
|
|
|
<div className="module-left-pane-dialog__message">
|
|
|
|
<h3>{i18n('autoUpdateNewVersionTitle')}</h3>
|
|
|
|
<span>{i18n('autoUpdateNewVersionMessage')}</span>
|
|
|
|
</div>
|
|
|
|
<div className="module-left-pane-dialog__actions">
|
2020-02-21 00:09:50 +00:00
|
|
|
{!didSnooze && (
|
2020-02-12 21:30:58 +00:00
|
|
|
<button
|
2020-09-12 00:46:52 +00:00
|
|
|
type="button"
|
2020-02-12 21:30:58 +00:00
|
|
|
className="module-left-pane-dialog__button--no-border"
|
2020-02-21 00:09:50 +00:00
|
|
|
onClick={snoozeUpdate}
|
2020-02-12 21:30:58 +00:00
|
|
|
>
|
|
|
|
{i18n('autoUpdateLaterButtonLabel')}
|
|
|
|
</button>
|
|
|
|
)}
|
2020-09-12 00:46:52 +00:00
|
|
|
<button type="button" onClick={startUpdate}>
|
2020-02-12 21:30:58 +00:00
|
|
|
{i18n('autoUpdateRestartButtonLabel')}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|