Skip to content

Commit

Permalink
fix: redirect to unlock screen from welcome flow if wallet is already…
Browse files Browse the repository at this point in the history
… setup (#2928)

Co-authored-by: René Aaron <[email protected]>
  • Loading branch information
pavanjoshi914 and reneaaron authored Dec 18, 2023
1 parent 5992f78 commit 9d5dee8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
5 changes: 2 additions & 3 deletions src/app/context/AccountContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ export function AccountProvider({ children }: { children: React.ReactNode }) {
if (!response.configured && !onWelcomePage) {
utils.openPage("welcome.html");
window.close();
} else if (response.configured && onWelcomePage) {
utils.redirectPage("options.html");
} else if (response.unlocked) {
if (response.configured && onWelcomePage) {
utils.redirectPage("options.html");
}
selectAccount(response.currentAccountId, true);
} else {
setAccount(null);
Expand Down
55 changes: 29 additions & 26 deletions src/app/router/Welcome/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useTranslation } from "react-i18next";
import { Outlet, Route, HashRouter as Router, Routes } from "react-router-dom";
import Container from "~/app/components/Container";
import Toaster from "~/app/components/Toast/Toaster";
import { AccountProvider } from "~/app/context/AccountContext";
import { SettingsProvider } from "~/app/context/SettingsContext";
import { getConnectorRoutes, renderRoutes } from "~/app/router/connectorRoutes";
import ChooseConnectorPath from "~/app/screens/connectors/ChooseConnectorPath";
Expand All @@ -17,34 +18,36 @@ const connectorRoutes = getConnectorRoutes();
function Welcome() {
return (
<SettingsProvider>
<Router>
<Toaster />
<Routes>
<Route path="/" element={<Layout />}>
<Route index element={<SetPassword />} />
<Route path="choose-path">
<Route index={true} element={<ChooseConnectorPath />}></Route>
<Route path="choose-connector">
<Route
index={true}
element={
<ChooseConnector
title={i18n.t("translation:choose_connector.title")}
description={i18n.t(
"translation:choose_connector.description"
)}
connectorRoutes={connectorRoutes}
/>
}
></Route>
{renderRoutes(connectorRoutes)}
<AccountProvider>
<Router>
<Toaster />
<Routes>
<Route path="/" element={<Layout />}>
<Route index element={<SetPassword />} />
<Route path="choose-path">
<Route index={true} element={<ChooseConnectorPath />}></Route>
<Route path="choose-connector">
<Route
index={true}
element={
<ChooseConnector
title={i18n.t("translation:choose_connector.title")}
description={i18n.t(
"translation:choose_connector.description"
)}
connectorRoutes={connectorRoutes}
/>
}
></Route>
{renderRoutes(connectorRoutes)}
</Route>
</Route>
<Route path="test-connection" element={<TestConnection />} />
<Route path="pin-extension" element={<PinExtension />} />
</Route>
<Route path="test-connection" element={<TestConnection />} />
<Route path="pin-extension" element={<PinExtension />} />
</Route>
</Routes>
</Router>
</Routes>
</Router>
</AccountProvider>
</SettingsProvider>
);
}
Expand Down

0 comments on commit 9d5dee8

Please sign in to comment.