diff --git a/front/apps/mobile/app/index.tsx b/front/apps/mobile/app/(app)/index.tsx
similarity index 86%
rename from front/apps/mobile/app/index.tsx
rename to front/apps/mobile/app/(app)/index.tsx
index ecef0601..21c1f3b6 100644
--- a/front/apps/mobile/app/index.tsx
+++ b/front/apps/mobile/app/(app)/index.tsx
@@ -18,6 +18,7 @@
* along with Kyoo. If not, see .
*/
-import { HomePage } from "@kyoo/ui";
+import { HomePage, BrowsePage } from "@kyoo/ui";
+import { withRoute } from "../utils";
-export default HomePage;
+export default withRoute(BrowsePage);
diff --git a/front/apps/mobile/app/(public)/_layout.tsx b/front/apps/mobile/app/(public)/_layout.tsx
new file mode 100644
index 00000000..b33bbabe
--- /dev/null
+++ b/front/apps/mobile/app/(public)/_layout.tsx
@@ -0,0 +1,41 @@
+/*
+ * Kyoo - A portable and vast media library solution.
+ * Copyright (c) Kyoo.
+ *
+ * See AUTHORS.md and LICENSE file in the project root for full license information.
+ *
+ * Kyoo is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * Kyoo is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Kyoo. If not, see .
+ */
+
+import { NavbarTitle } from "@kyoo/ui";
+import { Stack } from "expo-router";
+import { useTheme } from "yoshiki/native";
+
+export default function PublicLayout() {
+ const theme = useTheme();
+ return (
+ ,
+ contentStyle: {
+ backgroundColor: theme.background,
+ },
+ headerStyle: {
+ backgroundColor: theme.accent,
+ },
+ headerTintColor: theme.colors.white,
+ }}
+ />
+ );
+}
diff --git a/front/apps/mobile/app/connection-error.tsx b/front/apps/mobile/app/(public)/connection-error.tsx
similarity index 100%
rename from front/apps/mobile/app/connection-error.tsx
rename to front/apps/mobile/app/(public)/connection-error.tsx
diff --git a/front/apps/mobile/app/login/index.tsx b/front/apps/mobile/app/(public)/login/index.tsx
similarity index 100%
rename from front/apps/mobile/app/login/index.tsx
rename to front/apps/mobile/app/(public)/login/index.tsx
diff --git a/front/apps/mobile/app/register/index.tsx b/front/apps/mobile/app/(public)/register/index.tsx
similarity index 100%
rename from front/apps/mobile/app/register/index.tsx
rename to front/apps/mobile/app/(public)/register/index.tsx
diff --git a/front/apps/mobile/app/utils.tsx b/front/apps/mobile/app/utils.tsx
index fb201bac..a8043324 100644
--- a/front/apps/mobile/app/utils.tsx
+++ b/front/apps/mobile/app/utils.tsx
@@ -23,6 +23,8 @@ import { ComponentType, useEffect } from "react";
import { StatusBar, StatusBarProps } from "react-native";
import * as ScreenOrientation from "expo-screen-orientation";
import * as NavigationBar from "expo-navigation-bar";
+import arrayShuffle from "array-shuffle";
+import { QueryPage } from "@kyoo/models";
const FullscreenProvider = () => {
useEffect(() => {
@@ -52,7 +54,12 @@ export const withRoute = (
{routeOptions && }
{statusBar && }
{fullscreen && }
-
+
>
);
};
diff --git a/front/packages/models/src/query.tsx b/front/packages/models/src/query.tsx
index a7364c49..524f7255 100644
--- a/front/packages/models/src/query.tsx
+++ b/front/packages/models/src/query.tsx
@@ -31,19 +31,12 @@ import { KyooErrors } from "./kyoo-errors";
import { Page, Paged } from "./page";
import { Platform } from "react-native";
import { getToken } from "./login";
+import { getCurrentAccount } from "./account-internal";
const kyooUrl =
- Platform.OS !== "web"
- ? process.env.PUBLIC_BACK_URL
- : typeof window === "undefined"
- ? process.env.KYOO_URL ?? "http://localhost:5000"
- : "/api";
-
-export let kyooApiUrl: string | null = kyooUrl || null;
-
-export const setApiUrl = (apiUrl: string) => {
- kyooApiUrl = apiUrl;
-};
+ typeof window === "undefined" ? process.env.KYOO_URL ?? "http://localhost:5000" : "/api";
+// The url of kyoo, set after each query (used by the image parser).
+export let kyooApiUrl = kyooUrl;
export const queryFn = async (
context:
@@ -60,8 +53,7 @@ export const queryFn = async (
token?: string | null,
): Promise => {
// @ts-ignore
- let url: string | null = context.apiUrl ?? kyooApiUrl;
- if (!url) console.error("Kyoo's url is not defined.");
+ const url = context.apiUrl ?? (Platform.OS === "web" ? kyooUrl : getCurrentAccount()!.apiUrl);
kyooApiUrl = url;
// @ts-ignore
@@ -71,8 +63,8 @@ export const queryFn = async (
"path" in context
? (context.path.filter((x) => x) as string[])
: "pageParam" in context && context.pageParam
- ? [context.pageParam as string]
- : (context.queryKey.filter((x) => x) as string[]),
+ ? [context.pageParam as string]
+ : (context.queryKey.filter((x) => x) as string[]),
)
.join("/")
.replace("/?", "?");
@@ -93,7 +85,7 @@ export const queryFn = async (
signal: controller?.signal,
});
} catch (e) {
- console.log("Fetch error", e);
+ console.log("Fetch error", e, path);
throw { errors: ["Could not reach Kyoo's server."] } as KyooErrors;
}
if (resp.status === 404) {