Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use isTranslationSupported from expo-translate-text (#10108)

authored by

DS Boyce and committed by
GitHub
21d8b07b f08bf5fe

+6 -7
-3
src/env/index.ts
··· 49 49 export const IS_HIGH_DPI: boolean = true 50 50 // ideally we'd use isLiquidGlassAvailable() from expo-glass-effect but checking iOS version is good enough for now 51 51 export const IS_LIQUID_GLASS: boolean = iOSMajorVersion >= 26 52 - // So we can avoid attempting on-device translation when we know it's unsupported. 53 - export const HAS_ON_DEVICE_TRANSLATION: boolean = 54 - (IS_IOS && iOSMajorVersion >= 18) || IS_ANDROID
-1
src/env/index.web.ts
··· 48 48 '(min-resolution: 2dppx)', 49 49 ).matches 50 50 export const IS_LIQUID_GLASS: boolean = false 51 - export const HAS_ON_DEVICE_TRANSLATION: boolean = false
+6 -3
src/lib/translation/index.tsx
··· 1 1 import {useCallback, useContext, useEffect, useMemo, useState} from 'react' 2 2 import {LayoutAnimation, Platform} from 'react-native' 3 3 import {getLocales} from 'expo-localization' 4 - import {onTranslateTask} from '@bsky.app/expo-translate-text' 4 + import { 5 + isTranslationSupported, 6 + onTranslateTask, 7 + } from '@bsky.app/expo-translate-text' 5 8 import {type TranslationTaskResult} from '@bsky.app/expo-translate-text/build/ExpoTranslateText.types' 6 9 import {useLingui} from '@lingui/react/macro' 7 10 import {useFocusEffect} from '@react-navigation/native' ··· 9 12 import {useGoogleTranslate} from '#/lib/hooks/useGoogleTranslate' 10 13 import {logger} from '#/logger' 11 14 import {useAnalytics} from '#/analytics' 12 - import {HAS_ON_DEVICE_TRANSLATION, IS_ANDROID, IS_IOS} from '#/env' 15 + import {IS_ANDROID, IS_IOS} from '#/env' 13 16 import {Context} from './context' 14 17 import { 15 18 type ContextType, ··· 232 235 googleTranslate: shouldForceGoogleTranslate, 233 236 }) 234 237 235 - if (shouldForceGoogleTranslate || !HAS_ON_DEVICE_TRANSLATION) { 238 + if (shouldForceGoogleTranslate || !isTranslationSupported()) { 236 239 await googleTranslate( 237 240 text, 238 241 expectedTargetLanguage,