import Constants from 'expo-constants'; import * as Linking from 'expo-linking'; import { Alert, Platform } from 'react-native'; export function checkVersion(fetchedVersion: string) { const currentVersion = Constants.expoConfig?.version; console.log('currentVersion', currentVersion); console.log('fetchedVersion', fetchedVersion); if (currentVersion && currentVersion !== fetchedVersion) { Alert.alert( '請更新到最新版本', 'Please update to the latest version of the app to continue.', [ { text: '現在更新', onPress: () => { const url = Platform.OS === 'ios' ? 'https://apps.apple.com/app/crazy-charge/id6639612402' : 'https://play.google.com/store/apps/details?id=hk.com.crazycharge'; Linking.openURL(url); } } ], { cancelable: false } ); } }