import { Asset } from 'react-native-image-picker' export type ExtendedAttachment = { remote?: Mastodon.Attachment local?: Asset & { thumbnail?: string; hash: string } uploading?: boolean } export type ComposeStateDraft = { timestamp: number spoiler?: string text?: string poll?: ComposeState['poll'] attachments?: ComposeState['attachments'] visibility: ComposeState['visibility'] visibilityLock: ComposeState['visibilityLock'] replyToStatus?: ComposeState['replyToStatus'] } export type ComposeState = { dirty: boolean timestamp: number posting: boolean spoiler: { active: boolean count: number raw: string formatted: ReactNode selection: { start: number; end: number } } text: { count: number raw: string formatted: ReactNode selection: { start: number; end: number } } tag?: { type: 'url' | 'accounts' | 'hashtags' text: string offset: number length: number } emoji: { active: boolean emojis: | { title: string data: Pick[][] }[] | undefined } poll: { active: boolean total: number options: { '0': string | undefined '1': string | undefined '2': string | undefined '3': string | undefined } multiple: boolean expire: '300' | '1800' | '3600' | '21600' | '86400' | '259200' | '604800' } attachments: { sensitive: boolean uploads: ExtendedAttachment[] } visibility: 'public' | 'unlisted' | 'private' | 'direct' visibilityLock: boolean replyToStatus?: Mastodon.Status textInputFocus: { current: 'text' | 'spoiler' refs: { text: RefObject } } } export type ComposeAction = | { type: 'loadDraft' payload: ComposeStateDraft } | { type: 'dirty' payload: ComposeState['dirty'] } | { type: 'posting' payload: ComposeState['posting'] } | { type: 'spoiler' payload: Partial } | { type: 'text' payload: Partial } | { type: 'tag' payload: ComposeState['tag'] } | { type: 'emoji' payload: ComposeState['emoji'] } | { type: 'poll' payload: Partial } | { type: 'attachments/sensitive' payload: Pick } | { type: 'attachment/upload/start' payload: Pick } | { type: 'attachment/upload/end' payload: { remote: Mastodon.Attachment; local: Asset } } | { type: 'attachment/upload/fail' payload: ExtendedAttachment['local']['hash'] } | { type: 'attachment/delete' payload: NonNullable['id'] } | { type: 'attachment/edit' payload: ExtendedAttachment['remote'] } | { type: 'visibility' payload: ComposeState['visibility'] } | { type: 'textInputFocus' payload: Partial } | { type: 'removeReply' }