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 React, { memo } from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
2021-08-19 22:56:29 +00:00
|
|
|
import { DialogNetworkStatus } from '../../components/DialogNetworkStatus';
|
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 {
|
|
|
|
getNetworkIsOnline,
|
|
|
|
getNetworkIsOutage,
|
|
|
|
getNetworkSocketStatus,
|
|
|
|
} from '../selectors/network';
|
|
|
|
import { useUserActions } from '../ducks/user';
|
2020-02-12 21:30:58 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
type SmartNetworkStatusProps = Readonly<{
|
|
|
|
containerWidthBreakpoint: WidthBreakpoint;
|
|
|
|
}>;
|
2020-02-12 21:30:58 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
export const SmartNetworkStatus = memo(function SmartNetworkStatus({
|
|
|
|
containerWidthBreakpoint,
|
|
|
|
}: SmartNetworkStatusProps) {
|
|
|
|
const i18n = useSelector(getIntl);
|
|
|
|
const isOnline = useSelector(getNetworkIsOnline);
|
|
|
|
const isOutage = useSelector(getNetworkIsOutage);
|
|
|
|
const socketStatus = useSelector(getNetworkSocketStatus);
|
|
|
|
const { manualReconnect } = useUserActions();
|
|
|
|
return (
|
|
|
|
<DialogNetworkStatus
|
|
|
|
containerWidthBreakpoint={containerWidthBreakpoint}
|
|
|
|
i18n={i18n}
|
|
|
|
isOnline={isOnline}
|
|
|
|
isOutage={isOutage}
|
|
|
|
socketStatus={socketStatus}
|
|
|
|
manualReconnect={manualReconnect}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
});
|