diff --git a/frontend/src/ProtectedRoute.tsx b/frontend/src/ProtectedRoute.tsx index 16a381a..66226cb 100644 --- a/frontend/src/ProtectedRoute.tsx +++ b/frontend/src/ProtectedRoute.tsx @@ -2,6 +2,7 @@ import { type Component, type JSX, Show } from "solid-js"; import { jwtDecode } from "jwt-decode"; import { Navigate } from "@solidjs/router"; import { save_token } from "tauri-plugin-ios-shared-token-api"; +import { platform } from "@tauri-apps/plugin-os"; export const isTokenValid = (): boolean => { const token = localStorage.getItem("access"); @@ -29,9 +30,14 @@ export const ProtectedRoute: Component<{ children?: JSX.Element }> = ( throw new Error("unreachable"); } - save_token(token) - .then(() => console.log("Saved token!!!")) - .catch((e) => console.error(e)); + if (platform() === "ios") { + // iOS share extension is a seperate process to the App. + // Therefore, we need to share our access token somewhere both the App & Share Extension can access + // This involves App Groups. + save_token(token) + .then(() => console.log("Saved token!!!")) + .catch((e) => console.error(e)); + } } return (