Skip to content

Commit

Permalink
chore(connect): get rid of latest bridge version logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed Feb 28, 2025
1 parent 26ddbf8 commit 8aa8f38
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 76 deletions.
48 changes: 0 additions & 48 deletions packages/connect/src/data/__tests__/transportInfo.test.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/connect/src/data/transportInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const info: BridgeInfo = {
changelog: '',
};

export const getBridgeInfo = (): BridgeInfo => info;
const getBridgeInfo = (): BridgeInfo => info;

export const suggestBridgeInstaller = (platform?: string): BridgeInfo => {
const info2 = getBridgeInfo();
Expand Down
6 changes: 1 addition & 5 deletions packages/connect/src/device/TransportList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import type { AbstractTransportParams } from '@trezor/transport/src/transports/abstract';

import { ERRORS } from '../constants';
import { getBridgeInfo } from '../data/transportInfo';
import { ConnectSettingsTransport } from '../types';

type Params = AbstractTransportParams & { sessionsBackgroundUrl?: string | null };
Expand All @@ -32,10 +31,7 @@ const getOrCreateTransport = (
case 'NodeUsbTransport':
return new NodeUsbTransport(params);
case 'BridgeTransport':
return new BridgeTransport({
latestVersion: getBridgeInfo().version.join('.'),
...params,
});
return new BridgeTransport(params);
case 'UdpTransport':
return new UdpTransport(params);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { goto } from 'src/actions/suite/routerActions';
import { Translation } from 'src/components/suite';
import { useDispatch } from 'src/hooks/suite';

export const UpdateBridge = () => {
export const BridgeDeprecated = () => {
const dispatch = useDispatch();

return (
Expand All @@ -13,14 +13,16 @@ export const UpdateBridge = () => {
variant="info"
rightContent={
<Banner.Button
onClick={() => dispatch(goto('suite-bridge'))}
data-testid="@notification/update-bridge/button"
onClick={() => dispatch(goto('suite-bridge-deprecated'))}
data-testid="@notification/bridge-deprecated/button"
>
<Translation id="TR_SHOW_DETAILS" />
{/* todo: translation is "update now" is that ok? */}
{/* <Translation id="TR_SHOW_DETAILS" /> */}
Show details
</Banner.Button>
}
>
<Translation id="TR_NEW_TREZOR_BRIDGE_IS_AVAILABLE" />
<Translation id="TR_YOUR_BRIDGE_VERSION_WILL_SOON_BE_DEPRECATED" />
</Banner>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import styled from 'styled-components';

import { selectBannerMessage } from '@suite-common/message-system';
import { selectSelectedDevice } from '@suite-common/wallet-core';
import { isDesktop } from '@trezor/env-utils';
import { spacingsPx } from '@trezor/theme';

import { MAX_CONTENT_WIDTH } from 'src/constants/suite/layout';
Expand All @@ -24,7 +23,7 @@ import { NoBackup } from './NoBackupBanner';
import { NoConnectionBanner } from './NoConnectionBanner';
import { SafetyChecksBanner } from './SafetyChecksBanner';
import { TranslationMode } from './TranslationModeBanner';
import { UpdateBridge } from './UpdateBridgeBanner';
import { BridgeDeprecated } from './BridgeDeprecatedBanner';

const Container = styled.div<{ $isVisible?: boolean }>`
width: 100%;
Expand All @@ -51,18 +50,6 @@ export const SuiteBanners = () => {
setSafetyChecksDismissed(false);
}, [device?.features?.safety_checks]);

const showUpdateBridge = () => {
if (
isDesktop() &&
bridge?.version &&
['2.0.27', '2.0.28', '2.0.29'].includes(bridge.version)
) {
return false;
}

return bridge?.outdated;
};

let banner = null;
let priority = 0;
// this handles firmware hash being invalid after a firmware update, not the regular firmware hash check
Expand Down Expand Up @@ -93,8 +80,8 @@ export const SuiteBanners = () => {
// Let the user dismiss the warning.
banner = <SafetyChecksBanner onDismiss={() => setSafetyChecksDismissed(true)} />;
priority = 50;
} else if (showUpdateBridge()) {
banner = <UpdateBridge />;
} else if (bridge?.outdated || true) {
banner = <BridgeDeprecated />;
priority = 30;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Recovery } from 'src/views/recovery';
import { SwitchDevice } from 'src/views/suite/SwitchDevice/SwitchDevice';
import { BridgeUnavailable } from 'src/views/suite/bridge';
import { BridgeRequested } from 'src/views/suite/bridge-requested';
import { BridgeDeprecated } from 'src/views/suite/bridge-deprecated';
import { UdevRules } from 'src/views/suite/udev';
import { Version } from 'src/views/suite/version';

Expand All @@ -26,6 +27,7 @@ const getForegroundApp = (app: ForegroundAppRoute['app']) => {
version: Version,
bridge: BridgeUnavailable,
'bridge-requested': BridgeRequested,
'bridge-deprecated': BridgeDeprecated,
udev: UdevRules,
'switch-device': SwitchDevice,
recovery: Recovery,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export const UserContextModal = ({
<PassphraseDuplicateModal device={payload.device} duplicate={payload.duplicate} />
);
case 'review-transaction':
return <TransactionReviewModal {...payload} />;
case 'review-transaction-rbf-previous-transaction-mined-error':
return <TransactionReviewModal {...payload} />;
case 'cardano-withdraw-modal':
Expand Down
1 change: 1 addition & 0 deletions packages/suite/src/hooks/suite/usePreferredModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const hasPriority = (route: ForegroundAppRoute) => {
'firmware-custom': true,
bridge: true,
'bridge-requested': true,
'bridge-deprecated': true,
udev: true,
version: true,
'create-multi-share-backup': true,
Expand Down
9 changes: 9 additions & 0 deletions packages/suite/src/support/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9543,4 +9543,13 @@ export default defineMessages({
id: 'TR_CONNECT_BLUETOOTH_BUTTON',
defaultMessage: 'Connect Trezor Safe 7 via Bluetooth',
},
TR_YOUR_BRIDGE_VERSION_WILL_SOON_BE_DEPRECATED: {
id: 'TR_YOUR_BRIDGE_VERSION_WILL_SOON_BE_DEPRECATED',
defaultMessage: 'Your Trezor Bridge version will soon be deprecated.',
},
TR_BRIDGE_UNINSTALL_INSTRUCTIONS: {
id: 'TR_BRIDGE_UNINSTALL_INSTRUCTIONS',
defaultMessage:
'You are running a very old and soon to be deprecated Trezor Bridge version. Please uninstall it from your system. {link}',
},
});
42 changes: 42 additions & 0 deletions packages/suite/src/views/suite/bridge-deprecated/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Button, Link } from '@trezor/components';
import { UNINSTALL_BRIDGE_URL } from '@trezor/urls';
import { goto } from 'src/actions/suite/routerActions';
import { Metadata, Modal, Translation } from 'src/components/suite';
import { useDispatch, useLayout } from 'src/hooks/suite';

export const BridgeDeprecated = () => {
const dispatch = useDispatch();

const goToWallet = () => dispatch(goto('wallet-index'));

useLayout('Bridge');

return (
<Modal
heading={'Unsupported Trezor Bridge version detected'}
description={
<Translation
id="TR_BRIDGE_UNINSTALL_INSTRUCTIONS"
values={{
link: <Link href={UNINSTALL_BRIDGE_URL} variant="underline" />,
}}
/>
}
isHeadingCentered
bottomBarComponents={
<>
<Button
icon="caretLeft"
variant="tertiary"
onClick={() => goToWallet()}
data-testid="@bridge/goto/wallet-index"
>
<Translation id="TR_TAKE_ME_BACK_TO_WALLET" />
</Button>
</>
}
>
<Metadata title="Bridge | Trezor Suite" />
</Modal>
);
};

0 comments on commit 8aa8f38

Please sign in to comment.