Move /platform/detection vars into /env (#9707)

* Add platform vars to env

* Replace /platform/detection with /env
This commit is contained in:
Eric Bailey
2026-01-16 16:28:17 -06:00
committed by GitHub
parent bd510d8468
commit 0589bd7d9e
244 changed files with 789 additions and 789 deletions
+4 -4
View File
@@ -18,7 +18,7 @@ import {Buffer} from 'buffer'
import {POST_IMG_MAX} from '#/lib/constants'
import {logger} from '#/logger'
import {isAndroid, isIOS} from '#/platform/detection'
import {IS_ANDROID, IS_IOS} from '#/env'
import {type PickerImage} from './picker.shared'
import {type Dimensions} from './types'
@@ -108,7 +108,7 @@ export async function saveImageToMediaLibrary({uri}: {uri: string}) {
// save
try {
if (isAndroid) {
if (IS_ANDROID) {
// android triggers an annoying permission prompt if you try and move an image
// between albums. therefore, we need to either create the album with the image
// as the starting image, or put it directly into the album
@@ -305,7 +305,7 @@ function joinPath(a: string, b: string) {
}
function normalizePath(str: string, allPlatforms = false): string {
if (isAndroid || allPlatforms) {
if (IS_ANDROID || allPlatforms) {
if (!str.startsWith('file://')) {
return `file://${str}`
}
@@ -328,7 +328,7 @@ export async function saveToDevice(
type: string,
) {
try {
if (isIOS) {
if (IS_IOS) {
await withTempFile(filename, encoded, async tmpFileUrl => {
await Sharing.shareAsync(tmpFileUrl, {UTI: type})
})
+3 -3
View File
@@ -5,9 +5,9 @@ import {
} from 'expo-image-picker'
import {t} from '@lingui/macro'
import {isIOS, isWeb} from '#/platform/detection'
import {type ImageMeta} from '#/state/gallery'
import * as Toast from '#/view/com/util/Toast'
import {IS_IOS, IS_WEB} from '#/env'
import {VIDEO_MAX_DURATION_MS} from '../constants'
import {getDataUriSize} from './util'
@@ -53,8 +53,8 @@ export async function openUnifiedPicker({
quality: 1,
allowsMultipleSelection: true,
legacy: true,
base64: isWeb,
selectionLimit: isIOS ? selectionCountRemaining : undefined,
base64: IS_WEB,
selectionLimit: IS_IOS ? selectionCountRemaining : undefined,
preferredAssetRepresentationMode:
UIImagePickerPreferredAssetRepresentationMode.Automatic,
videoMaxDuration: VIDEO_MAX_DURATION_MS / 1000,
+2 -2
View File
@@ -2,8 +2,8 @@ import {useCallback} from 'react'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {isNative} from '#/platform/detection'
import * as Toast from '#/components/Toast'
import {IS_NATIVE} from '#/env'
import {saveImageToMediaLibrary} from './manip'
/**
@@ -16,7 +16,7 @@ export function useSaveImageToMediaLibrary() {
const {_} = useLingui()
return useCallback(
async (uri: string) => {
if (!isNative) {
if (!IS_NATIVE) {
throw new Error('useSaveImageToMediaLibrary is native only')
}
+2 -2
View File
@@ -3,8 +3,8 @@ import * as MediaLibrary from 'expo-media-library'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {isNative} from '#/platform/detection'
import * as Toast from '#/components/Toast'
import {IS_NATIVE} from '#/env'
import {saveImageToMediaLibrary} from './manip'
/**
@@ -18,7 +18,7 @@ export function useSaveImageToMediaLibrary() {
})
return useCallback(
async (uri: string) => {
if (!isNative) {
if (!IS_NATIVE) {
throw new Error('useSaveImageToMediaLibrary is native only')
}