* add SelectLangBtn * memoized objects that are created to reduce re-creation on re-render * add langs when uploading post * only send the top 3 languages otherwise backend will throw error * mv ContentLanguagesSettings to folder * add post languages settings modal and state * fix typos * modify feed manip to also check langs label on post * Fix tests * Remove log * Update feed-manip.ts * Fix syntax errors * UI tuneups * Show the currently selected languages in the composer * fix linting * Use a bcp-47 matching function * Fix a duplicate language issue * Fix web * Dont include lang in prompt * Make select language btn an observer * Keep device languages on top of language selection UIs * Fix android build settings * Enforce a max of 3 languages in posts * Fix tests * Fix types --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
18 lines
657 B
TypeScript
18 lines
657 B
TypeScript
import {Platform} from 'react-native'
|
|
import {getLocales} from 'expo-localization'
|
|
import {dedupArray} from 'lib/functions'
|
|
|
|
export const isIOS = Platform.OS === 'ios'
|
|
export const isAndroid = Platform.OS === 'android'
|
|
export const isNative = isIOS || isAndroid
|
|
export const isWeb = !isNative
|
|
export const isMobileWebMediaQuery = 'only screen and (max-width: 1230px)'
|
|
export const isMobileWeb =
|
|
isWeb &&
|
|
// @ts-ignore we know window exists -prf
|
|
global.window.matchMedia(isMobileWebMediaQuery)?.matches
|
|
export const isDesktopWeb = isWeb && !isMobileWeb
|
|
|
|
export const deviceLocales = dedupArray(
|
|
getLocales?.().map?.(locale => locale.languageCode),
|
|
)
|