// apps/mobile/lib/supabase.ts // React Native용 Supabase 클라이언트 — AsyncStorage 어댑터 + URL polyfill import 'react-native-url-polyfill/auto' import AsyncStorage from '@react-native-async-storage/async-storage' import { createClient } from '@supabase/supabase-js' import Constants from 'expo-constants' const supabaseUrl = (Constants.expoConfig?.extra?.supabaseUrl as string | undefined) ?? '' const supabaseAnonKey = (Constants.expoConfig?.extra?.supabaseAnonKey as string | undefined) ?? '' if (!supabaseUrl || !supabaseAnonKey) { // env 미설정 — placeholder로 client 생성, 런타임에 isConfigured 체크 } export const supabase = createClient( supabaseUrl || 'https://placeholder.supabase.co', supabaseAnonKey || 'placeholder-anon-key', { auth: { storage: AsyncStorage, autoRefreshToken: true, persistSession: true, detectSessionInUrl: false } } ) export function isSupabaseConfigured(): boolean { return Boolean(supabaseUrl && supabaseAnonKey) }