-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/wallet sync loading screen on initialization (#7691)
feat(llm/lld): wallet sync loading screen added on initialization
- Loading branch information
1 parent
fb9466a
commit ce18c9b
Showing
25 changed files
with
246 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"ledger-live-desktop": minor | ||
"live-mobile": minor | ||
"@ledgerhq/live-wallet": minor | ||
"@ledgerhq/trustchain": minor | ||
"@ledgerhq/web-tools": minor | ||
--- | ||
|
||
Ledger Sync - Added a Loading screen on LLM and LLD when initializing ledger sync while accounts are synchronizing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
apps/ledger-live-desktop/src/newArch/features/WalletSync/hooks/useLoadingStep.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useEffect, useState } from "react"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { setFlow } from "~/renderer/actions/walletSync"; | ||
import { walletSyncFlowSelector, walletSyncNextStepSelector } from "~/renderer/reducers/walletSync"; | ||
import { useWalletSyncUserState } from "../components/WalletSyncContext"; | ||
import { useFeature } from "@ledgerhq/live-common/featureFlags/index"; | ||
|
||
export function useLoadingStep() { | ||
const dispatch = useDispatch(); | ||
const [waitedWatchLoop, setWaitedWatchLoop] = useState(false); | ||
const { visualPending } = useWalletSyncUserState(); | ||
const nextStep = useSelector(walletSyncNextStepSelector); | ||
const flow = useSelector(walletSyncFlowSelector); | ||
const featureWalletSync = useFeature("lldWalletSync"); | ||
const initialTimeout = featureWalletSync?.params?.watchConfig?.initialTimeout || 1000; | ||
const visualPendingTimeout = 1000; | ||
|
||
useEffect(() => { | ||
const timeout = setTimeout( | ||
() => { | ||
setWaitedWatchLoop(true); | ||
}, | ||
initialTimeout + visualPendingTimeout + 500, | ||
); | ||
|
||
return () => { | ||
clearTimeout(timeout); | ||
}; | ||
}, [initialTimeout]); | ||
|
||
useEffect(() => { | ||
if (waitedWatchLoop && !visualPending && nextStep) { | ||
dispatch( | ||
setFlow({ | ||
flow, | ||
step: nextStep, | ||
nextStep: null, | ||
hasTrustchainBeenCreated: null, | ||
}), | ||
); | ||
} | ||
}, [waitedWatchLoop, visualPending, dispatch, flow, nextStep]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...ledger-live-desktop/src/newArch/features/WalletSync/screens/Activation/04-LoadingStep.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from "react"; | ||
import Loading from "../../components/LoadingStep"; | ||
import { useTranslation } from "react-i18next"; | ||
import { AnalyticsPage } from "../../hooks/useLedgerSyncAnalytics"; | ||
import TrackPage from "~/renderer/analytics/TrackPage"; | ||
import { useLoadingStep } from "../../hooks/useLoadingStep"; | ||
import { walletSyncHasTrustchainBeenCreatedSelector } from "~/renderer/reducers/walletSync"; | ||
import { useSelector } from "react-redux"; | ||
|
||
export default function ActivationLoadingStep() { | ||
useLoadingStep(); | ||
const hasTrustchainBeenCreated = useSelector(walletSyncHasTrustchainBeenCreatedSelector); | ||
const { t } = useTranslation(); | ||
const title = "walletSync.loading.title"; | ||
const subtitle = hasTrustchainBeenCreated | ||
? "walletSync.loading.activation" | ||
: "walletSync.loading.synch"; | ||
|
||
return ( | ||
<> | ||
<TrackPage category={String(AnalyticsPage.Loading)} /> | ||
<Loading title={t(title)} subtitle={t(subtitle)} /> | ||
</> | ||
); | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.