Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feat/multiSigEnhanced
Browse files Browse the repository at this point in the history
  • Loading branch information
iFergal committed May 7, 2024
2 parents fee1d10 + 0aa7c3c commit a83f8b7
Show file tree
Hide file tree
Showing 21 changed files with 550 additions and 425 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"env": {
"browser": true,
"es2021": true,
"jest": true
"jest": true,
"node": true
},
"globals": {
"__dirname": true,
"NodeJS": true
"NodeJS": true,
"process": "readonly"
},
"extends": [
"eslint:recommended",
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@capacitor-community/barcode-scanner": "^4.0.1",
"@capacitor-community/sqlite": "^5.5.0",
"@capacitor/android": "^5.0.0",
"@capacitor/app": "^5.0.7",
"@capacitor/clipboard": "^5.0.0",
"@capacitor/core": "^5.0.0",
"@capacitor/ios": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
}
]
},
"lockmodal": {
"lockpage": {
"title": "Welcome back",
"description": "Please enter your passcode to login",
"error": "Incorrect passcode",
Expand Down
10 changes: 4 additions & 6 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
import React, { useEffect, useState } from "react";
import React, { useEffect } from "react";
import { IonReactRouter } from "@ionic/react-router";
import { IonRouterOutlet, IonSpinner } from "@ionic/react";
import { Redirect, Route, useLocation } from "react-router-dom";
import { IonRouterOutlet } from "@ionic/react";
import { Redirect, Route } from "react-router-dom";
import { Onboarding } from "../ui/pages/Onboarding";
import { GenerateSeedPhrase } from "../ui/pages/GenerateSeedPhrase";
import { SetPasscode } from "../ui/pages/SetPasscode";
import { VerifySeedPhrase } from "../ui/pages/VerifySeedPhrase";
import { CreatePassword } from "../ui/pages/CreatePassword";
import { useAppDispatch, useAppSelector } from "../store/hooks";
import {
getAuthentication,
getRoutes,
getStateCache,
setCurrentRoute,
} from "../store/reducers/stateCache";
import { getNextRoute } from "./nextRoute";
import { TabsMenu, tabsRoutes } from "../ui/components/navigation/TabsMenu";
import { PublicRoutes, RoutePath } from "./paths";
import { RoutePath } from "./paths";
import { IdentifierDetails } from "../ui/pages/IdentifierDetails";
import { CredentialDetails } from "../ui/pages/CredentialDetails";
import { ConnectionDetails } from "../ui/pages/ConnectionDetails";
import { LockModal } from "../ui/components/LockModal";

const Routes = () => {
const stateCache = useAppSelector(getStateCache);
Expand Down
14 changes: 2 additions & 12 deletions src/routes/nextRoute/nextRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,13 @@ import { RoutePath, TabsRoutePath } from "../paths";
import { ToastMsgType } from "../../ui/globals/types";

const getNextRootRoute = (store: StoreState) => {
const isInitialized = store.stateCache.initialized;
const authentication = store.stateCache.authentication;
const routes = store.stateCache.routes;
const initialRoute =
routes.some((route) => route.path === "/") || routes.length === 0;

let path;
if (routes.length === 1 && !isInitialized) {
path = RoutePath.ONBOARDING;
} else if (authentication.passcodeIsSet && authentication.seedPhraseIsSet) {
if (authentication.passcodeIsSet && authentication.seedPhraseIsSet) {
path = RoutePath.TABS_MENU;
} else {
if (initialRoute) {
path = RoutePath.ONBOARDING;
} else {
path = routes[0].path;
}
path = RoutePath.ONBOARDING;
}

return { pathname: path };
Expand Down
42 changes: 19 additions & 23 deletions src/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
getAuthentication,
getCurrentOperation,
getCurrentRoute,
getStateCache,
getToastMsg,
} from "../store/reducers/stateCache";
import { useAppSelector } from "../store/hooks";
Expand All @@ -27,19 +28,20 @@ import { SetUserName } from "./components/SetUserName";
import { TabsRoutePath } from "../routes/paths";
import { MobileHeaderPreview } from "./components/MobileHeaderPreview";
import { CustomToast } from "./components/CustomToast/CustomToast";
import { LockModal } from "./components/LockModal";
import { LockPage } from "./pages/LockPage/LockPage";
import { LoadingPage } from "./pages/LoadingPage/LoadingPage";

setupIonicReact();

const App = () => {
const stateCache = useAppSelector(getStateCache);
const authentication = useAppSelector(getAuthentication);
const currentRoute = useAppSelector(getCurrentRoute);
const [showSetUserName, setShowSetUserName] = useState(false);
const currentOperation = useAppSelector(getCurrentOperation);
const toastMsg = useAppSelector(getToastMsg);
const [showScan, setShowScan] = useState(false);
const [showToast, setShowToast] = useState(false);
const [lockIsRendered, setLockIsRendered] = useState(false);

const isPreviewMode = useMemo(
() => new URLSearchParams(window.location.search).has("browserPreview"),
Expand Down Expand Up @@ -97,33 +99,27 @@ const App = () => {
}, []);

const renderApp = () => {
if (!lockIsRendered) {
// We need to include the LockModal in the loading page to track when is rendered
return (
<>
<LockModal didEnter={() => setLockIsRendered(true)} />
<div className="loading-page">
<IonSpinner name="crescent" />
</div>
</>
);
} else {
return (
<>
{isPreviewMode ? <MobileHeaderPreview /> : null}
{showScan && <FullPageScanner setShowScan={setShowScan} />}
<Routes />
</>
);
}
return (
<>
{isPreviewMode ? <MobileHeaderPreview /> : null}
{showScan && <FullPageScanner setShowScan={setShowScan} />}
<Routes />
</>
);
};

return (
<IonApp>
<AppWrapper>
<StrictMode>
{lockIsRendered && !authentication.loggedIn ? <LockModal /> : null}
{renderApp()}
{stateCache.initialized ? (
<>
{renderApp()}
{!authentication.loggedIn ? <LockPage /> : null}
</>
) : (
<LoadingPage />
)}
<SetUserName
isOpen={showSetUserName}
setIsOpen={setShowSetUserName}
Expand Down

0 comments on commit a83f8b7

Please sign in to comment.