1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
This commit is contained in:
Zhiyuan Zheng
2022-06-07 20:07:14 +02:00
parent 23bc9aa5f3
commit 0991d50240
16 changed files with 239 additions and 298 deletions

View File

@@ -128,7 +128,9 @@ const ComposeEditAttachmentImage: React.FC<Props> = ({ index }) => {
height: imageDimensionis.height
}}
source={{
uri: theAttachmentLocal?.uri || theAttachmentRemote?.preview_url
uri: theAttachmentLocal?.path
? `file://${theAttachmentLocal?.path}`
: theAttachmentRemote?.preview_url
}}
/>
<PanGestureHandler onGestureEvent={onGestureEvent}>

View File

@@ -34,7 +34,7 @@ const ComposeEditAttachmentRoot: React.FC<Props> = ({ index }) => {
video={
video.local
? ({
url: video.local.uri,
url: `file://${video.local.path}`,
preview_url: video.local.local_thumbnail,
blurhash: video.remote?.blurhash
} as Mastodon.AttachmentVideo)

View File

@@ -58,7 +58,7 @@ const composeReducer = (
attachments: {
...state.attachments,
uploads: state.attachments.uploads.map(upload =>
upload.local?.uri === action.payload.local?.uri
upload.local?.path === action.payload.local?.path
? { ...upload, remote: action.payload.remote, uploading: false }
: upload
)

View File

@@ -2,7 +2,7 @@ import { ImageOrVideo } from 'react-native-image-crop-picker'
export type ExtendedAttachment = {
remote?: Mastodon.Attachment
local?: Pick<ImageOrVideo, 'path' | 'width' | 'height'> & {
local?: Pick<ImageOrVideo, 'path' | 'width' | 'height' | 'mime'> & {
type: 'image' | 'video' | 'unknown'
local_thumbnail?: string
hash?: string
@@ -121,7 +121,10 @@ export type ComposeAction =
}
| {
type: 'attachment/upload/end'
payload: { remote: Mastodon.Attachment; local: ImageInfo }
payload: {
remote: Mastodon.Attachment
local: Pick<ImageOrVideo, 'path' | 'width' | 'height' | 'mime'>
}
}
| {
type: 'attachment/upload/fail'