Rename image size config constants
IMAGE_SIZE_CONFIG_POSTS (4000px/2MB) and IMAGE_SIZE_CONFIG_2K_1MB (2000px/1MB), replacing POST_IMG_MAX_SIZE and PROFILE_IMAGES_MAX_SIZE. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import * as MediaLibrary from 'expo-media-library'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
|
||||
import {POST_IMG_MAX_SIZE} from '#/lib/constants'
|
||||
import {IMAGE_SIZE_CONFIG_POSTS} from '#/lib/constants'
|
||||
import {useCameraPermission} from '#/lib/hooks/usePermissions'
|
||||
import {openCamera} from '#/lib/media/picker'
|
||||
import {logger} from '#/logger'
|
||||
@@ -35,7 +35,7 @@ export function OpenCameraBtn({disabled, onAdd}: Props) {
|
||||
}
|
||||
|
||||
const img = await openCamera({
|
||||
aspect: [POST_IMG_MAX_SIZE.width, POST_IMG_MAX_SIZE.height],
|
||||
aspect: [IMAGE_SIZE_CONFIG_POSTS.width, IMAGE_SIZE_CONFIG_POSTS.height],
|
||||
})
|
||||
|
||||
// If we don't have permissions it's fine, we just wont save it. The post itself will still have access to
|
||||
|
||||
@@ -16,7 +16,7 @@ import {type PasteEventPayload, TextInputWrapper} from 'expo-paste-input'
|
||||
import {AppBskyRichtextFacet, RichText} from '@atproto/api'
|
||||
import {useLingui} from '@lingui/react/macro'
|
||||
|
||||
import {POST_IMG_MAX_SIZE} from '#/lib/constants'
|
||||
import {IMAGE_SIZE_CONFIG_POSTS} from '#/lib/constants'
|
||||
import {downloadAndResize} from '#/lib/media/manip'
|
||||
import {isUriImage} from '#/lib/media/util'
|
||||
import {getMentionAt, insertMentionAt} from '#/lib/strings/mention-manip'
|
||||
@@ -93,8 +93,8 @@ export function TextInput({
|
||||
if (isUriImage(feature.uri)) {
|
||||
const res = await downloadAndResize({
|
||||
uri: feature.uri,
|
||||
maxDimension: POST_IMG_MAX_SIZE.width,
|
||||
maxSize: POST_IMG_MAX_SIZE.size,
|
||||
maxDimension: IMAGE_SIZE_CONFIG_POSTS.width,
|
||||
maxSize: IMAGE_SIZE_CONFIG_POSTS.size,
|
||||
timeout: 15e3,
|
||||
})
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
import {useQueryClient} from '@tanstack/react-query'
|
||||
|
||||
import {PROFILE_IMAGES_MAX_SIZE} from '#/lib/constants'
|
||||
import {IMAGE_SIZE_CONFIG_2K_1MB} from '#/lib/constants'
|
||||
import {useHaptics} from '#/lib/haptics'
|
||||
import {
|
||||
useCameraPermission,
|
||||
@@ -395,7 +395,7 @@ let EditableUserAvatar = ({
|
||||
await openCamera({
|
||||
aspect: [1, 1],
|
||||
}),
|
||||
PROFILE_IMAGES_MAX_SIZE,
|
||||
IMAGE_SIZE_CONFIG_2K_1MB,
|
||||
),
|
||||
)
|
||||
}, [onSelectNewAvatar, requestCameraAccessIfNeeded])
|
||||
@@ -424,7 +424,7 @@ let EditableUserAvatar = ({
|
||||
shape: circular ? 'circle' : 'rectangle',
|
||||
aspectRatio: 1,
|
||||
}),
|
||||
PROFILE_IMAGES_MAX_SIZE,
|
||||
IMAGE_SIZE_CONFIG_2K_1MB,
|
||||
),
|
||||
)
|
||||
} else {
|
||||
@@ -451,7 +451,7 @@ let EditableUserAvatar = ({
|
||||
|
||||
const onChangeEditImage = useCallback(
|
||||
async (image: ComposerImage) => {
|
||||
const compressed = await compressImage(image, PROFILE_IMAGES_MAX_SIZE)
|
||||
const compressed = await compressImage(image, IMAGE_SIZE_CONFIG_2K_1MB)
|
||||
onSelectNewAvatar(compressed)
|
||||
},
|
||||
[onSelectNewAvatar],
|
||||
|
||||
@@ -6,7 +6,7 @@ import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
|
||||
import {PROFILE_IMAGES_MAX_SIZE} from '#/lib/constants'
|
||||
import {IMAGE_SIZE_CONFIG_2K_1MB} from '#/lib/constants'
|
||||
import {
|
||||
useCameraPermission,
|
||||
usePhotoLibraryPermission,
|
||||
@@ -63,7 +63,7 @@ export function UserBanner({
|
||||
await openCamera({
|
||||
aspect: [3, 1],
|
||||
}),
|
||||
PROFILE_IMAGES_MAX_SIZE,
|
||||
IMAGE_SIZE_CONFIG_2K_1MB,
|
||||
),
|
||||
)
|
||||
}, [onSelectNewBanner, requestCameraAccessIfNeeded])
|
||||
@@ -85,7 +85,7 @@ export function UserBanner({
|
||||
imageUri: items[0].path,
|
||||
aspectRatio: 3 / 1,
|
||||
}),
|
||||
PROFILE_IMAGES_MAX_SIZE,
|
||||
IMAGE_SIZE_CONFIG_2K_1MB,
|
||||
),
|
||||
)
|
||||
} else {
|
||||
@@ -111,7 +111,7 @@ export function UserBanner({
|
||||
|
||||
const onChangeEditImage = useCallback(
|
||||
async (image: ComposerImage) => {
|
||||
const compressed = await compressImage(image, PROFILE_IMAGES_MAX_SIZE)
|
||||
const compressed = await compressImage(image, IMAGE_SIZE_CONFIG_2K_1MB)
|
||||
onSelectNewBanner?.(compressed)
|
||||
},
|
||||
[onSelectNewBanner],
|
||||
|
||||
Reference in New Issue
Block a user