From e5eaf162f49953f46a5bbdbee3677917770005e6 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sun, 6 Dec 2020 21:42:19 +0100 Subject: [PATCH] Fine tune compose --- package.json | 1 + src/@types/mastodon.d.ts | 270 +++++++++--------- src/components/BottomSheet.tsx | 4 +- src/components/Button.tsx | 84 +----- src/components/Button/ButtonRound.tsx | 60 ++++ src/components/Button/ButtonRow.tsx | 82 ++++++ .../Shared/Attachment/AttachmentVideo.tsx | 31 +- .../Timelines/Timeline/Shared/Poll.tsx | 4 +- src/screens/Me/Root/Login.tsx | 4 +- src/screens/Shared/Compose.tsx | 2 +- src/screens/Shared/Compose/Actions.tsx | 104 ++++--- src/screens/Shared/Compose/Attachments.tsx | 158 ++++++---- src/screens/Shared/Compose/EditAttachment.tsx | 55 +++- src/screens/Shared/Compose/Emojis.tsx | 1 - src/screens/Shared/Compose/Poll.tsx | 6 +- src/screens/Shared/Compose/Root.tsx | 79 ++--- src/screens/Shared/Compose/TextInput.tsx | 10 +- src/screens/Shared/Compose/addAttachments.ts | 38 ++- 18 files changed, 586 insertions(+), 407 deletions(-) create mode 100644 src/components/Button/ButtonRound.tsx create mode 100644 src/components/Button/ButtonRow.tsx diff --git a/package.json b/package.json index 11397139..7d7f4f16 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "expo-image-picker": "~9.1.1", "expo-linear-gradient": "~8.3.0", "expo-localization": "^9.0.0", + "expo-permissions": "~9.3.0", "expo-secure-store": "~9.2.0", "expo-splash-screen": "~0.6.1", "expo-status-bar": "~1.0.2", diff --git a/src/@types/mastodon.d.ts b/src/@types/mastodon.d.ts index 282b9901..3c6ae887 100644 --- a/src/@types/mastodon.d.ts +++ b/src/@types/mastodon.d.ts @@ -1,137 +1,3 @@ -type AttachmentImage = { - // Base - id: string - type: 'image' - url: string - preview_url: string - - // Others - remote_url?: string - text_url?: string - meta?: { - original?: { width: number; height: number; size: string; aspect: number } - small?: { width: number; height: number; size: string; aspect: number } - focus?: { x: number; y: number } - } - description?: string - blurhash?: string -} - -type AttachmentVideo = { - // Base - id: string - type: 'video' - url: string - preview_url: string - - // Others - remote_url?: string - text_url?: string - meta?: { - length: string - duration: number - fps: number - size: string - width: number - height: number - aspect: number - audio_encode: string - audio_bitrate: string - audio_channels: string - original: { - width: number - height: number - frame_rate: string - duration: number - bitrate: number - } - small: { - width: number - height: number - size: string - aspect: number - } - } - description?: string - blurhash?: string -} - -type AttachmentGifv = { - // Base - id: string - type: 'gifv' - url: string - preview_url: string - - // Others - remote_url?: string - text_url?: string - meta?: { - length: string - duration: number - fps: number - size: string - width: number - height: number - aspect: number - original: { - width: number - height: number - frame_rate: string - duration: number - bitrate: number - } - small: { - width: number - height: number - size: string - aspect: number - } - } - description?: string - blurhash?: string -} - -type AttachmentAudio = { - // Base - id: string - type: 'audio' - url: string - preview_url: string - - // Others - remote_url?: string - text_url?: string - meta?: { - length: string - duration: number - audio_encode: string - audio_bitrate: string - audio_channels: string - original: { - duration: number - bitrate: number - } - } - description?: string - blurhash?: string -} - -type AttachmentUnknown = { - // Base - id: string - type: 'unknown' - url: string - preview_url: string - - // Others - remote_url?: string - text_url?: string - meta?: any - description?: string - blurhash?: string -} - declare namespace Mastodon { type Account = { // Base @@ -177,7 +43,141 @@ declare namespace Mastodon { | AttachmentVideo | AttachmentGifv | AttachmentAudio - | AttachmentUnknown + // | AttachmentUnknown + + type AttachmentImage = { + // Base + id: string + type: 'image' + url: string + preview_url: string + + // Others + remote_url?: string + text_url?: string + meta?: { + original?: { width: number; height: number; size: string; aspect: number } + small?: { width: number; height: number; size: string; aspect: number } + focus?: { x: number; y: number } + } + description?: string + blurhash?: string + } + + type AttachmentVideo = { + // Base + id: string + type: 'video' + url: string + preview_url: string + + // Others + remote_url?: string + text_url?: string + meta?: { + length: string + duration: number + fps: number + size: string + width: number + height: number + aspect: number + audio_encode: string + audio_bitrate: string + audio_channels: string + original: { + width: number + height: number + frame_rate: string + duration: number + bitrate: number + } + small: { + width: number + height: number + size: string + aspect: number + } + } + description?: string + blurhash?: string + } + + type AttachmentGifv = { + // Base + id: string + type: 'gifv' + url: string + preview_url: string + + // Others + remote_url?: string + text_url?: string + meta?: { + length: string + duration: number + fps: number + size: string + width: number + height: number + aspect: number + original: { + width: number + height: number + frame_rate: string + duration: number + bitrate: number + } + small: { + width: number + height: number + size: string + aspect: number + } + } + description?: string + blurhash?: string + } + + type AttachmentAudio = { + // Base + id: string + type: 'audio' + url: string + preview_url: string + + // Others + remote_url?: string + text_url?: string + meta?: { + length: string + duration: number + audio_encode: string + audio_bitrate: string + audio_channels: string + original: { + duration: number + bitrate: number + } + } + description?: string + blurhash?: string + } + + // type AttachmentUnknown = { + // // Base + // id: string + // type: 'unknown' + // url: string + // preview_url: string + + // // Others + // remote_url?: string + // text_url?: string + // meta?: any + // description?: string + // blurhash?: string + // } type Card = { // Base diff --git a/src/components/BottomSheet.tsx b/src/components/BottomSheet.tsx index 779db89f..967c0e5a 100644 --- a/src/components/BottomSheet.tsx +++ b/src/components/BottomSheet.tsx @@ -10,7 +10,7 @@ import { import { useSafeAreaInsets } from 'react-native-safe-area-context' import { useTheme } from 'src/utils/styles/ThemeManager' import { StyleConstants } from 'src/utils/styles/constants' -import Button from './Button' +import { ButtonRow } from './Button' export interface Props { children: React.ReactNode @@ -84,7 +84,7 @@ const BottomSheet: React.FC = ({ children, visible, handleDismiss }) => { style={[styles.handle, { backgroundColor: theme.background }]} /> {children} -