import * as SecureStore from "expo-secure-store"; import { Platform } from "react-native"; const STORAGE_KEY = "matches_tutorial_seen"; async function getStorage(): Promise { try { let data: string | null = null; if (Platform.OS === "web") { if (typeof window !== "undefined" && typeof window.localStorage !== "undefined") { data = window.localStorage.getItem(STORAGE_KEY); } } else { data = await SecureStore.getItemAsync(STORAGE_KEY); } return data === "true"; } catch (error) { console.error("Error reading matches tutorial state:", error); } return false; } async function setStorage(seen: boolean): Promise { try { const data = seen ? "true" : "false"; if (Platform.OS === "web") { if (typeof window !== "undefined" && typeof window.localStorage !== "undefined") { window.localStorage.setItem(STORAGE_KEY, data); } } else { await SecureStore.setItemAsync(STORAGE_KEY, data); } } catch (error) { console.error("Error saving matches tutorial state:", error); } } export async function hasSeenMatchesTutorial(): Promise { return getStorage(); } export async function markMatchesTutorialSeen(): Promise { await setStorage(true); } export async function resetMatchesTutorial(): Promise { await setStorage(false); }