Skip to content

Commit

Permalink
fix: loading page
Browse files Browse the repository at this point in the history
  • Loading branch information
jimcase committed May 7, 2024
1 parent 0aa7c3c commit a028187
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
10 changes: 7 additions & 3 deletions src/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "@ionic/react";
import { StatusBar, Style } from "@capacitor/status-bar";
import { ScreenOrientation } from "@capacitor/screen-orientation";
import { Routes } from "../routes";
import { RoutePath, Routes } from "../routes";
import "./styles/ionic.scss";
import "./styles/style.scss";
import "./App.scss";
Expand All @@ -25,7 +25,7 @@ import { FullPageScanner } from "./pages/FullPageScanner";
import { OperationType } from "./globals/types";
import { IncomingRequest } from "./pages/IncomingRequest";
import { SetUserName } from "./components/SetUserName";
import { TabsRoutePath } from "../routes/paths";
import { PublicRoutes, TabsRoutePath } from "../routes/paths";
import { MobileHeaderPreview } from "./components/MobileHeaderPreview";
import { CustomToast } from "./components/CustomToast/CustomToast";
import { LockPage } from "./pages/LockPage/LockPage";
Expand Down Expand Up @@ -107,14 +107,18 @@ const App = () => {
}
};

const isPublicPage = PublicRoutes.includes(
window.location.pathname as RoutePath
);

return (
<IonApp>
<AppWrapper>
<StrictMode>
{stateCache.initialized ? (
<>
{renderApp()}
{!authentication.loggedIn ? <LockPage /> : null}
{!isPublicPage && !authentication.loggedIn ? <LockPage /> : null}
</>
) : (
<LoadingPage />
Expand Down
7 changes: 2 additions & 5 deletions src/ui/components/AppWrapper/AppWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,8 @@ const AppWrapper = (props: { children: ReactNode }) => {
const initApp = async () => {
// @TODO - foconnor: This is a temp hack for development to be removed pre-release.
// These items are removed from the secure storage on re-install to re-test the on-boarding for iOS devices.
let isInitialized;
try {
isInitialized = await PreferencesStorage.get(
PreferencesKeys.APP_ALREADY_INIT
);
await PreferencesStorage.get(PreferencesKeys.APP_ALREADY_INIT);
} catch (e) {
await SecureStorage.delete(KeyStoreKeys.APP_PASSCODE);
await SecureStorage.delete(KeyStoreKeys.IDENTITY_ENTROPY);
Expand All @@ -250,7 +247,7 @@ const AppWrapper = (props: { children: ReactNode }) => {
dispatch(setPauseQueueIncomingRequest(true));

await loadDatabase();
dispatch(setInitialized(isInitialized?.initialized as boolean));
dispatch(setInitialized(true));

Agent.agent.connections.onConnectionStateChanged((event) => {
return connectionStateChangedHandler(event, dispatch);
Expand Down
1 change: 0 additions & 1 deletion src/ui/pages/LoadingPage/LoadingPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
justify-content: center;
height: 100vh;
width: 100vw;
z-index: 2147483646;
}
9 changes: 2 additions & 7 deletions src/ui/pages/LockPage/LockPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,11 @@ const LockPage = () => {
});
};

const isPublicPage = PublicRoutes.includes(
window.location.pathname as RoutePath
);
const lockApp = !isPublicPage && !authentication.loggedIn;

return (
<ResponsivePageLayout
pageId={pageId}
activeStatus={lockApp}
customClass={`${lockApp ? "show" : "hide"} animation-off max-overlay`}
activeStatus={true}
customClass={"show animation-off max-overlay"}
>
<h2
className={`${pageId}-title`}
Expand Down

0 comments on commit a028187

Please sign in to comment.