2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import React, { memo } from 'react';
|
2021-08-19 22:56:29 +00:00
|
|
|
import { DialogUpdate } from '../../components/DialogUpdate';
|
2020-02-12 21:30:58 +00:00
|
|
|
import { getIntl } from '../selectors/user';
|
2021-10-12 23:59:08 +00:00
|
|
|
import type { WidthBreakpoint } from '../../components/_util';
|
2024-03-13 20:44:13 +00:00
|
|
|
import { useUpdatesActions } from '../ducks/updates';
|
|
|
|
import {
|
|
|
|
getUpdateDialogType,
|
|
|
|
getUpdateDownloadSize,
|
|
|
|
getUpdateDownloadedSize,
|
|
|
|
getUpdateVersion,
|
|
|
|
} from '../selectors/updates';
|
2020-02-12 21:30:58 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
type SmartUpdateDialogProps = Readonly<{
|
|
|
|
containerWidthBreakpoint: WidthBreakpoint;
|
|
|
|
}>;
|
2021-10-12 23:59:08 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
export const SmartUpdateDialog = memo(function SmartUpdateDialog({
|
|
|
|
containerWidthBreakpoint,
|
|
|
|
}: SmartUpdateDialogProps) {
|
|
|
|
const i18n = useSelector(getIntl);
|
|
|
|
const { dismissDialog, snoozeUpdate, startUpdate } = useUpdatesActions();
|
|
|
|
const dialogType = useSelector(getUpdateDialogType);
|
|
|
|
const downloadSize = useSelector(getUpdateDownloadSize);
|
|
|
|
const downloadedSize = useSelector(getUpdateDownloadedSize);
|
|
|
|
const version = useSelector(getUpdateVersion);
|
|
|
|
return (
|
|
|
|
<DialogUpdate
|
|
|
|
i18n={i18n}
|
|
|
|
containerWidthBreakpoint={containerWidthBreakpoint}
|
|
|
|
dialogType={dialogType}
|
|
|
|
downloadSize={downloadSize}
|
|
|
|
downloadedSize={downloadedSize}
|
|
|
|
version={version}
|
|
|
|
currentVersion={window.getVersion()}
|
|
|
|
dismissDialog={dismissDialog}
|
|
|
|
snoozeUpdate={snoozeUpdate}
|
|
|
|
startUpdate={startUpdate}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
});
|