Skip to content

Commit

Permalink
🐛(llm): completeOnboarding after LS sync (#8102)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasWerey authored Oct 16, 2024
1 parent e4c960b commit 63ec8f9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 38 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-cats-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Fix an issue during onboarding with ledger sync. completeOnboarding was never triggered
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function BaseOnboardingNavigator() {
<Stack.Screen
name={NavigatorName.WalletSync}
component={WalletSyncNavigator}
options={{ headerShown: false }}
options={{ headerShown: false, gestureEnabled: false }}
/>
</Stack.Navigator>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Props = {
onPress: () => void;
};

secondaryButton: {
secondaryButton?: {
label: string;
onPress: () => void;
};
Expand Down Expand Up @@ -49,10 +49,11 @@ export function Success({ title, desc, mainButton, secondaryButton, analyticsPag
{mainButton.label}
</Button>
)}

<Button type="main" outline onPress={secondaryButton.onPress}>
{secondaryButton.label}
</Button>
{secondaryButton && (
<Button type="main" outline onPress={secondaryButton.onPress}>
{secondaryButton.label}
</Button>
)}
</Flex>
</Flex>
</SafeAreaView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import { Flex, Text } from "@ledgerhq/native-ui";
import lottie from "~/screens/ReceiveFunds/assets/lottie.json";
import { useTheme } from "styled-components/native";
import { useTranslation } from "react-i18next";
import { useDispatch, useSelector } from "react-redux";
import { hasCompletedOnboardingSelector } from "~/reducers/settings";
import { completeOnboarding } from "~/actions/settings";
import PreventNativeBack from "~/components/PreventNativeBack";

type Props = BaseComposite<
StackNavigatorProps<WalletSyncNavigatorStackParamList, ScreenName.WalletSyncLoading>
Expand All @@ -20,12 +24,20 @@ export function ActivationLoading({ route }: Props) {
const { created } = route.params;
const { colors } = useTheme();
const { t } = useTranslation();
const dispatch = useDispatch();

const title = "walletSync.loading.title";
const subtitle = created ? "walletSync.loading.activation" : "walletSync.loading.synch";
useLoadingStep(created);
const hasCompletedOnboarding = useSelector(hasCompletedOnboardingSelector);

if (!hasCompletedOnboarding) {
dispatch(completeOnboarding());
}

return (
<>
<PreventNativeBack />
<TrackScreen category={AnalyticsPage.Loading} />
<GradientContainer
color={colors.background.main}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,24 @@ import { Success } from "../../components/Success";
import { useTranslation } from "react-i18next";
import { BaseComposite, StackNavigatorProps } from "~/components/RootNavigator/types/helpers";
import { WalletSyncNavigatorStackParamList } from "~/components/RootNavigator/types/WalletSyncNavigator";

import { NavigatorName, ScreenName } from "~/const";
import { useDispatch, useSelector } from "react-redux";
import { isFromLedgerSyncOnboardingSelector } from "~/reducers/settings";
import { setFromLedgerSyncOnboarding } from "~/actions/settings";
import { ScreenName } from "~/const";
import { AnalyticsButton, AnalyticsFlow, AnalyticsPage } from "../../hooks/useLedgerSyncAnalytics";
import { track } from "~/analytics";
import { setLedgerSyncActivateDrawer } from "~/actions/walletSync";
import { Steps } from "../../types/Activation";
import { useCurrentStep } from "../../hooks/useCurrentStep";
import { useClose } from "../../hooks/useClose";

type Props = BaseComposite<
StackNavigatorProps<WalletSyncNavigatorStackParamList, ScreenName.WalletSyncSuccess>
>;

export function ActivationSuccess({ navigation, route }: Props) {
export function ActivationSuccess({ route }: Props) {
const { t } = useTranslation();
const isFromLedgerSyncOnboarding = useSelector(isFromLedgerSyncOnboardingSelector);
const { created } = route.params;
const title = created ? "walletSync.success.activation" : "walletSync.success.sync";
const desc = created ? "" : "walletSync.success.syncDesc";
const page = created ? AnalyticsPage.BackupCreationSuccess : AnalyticsPage.SyncSuccess;
const dispatch = useDispatch();
const { setCurrentStep } = useCurrentStep();

const close = useClose();

function onSyncAnother(): void {
track("button_clicked", {
button: AnalyticsButton.SyncWithAnotherLedgerLive,
page,
flow: AnalyticsFlow.LedgerSync,
});
if (isFromLedgerSyncOnboarding) {
dispatch(setFromLedgerSyncOnboarding(false));
}
setCurrentStep(Steps.QrCodeMethod);
navigation.navigate(NavigatorName.Settings, {
screen: ScreenName.GeneralSettings,
});
dispatch(setLedgerSyncActivateDrawer(true));
}

function onClose(): void {
track("button_clicked", {
button: AnalyticsButton.Close,
Expand All @@ -61,10 +35,6 @@ export function ActivationSuccess({ navigation, route }: Props) {
title={t(title)}
desc={t(desc)}
mainButton={{
label: t("walletSync.success.syncAnother"),
onPress: onSyncAnother,
}}
secondaryButton={{
label: t("walletSync.success.close"),
onPress: onClose,
}}
Expand Down

0 comments on commit 63ec8f9

Please sign in to comment.