fix onion path since moved to redux

pull/1703/head
Audric Ackermann 4 years ago
parent 651921590c
commit 0d11dab622
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -7,7 +7,7 @@ import { getTheme } from '../state/selectors/theme';
import Electron from 'electron'; import Electron from 'electron';
const { shell } = Electron; const { shell } = Electron;
import { useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { StateType } from '../state/reducer'; import { StateType } from '../state/reducer';
import { SessionIcon, SessionIconButton, SessionIconSize, SessionIconType } from './session/icon'; import { SessionIcon, SessionIconButton, SessionIconSize, SessionIconType } from './session/icon';
@ -18,10 +18,9 @@ import countryLookup from 'country-code-lookup';
import { useTheme } from 'styled-components'; import { useTheme } from 'styled-components';
import { useNetwork } from '../hooks/useNetwork'; import { useNetwork } from '../hooks/useNetwork';
import { Snode } from '../data/data'; import { Snode } from '../data/data';
import { onionPathModal } from '../state/ducks/modalDialog';
export type OnionPathModalType = { export type OnionPathModalType = {
onConfirm?: () => void;
onClose?: () => void;
confirmText?: string; confirmText?: string;
cancelText?: string; cancelText?: string;
title?: string; title?: string;
@ -33,7 +32,7 @@ export type StatusLightType = {
color?: string; color?: string;
}; };
const OnionPathModalInner = (props: any) => { const OnionPathModalInner = () => {
const onionNodes = useSelector((state: StateType) => state.onionPaths.snodePath); const onionNodes = useSelector((state: StateType) => state.onionPaths.snodePath);
const onionPath = onionNodes; const onionPath = onionNodes;
// including the device and destination in calculation // including the device and destination in calculation
@ -173,17 +172,18 @@ export const OnionPathModal = (props: OnionPathModalType) => {
const onConfirm = () => { const onConfirm = () => {
void shell.openExternal('https://getsession.org/faq/#onion-routing'); void shell.openExternal('https://getsession.org/faq/#onion-routing');
}; };
const dispatch = useDispatch();
return ( return (
// tslint:disable-next-line: use-simple-attributes // tslint:disable-next-line: use-simple-attributes
<SessionWrapperModal <SessionWrapperModal
title={props.title || window.i18n('onionPathIndicatorTitle')} title={window.i18n('onionPathIndicatorTitle')}
confirmText={props.confirmText || window.i18n('learnMore')} confirmText={window.i18n('learnMore')}
cancelText={props.cancelText || window.i18n('cancel')} cancelText={window.i18n('cancel')}
onConfirm={onConfirm} onConfirm={onConfirm}
onClose={props.onClose} onClose={() => dispatch(onionPathModal(null))}
showExitIcon={true} showExitIcon={true}
> >
<OnionPathModalInner {...props} /> <OnionPathModalInner />
</SessionWrapperModal> </SessionWrapperModal>
); );
}; };

Loading…
Cancel
Save