diff --git a/app.config.ts b/app.config.ts index 00bdddb0..ba65cc02 100644 --- a/app.config.ts +++ b/app.config.ts @@ -19,7 +19,8 @@ export default (): ExpoConfig => ({ scheme: 'tooot', assetBundlePatterns: ['assets/*'], extra: { - sentryDSN: process.env.SENTRY_DSN + sentryDSN: process.env.SENTRY_DSN, + sentryEnv: process.env.SENTRY_DEPLOY_ENV }, hooks: { postPublish: [ diff --git a/demo/statuses.json b/demo/statuses.json index 2c654588..6979abe3 100644 --- a/demo/statuses.json +++ b/demo/statuses.json @@ -3,7 +3,7 @@ "pages": [ [ { - "id": "1", + "id": "999", "created_at": "2021-01-22T03:48:33.901Z", "sensitive": false, "visibility": "public", @@ -21,17 +21,38 @@ "website": "https://tooot.app" }, "account": { - "id": "1", + "id": "999", "username": "tooot📱", "acct": "tooot@xmflsct.com", "display_name": "tooot📱", "avatar_static": "https://avatars.githubusercontent.com/u/77554750?s=200&v=4" }, "media_attachments": [], - "poll": null + "poll": { + "id": "1", + "expires_at": "2021-02-22T03:48:33.901Z", + "expired": false, + "multiple": false, + "votes_count": 10, + "voters_count": null, + "voted": false, + "own_votes": null, + "options": [ + { + "title": "I would love to!", + "votes_count": 6 + }, + { + "title": "Why not give it a go?", + "votes_count": 4 + } + ], + "emojis": [] + }, + "mentions": [] }, { - "id": "2", + "id": "1000", "created_at": "2021-01-22T03:48:33.901Z", "sensitive": false, "spoiler_text": "", @@ -50,7 +71,7 @@ "website": null }, "account": { - "id": "2", + "id": "1000", "username": "Mastodon", "acct": "mastodon", "display_name": "Mastodon", @@ -63,10 +84,11 @@ "description": "Mastodon is an open source decentralized social network - by the people for the people. Join the federation and take back control of your social media!", "type": "link", "image": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Mastodon_Logotype_%28Simple%29.svg/1200px-Mastodon_Logotype_%28Simple%29.svg.png" - } + }, + "mentions": [] }, { - "id": "3", + "id": "1001", "created_at": "2021-01-22T03:48:33.901Z", "spoiler_text": "", "visibility": "public", @@ -84,13 +106,70 @@ "website": null }, "account": { - "id": "3", + "id": "1001", "username": "Fediverse", "acct": "fediverse", "display_name": "Fediverse", "avatar_static": "https://e7.pngegg.com/pngimages/667/514/png-clipart-mastodon-fediverse-social-media-free-software-logo-social-media-blue-text.png" }, - "media_attachments": [] + "media_attachments": [], + "mentions": [] + }, + { + "id": "1002", + "created_at": "2021-01-22T03:48:33.901Z", + "sensitive": false, + "visibility": "public", + "replies_count": 0, + "reblogs_count": 0, + "favourites_count": 0, + "favourited": true, + "reblogged": false, + "muted": false, + "bookmarked": false, + "content": "

tooot is an open source, simple mobile client for Mastodon. Focusing on your connections while being able to explore the Fediverse.

", + "reblog": null, + "application": { + "name": "tooot", + "website": "https://tooot.app" + }, + "account": { + "id": "1002", + "username": "tooot📱", + "acct": "tooot@xmflsct.com", + "display_name": "tooot📱", + "avatar_static": "https://avatars.githubusercontent.com/u/77554750?s=200&v=4" + }, + "media_attachments": [], + "mentions": [] + }, + { + "id": "1003", + "created_at": "2021-01-22T03:48:33.901Z", + "sensitive": false, + "visibility": "public", + "replies_count": 0, + "reblogs_count": 0, + "favourites_count": 0, + "favourited": true, + "reblogged": false, + "muted": false, + "bookmarked": false, + "content": "

- tooot supports multiple accounts
- tooot supports browsing external instance
- tooot aims to support multiple languages

", + "reblog": null, + "application": { + "name": "tooot", + "website": "https://tooot.app" + }, + "account": { + "id": "1003", + "username": "tooot📱", + "acct": "tooot@xmflsct.com", + "display_name": "tooot📱", + "avatar_static": "https://avatars.githubusercontent.com/u/77554750?s=200&v=4" + }, + "media_attachments": [], + "mentions": [] } ] ] diff --git a/src/@types/react-navigation.d.ts b/src/@types/react-navigation.d.ts index cb805e10..23c36e7e 100644 --- a/src/@types/react-navigation.d.ts +++ b/src/@types/react-navigation.d.ts @@ -9,13 +9,13 @@ declare namespace Nav { type SharedStackParamList = { 'Screen-Shared-Account': { - account: Pick + account: Mastodon.Account | Mastodon.Mention } 'Screen-Shared-Announcements': { showAll?: boolean } 'Screen-Shared-Attachments': { account: Mastodon.Account } 'Screen-Shared-Compose': | { - type: 'reply' | 'conversation' | 'edit' + type: 'edit' incomingStatus: Mastodon.Status queryKey?: [ 'Timeline', @@ -28,6 +28,25 @@ declare namespace Nav { } ] } + | { + type: 'reply' + incomingStatus: Mastodon.Status + accts: Mastodon.Account['acct'][] + queryKey?: [ + 'Timeline', + { + page: App.Pages + hashtag?: Mastodon.Tag['name'] + list?: Mastodon.List['id'] + toot?: Mastodon.Status['id'] + account?: Mastodon.Account['id'] + } + ] + } + | { + type: 'conversation' + accts: Mastodon.Account['acct'][] + } | undefined 'Screen-Shared-Hashtag': { hashtag: Mastodon.Tag['name'] diff --git a/src/Index.tsx b/src/Index.tsx index 97973e4e..acf7a80e 100644 --- a/src/Index.tsx +++ b/src/Index.tsx @@ -33,6 +33,7 @@ import React, { useMemo, useRef } from 'react' +import { useTranslation } from 'react-i18next' import { Image, Platform, StatusBar } from 'react-native' import Toast from 'react-native-toast-message' import { useDispatch, useSelector } from 'react-redux' @@ -70,11 +71,12 @@ const Index: React.FC = ({ localCorrupt }) => { // }, [isConnected, firstRender]) // On launch display login credentials corrupt information + const { t } = useTranslation('common') useEffect(() => { const showLocalCorrect = localCorrupt ? toast({ type: 'error', - message: '登录已过期', + message: t('index.localCorrupt'), description: localCorrupt.length ? localCorrupt : undefined, autoHide: false }) @@ -193,8 +195,8 @@ const Index: React.FC = ({ localCorrupt }) => { void + onPress?: () => void + origin?: string } -const ComponentAccount: React.FC = ({ account, onPress }) => { +const ComponentAccount: React.FC = ({ + account, + onPress: customOnPress, + origin +}) => { const { theme } = useTheme() + const navigation = useNavigation< + StackNavigationProp + >() + + const onPress = useCallback(() => { + analytics('search_account_press', { page: origin }) + navigation.push('Screen-Shared-Account', { account }) + }, []) return ( = ({ children, visible, handleDismiss }) => { } }) const callDismiss = () => { + analytics('bottomsheet_swipe_close') handleDismiss() } const onGestureEvent = useAnimatedGestureHandler({ @@ -90,7 +92,10 @@ const BottomSheet: React.FC = ({ children, visible, handleDismiss }) => {