import { api } from '@/services/api'; import Constants from 'expo-constants'; import { Platform } from 'react-native'; export type VersionInfo = { latestVersion: string; appStoreUrl: string; needsUpdate: boolean; updateMessage?: string; releaseNotes?: string; }; export function getCurrentAppVersion(): string { return Constants.expoConfig?.version || Constants.nativeAppVersion || '0.0.0'; } function getPlatformParam(): 'ios' | 'android' | undefined { if (Platform.OS === 'ios') return 'ios'; if (Platform.OS === 'android') return 'android'; return undefined; } export async function fetchVersionInfo( platformOverride?: 'ios' | 'android' ): Promise { const platform = platformOverride || getPlatformParam(); const query = platform ? `?platform=${platform}` : ''; return await api.get(`/users/version-check${query}`); }