Something went wrong. Try again.
Effortlessly glide through your todos
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839import { useAuth } from '@clerk/expo';import { useEffect } from 'react';
import { useIsClerkConfigured } from '@/auth/clerk';import { setSubscriptionState } from '@/data/sync/entitlement';
/** * Free-sync mode: the sandbox app ("Glide Beta") gives every signed-in tester * Sync with no purchase. This flag only shapes the UI — the actual gate is the * SANDBOX_GRANT_ALL env var on the sandbox Convex deployment * (docs/release/environments.md). Production builds refuse the flag * (see validateProductionEnvironment in app.config.js). */const freeSyncEnabled = process.env.EXPO_PUBLIC_FREE_SYNC === '1';
export function isFreeSyncEnabled(): boolean { return freeSyncEnabled;}
/** * Mounts at the root beside RevenueCatBridge (inert without a RevenueCat key): * being signed in *is* the entitlement, so mirror auth state into the client * subscription view. The grace and billing states never occur in this mode. */export function FreeSyncBridge() { const clerkConfigured = useIsClerkConfigured(); if (!freeSyncEnabled || !clerkConfigured) return null; return <FreeSyncEntitlementLink />;}
function FreeSyncEntitlementLink() { const { isLoaded, isSignedIn } = useAuth(); useEffect(() => { if (!isLoaded) return; setSubscriptionState(isSignedIn ? 'subscribed' : 'free'); }, [isLoaded, isSignedIn]); return null;}