Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning when user skips fw update during onboarding #15805

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions packages/suite/src/components/firmware/FirmwareInitial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import { selectDevices } from '@suite-common/wallet-core';
import { spacingsPx } from '@trezor/theme';
import { useFirmwareInstallation } from '@suite-common/firmware';

import { OnboardingStepBox, OnboardingButtonSkip } from 'src/components/onboarding';
import {
OnboardingStepBox,
OnboardingButtonSkip,
SkipStepConfirmation,
} from 'src/components/onboarding';
import { useDevice, useOnboarding, useSelector } from 'src/hooks/suite';
import { FirmwareInstallButton, FirmwareOffer } from 'src/components/firmware';

Expand Down Expand Up @@ -125,14 +129,15 @@ export const FirmwareInitial = ({
standaloneFwUpdate = false,
onClose,
}: FirmwareInitialProps) => {
const [bitcoinOnlyOffer, setBitcoinOnlyOffer] = useState(false);
const { device } = useDevice();
const { deviceWillBeWiped, firmwareUpdate, setStatus, targetFirmwareType } =
useFirmwareInstallation({
shouldSwitchFirmwareType,
});
const { goToNextStep, updateAnalytics } = useOnboarding();
const { updateAnalytics } = useOnboarding();
const devices = useSelector(selectDevices);
const [bitcoinOnlyOffer, setBitcoinOnlyOffer] = useState(false);
const [showSkipConfirmation, setShowSkipConfirmation] = useState(false);

// Just to satisfy TS, disconnected device should be handled upstream.
if (!device?.connected || !device?.features) {
Expand Down Expand Up @@ -342,7 +347,7 @@ export const FirmwareInitial = ({
// Fw update is not mandatory, show skip button
<OnboardingButtonSkip
onClick={() => {
goToNextStep();
setShowSkipConfirmation(true);
updateAnalytics({ firmware: 'skip' });
}}
data-testid="@firmware/skip-button"
Expand All @@ -356,6 +361,9 @@ export const FirmwareInitial = ({
if (content) {
return (
<>
{showSkipConfirmation && (
<SkipStepConfirmation onCancel={() => setShowSkipConfirmation(false)} />
)}
<OnboardingStepBox
image="FIRMWARE"
heading={content.heading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ type SkipModalContent = {

const getModalContent = (activeStepId: AnyStepId): SkipModalContent => {
switch (activeStepId) {
case STEP.ID_FIRMWARE_STEP:
return {
heading: <Translation id="TR_SKIP_UPDATE" />,
secondaryButtonText: <Translation id="TR_SKIP_UPDATE" />,
body: <Translation id="TR_SKIP_UPDATE_DESCRIPTION" />,
};
case STEP.ID_SECURITY_STEP:
case STEP.ID_BACKUP_STEP:
return {
Expand Down
5 changes: 5 additions & 0 deletions packages/suite/src/support/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3209,6 +3209,11 @@ export default defineMessages({
defaultMessage: 'Skip Update',
id: 'TR_SKIP_UPDATE',
},
TR_SKIP_UPDATE_DESCRIPTION: {
defaultMessage:
'It only takes a moment to stay protected. Keep your Trezor secure and future-ready by installing the latest firmware.',
id: 'TR_SKIP_UPDATE_DESCRIPTION',
},
TR_SOLVE_ISSUE: {
defaultMessage: 'Refresh',
id: 'TR_SOLVE_ISSUE',
Expand Down
Loading