From 200a3e4741d47274cdd4fca38363b8399afbd230 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sat, 18 Dec 2021 23:44:08 +0100 Subject: [PATCH 1/7] Fix Android titles --- src/Screens.tsx | 2 +- src/screens/Compose.tsx | 29 ++++++++---------------- src/screens/Compose/DraftsList.tsx | 16 ++++--------- src/screens/Compose/EditAttachment.tsx | 2 +- src/screens/Tabs/Local.tsx | 2 +- src/screens/Tabs/Me.tsx | 23 ++++++++----------- src/screens/Tabs/Me/Profile.tsx | 8 +++---- src/screens/Tabs/Me/Root/Collections.tsx | 2 +- src/screens/Tabs/Notifications.tsx | 2 +- src/screens/Tabs/Shared/Root.tsx | 25 +++++++++----------- 10 files changed, 44 insertions(+), 67 deletions(-) diff --git a/src/Screens.tsx b/src/Screens.tsx index 392bc8d8..229eff2e 100644 --- a/src/Screens.tsx +++ b/src/Screens.tsx @@ -187,7 +187,7 @@ const Screens: React.FC = ({ localCorrupt }) => { headerLeft: () => ( navigation.goBack()} /> ), - headerTitle: t('screenAnnouncements:heading') + title: t('screenAnnouncements:heading') })} /> > = ({ name='Screen-Compose-Root' component={ComposeRoot} options={{ - ...Platform.select({ - ios: { - headerTitle: headerContent, - headerTitleStyle: { - fontWeight: - totalTextCount > maxTootChars - ? StyleConstants.Font.Weight.Bold - : StyleConstants.Font.Weight.Normal, - fontSize: StyleConstants.Font.Size.M - }, - headerTintColor: - totalTextCount > maxTootChars - ? theme.red - : theme.secondary - }, - android: { - headerCenter: () => - } - }), + title: headerContent, + titleStyle: { + fontWeight: + totalTextCount > maxTootChars + ? StyleConstants.Font.Weight.Bold + : StyleConstants.Font.Weight.Normal, + fontSize: StyleConstants.Font.Size.M + }, + headerTintColor: + totalTextCount > maxTootChars ? theme.red : theme.secondary, headerLeft, headerRight }} diff --git a/src/screens/Compose/DraftsList.tsx b/src/screens/Compose/DraftsList.tsx index ff0adb61..642bc41d 100644 --- a/src/screens/Compose/DraftsList.tsx +++ b/src/screens/Compose/DraftsList.tsx @@ -1,16 +1,15 @@ -import { HeaderCenter, HeaderLeft } from '@components/Header' +import { HeaderLeft } from '@components/Header' import { createNativeStackNavigator } from '@react-navigation/native-stack' import { ScreenComposeStackScreenProps } from '@utils/navigation/navigators' import React, { useCallback } from 'react' import { useTranslation } from 'react-i18next' -import { Platform } from 'react-native' import ComposeDraftsListRoot from './DraftsList/Root' const Stack = createNativeStackNavigator() -const ComposeDraftsList: React.FC> = ({ +const ComposeDraftsList: React.FC< + ScreenComposeStackScreenProps<'Screen-Compose-DraftsList'> +> = ({ route: { params: { timestamp } }, @@ -40,12 +39,7 @@ const ComposeDraftsList: React.FC ( - - ) - }), + title: t('content.draftsList.header.title'), headerShadowVisible: false }} /> diff --git a/src/screens/Compose/EditAttachment.tsx b/src/screens/Compose/EditAttachment.tsx index 66f8813b..70a27500 100644 --- a/src/screens/Compose/EditAttachment.tsx +++ b/src/screens/Compose/EditAttachment.tsx @@ -49,7 +49,7 @@ const ComposeEditAttachment: React.FC , - headerTitle: t('content.editAttachment.header.title') + title: t('content.editAttachment.header.title') }} /> diff --git a/src/screens/Tabs/Local.tsx b/src/screens/Tabs/Local.tsx index 37c48779..21afed29 100644 --- a/src/screens/Tabs/Local.tsx +++ b/src/screens/Tabs/Local.tsx @@ -21,7 +21,7 @@ const TabLocal = React.memo( const screenOptionsRoot = useMemo( () => ({ - headerTitle: t('tabs.local.name'), + title: t('tabs.local.name'), ...(Platform.OS === 'android' && { headerCenter: () => }), diff --git a/src/screens/Tabs/Me.tsx b/src/screens/Tabs/Me.tsx index 400809bd..17e1feb1 100644 --- a/src/screens/Tabs/Me.tsx +++ b/src/screens/Tabs/Me.tsx @@ -38,7 +38,7 @@ const TabMe = React.memo( name='Tab-Me-Bookmarks' component={TabMeBookmarks} options={({ navigation }: any) => ({ - headerTitle: t('me.stacks.bookmarks.name'), + title: t('me.stacks.bookmarks.name'), ...(Platform.OS === 'android' && { headerCenter: () => ( @@ -51,7 +51,7 @@ const TabMe = React.memo( name='Tab-Me-Conversations' component={TabMeConversations} options={({ navigation }: any) => ({ - headerTitle: t('me.stacks.conversations.name'), + title: t('me.stacks.conversations.name'), ...(Platform.OS === 'android' && { headerCenter: () => ( @@ -64,7 +64,7 @@ const TabMe = React.memo( name='Tab-Me-Favourites' component={TabMeFavourites} options={({ navigation }: any) => ({ - headerTitle: t('me.stacks.favourites.name'), + title: t('me.stacks.favourites.name'), ...(Platform.OS === 'android' && { headerCenter: () => ( @@ -77,7 +77,7 @@ const TabMe = React.memo( name='Tab-Me-Lists' component={TabMeLists} options={({ navigation }: any) => ({ - headerTitle: t('me.stacks.lists.name'), + title: t('me.stacks.lists.name'), ...(Platform.OS === 'android' && { headerCenter: () => ( @@ -90,7 +90,7 @@ const TabMe = React.memo( name='Tab-Me-Lists-List' component={TabMeListsList} options={({ route, navigation }: any) => ({ - headerTitle: t('me.stacks.list.name', { list: route.params.title }), + title: t('me.stacks.list.name', { list: route.params.title }), ...(Platform.OS === 'android' && { headerCenter: () => ( ({ presentation: 'modal', headerShown: true, - headerTitle: t('me.stacks.push.name'), + title: t('me.stacks.push.name'), ...(Platform.OS === 'android' && { headerCenter: () => ( @@ -135,12 +135,7 @@ const TabMe = React.memo( name='Tab-Me-Settings' component={TabMeSettings} options={({ navigation }: any) => ({ - headerTitle: t('me.stacks.settings.name'), - ...(Platform.OS === 'android' && { - headerCenter: () => ( - - ) - }), + title: t('me.stacks.settings.name'), headerLeft: () => navigation.pop(1)} /> })} /> @@ -148,7 +143,7 @@ const TabMe = React.memo( name='Tab-Me-Settings-Fontsize' component={TabMeSettingsFontsize} options={({ navigation }: any) => ({ - headerTitle: t('me.stacks.fontSize.name'), + title: t('me.stacks.fontSize.name'), ...(Platform.OS === 'android' && { headerCenter: () => ( @@ -163,7 +158,7 @@ const TabMe = React.memo( options={({ navigation }) => ({ presentation: 'modal', headerShown: true, - headerTitle: t('me.stacks.switch.name'), + title: t('me.stacks.switch.name'), ...(Platform.OS === 'android' && { headerCenter: () => ( diff --git a/src/screens/Tabs/Me/Profile.tsx b/src/screens/Tabs/Me/Profile.tsx index a3a41221..1e5ca7d7 100644 --- a/src/screens/Tabs/Me/Profile.tsx +++ b/src/screens/Tabs/Me/Profile.tsx @@ -31,7 +31,7 @@ const TabMeProfile: React.FC> = ({ ( @@ -56,7 +56,7 @@ const TabMeProfile: React.FC> = ({ ( @@ -75,7 +75,7 @@ const TabMeProfile: React.FC> = ({ ( @@ -94,7 +94,7 @@ const TabMeProfile: React.FC> = ({ ( diff --git a/src/screens/Tabs/Me/Root/Collections.tsx b/src/screens/Tabs/Me/Root/Collections.tsx index 28a4da7d..bd75030f 100644 --- a/src/screens/Tabs/Me/Root/Collections.tsx +++ b/src/screens/Tabs/Me/Root/Collections.tsx @@ -109,7 +109,7 @@ const Collections: React.FC = () => { iconBack='ChevronRight' title={t('me.stacks.push.name')} content={ - instancePush + instancePush.global.value ? t('me.root.push.content.enabled') : t('me.root.push.content.disabled') } diff --git a/src/screens/Tabs/Notifications.tsx b/src/screens/Tabs/Notifications.tsx index 0e9bb4d3..a6746b4a 100644 --- a/src/screens/Tabs/Notifications.tsx +++ b/src/screens/Tabs/Notifications.tsx @@ -19,7 +19,7 @@ const TabNotifications = React.memo( const screenOptionsRoot = useMemo( () => ({ - headerTitle: t('tabs.notifications.name'), + title: t('tabs.notifications.name'), ...(Platform.OS === 'android' && { headerCenter: () => ( diff --git a/src/screens/Tabs/Shared/Root.tsx b/src/screens/Tabs/Shared/Root.tsx index 18738745..563049bb 100644 --- a/src/screens/Tabs/Shared/Root.tsx +++ b/src/screens/Tabs/Shared/Root.tsx @@ -41,7 +41,7 @@ const TabSharedRoot = ({ headerStyle: { backgroundColor: `rgba(255, 255, 255, 0)` }, - headerTitle: '', + title: '', headerLeft: () => ( navigation.goBack()} background /> ) @@ -91,14 +91,7 @@ const TabSharedRoot = ({ options={({ route }: TabSharedStackScreenProps<'Tab-Shared-Hashtag'>) => ({ - headerTitle: `#${decodeURIComponent(route.params.hashtag)}`, - ...(Platform.OS === 'android' && { - headerCenter: () => ( - - ) - }) + title: `#${decodeURIComponent(route.params.hashtag)}` })} /> @@ -109,6 +102,13 @@ const TabSharedRoot = ({ options={({ navigation }: TabSharedStackScreenProps<'Tab-Shared-Search'>) => ({ + ...(Platform.OS === 'ios' + ? { + headerLeft: () => ( + navigation.goBack()} /> + ) + } + : { headerLeft: () => null }), headerTitle: () => { const onChangeText = debounce( (text: string) => navigation.setParams({ text }), @@ -164,10 +164,7 @@ const TabSharedRoot = ({ name='Tab-Shared-Toot' component={TabSharedToot} options={{ - headerTitle: t('shared.toot.name'), - ...(Platform.OS === 'android' && { - headerCenter: () => - }) + title: t('shared.toot.name') }} /> @@ -180,7 +177,7 @@ const TabSharedRoot = ({ params: { reference, type, count } } }: TabSharedStackScreenProps<'Tab-Shared-Users'>) => ({ - headerTitle: t(`shared.users.${reference}.${type}`, { count }), + title: t(`shared.users.${reference}.${type}`, { count }), ...(Platform.OS === 'android' && { headerCenter: () => ( Date: Sun, 19 Dec 2021 00:30:34 +0100 Subject: [PATCH 2/7] Fix release notes Apple does not allow emoji in release notes --- fastlane/metadata/en-US/release_notes.txt | 7 +++---- fastlane/metadata/zh-Hans/release_notes.txt | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/fastlane/metadata/en-US/release_notes.txt b/fastlane/metadata/en-US/release_notes.txt index 80125840..e2db6daf 100644 --- a/fastlane/metadata/en-US/release_notes.txt +++ b/fastlane/metadata/en-US/release_notes.txt @@ -1,4 +1,3 @@ -🍎 -Support version from iOS 12 -🤖️ -Support APNG animation \ No newline at end of file +Support iOS version starting from 12 +Optimize performance (hopefully) +Using new push and translation service diff --git a/fastlane/metadata/zh-Hans/release_notes.txt b/fastlane/metadata/zh-Hans/release_notes.txt index d85ee66a..00c2b56d 100644 --- a/fastlane/metadata/zh-Hans/release_notes.txt +++ b/fastlane/metadata/zh-Hans/release_notes.txt @@ -1,4 +1,3 @@ -🍎 -最低版本支持升级至iOS 12 -🤖️ -支持APNG动画 \ No newline at end of file +iOS支持最低版本12 +(但愿)性能有改进 +使用新的推送和翻译服务 \ No newline at end of file From 5ec37333694f34217104cbfa643a7a8287cac638 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Fri, 31 Dec 2021 11:38:21 +0100 Subject: [PATCH 3/7] Use correct error code --- src/utils/push/useConnect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/push/useConnect.ts b/src/utils/push/useConnect.ts index e0ef63fb..08c30f00 100644 --- a/src/utils/push/useConnect.ts +++ b/src/utils/push/useConnect.ts @@ -29,7 +29,7 @@ const pushUseConnect = ({ mode, t, instances, dispatch }: Params) => { url: `push/connect/${expoToken}`, sentry: true }).catch(error => { - if (error.status == 410) { + if (error.status == 404) { displayMessage({ mode, type: 'error', From 248238dda8ef08396dd717e07b443d3fd18ae48b Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Fri, 31 Dec 2021 12:09:03 +0100 Subject: [PATCH 4/7] Try to fix scrollToIndex out of range --- src/screens/Tabs/Shared/Toot.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/screens/Tabs/Shared/Toot.tsx b/src/screens/Tabs/Shared/Toot.tsx index 825cbff3..94a77a99 100644 --- a/src/screens/Tabs/Shared/Toot.tsx +++ b/src/screens/Tabs/Shared/Toot.tsx @@ -38,12 +38,13 @@ const TabSharedToot: React.FC> = ({ if (!scrolled.current) { scrolled.current = true const pointer = findIndex(flattenData, ['id', toot.id]) - setTimeout(() => { - flRef.current?.scrollToIndex({ - index: pointer === -1 ? 0 : pointer, - viewOffset: 100 - }) - }, 500) + pointer > 0 && + setTimeout(() => { + flRef.current?.scrollToIndex({ + index: pointer, + viewOffset: 100 + }) + }, 1000) } } }) From d5ea813ebe27e6c4204d30e38c2279e3ae12f036 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Fri, 31 Dec 2021 12:26:17 +0100 Subject: [PATCH 5/7] Fix err may be undefined --- src/screens/Compose/utils/post.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/screens/Compose/utils/post.ts b/src/screens/Compose/utils/post.ts index d482493e..9be1334c 100644 --- a/src/screens/Compose/utils/post.ts +++ b/src/screens/Compose/utils/post.ts @@ -15,8 +15,8 @@ const composePost = async ( method: 'get', url: `statuses/${composeState.replyToStatus.id}` }) - } catch (err) { - if (err.status && err.status == 404) { + } catch (err: any) { + if (err && err.status && err.status == 404) { return Promise.reject({ removeReply: true }) } } From b3a3c677750f4c20912b40dbcf9d31f0f0905d23 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Fri, 31 Dec 2021 12:26:58 +0100 Subject: [PATCH 6/7] Fix bugs --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a84b9fb8..184bcccd 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "native": "211218", "major": 3, "minor": 0, - "patch": 0, + "patch": 1, "expo": "44.0.0" }, "description": "tooot app for Mastodon", From b08e24e23358debcb21fd949ff2c4b6585a0df92 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Fri, 31 Dec 2021 12:29:41 +0100 Subject: [PATCH 7/7] Fix page margin --- src/screens/Tabs/Me/Root.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/screens/Tabs/Me/Root.tsx b/src/screens/Tabs/Me/Root.tsx index 5da98fe8..f6bfeb49 100644 --- a/src/screens/Tabs/Me/Root.tsx +++ b/src/screens/Tabs/Me/Root.tsx @@ -11,6 +11,7 @@ import accountInitialState from '@screens/Tabs/Shared/Account/utils/initialState import accountReducer from '@screens/Tabs/Shared/Account/utils/reducer' import { useProfileQuery } from '@utils/queryHooks/profile' import { getInstanceActive } from '@utils/slices/instancesSlice' +import { StyleConstants } from '@utils/styles/constants' import React, { useReducer, useRef } from 'react' import Animated, { useAnimatedScrollHandler, @@ -49,6 +50,7 @@ const TabMeRoot: React.FC = () => { keyboardShouldPersistTaps='handled' onScroll={onScroll} scrollEventThrottle={16} + style={{ marginBottom: StyleConstants.Spacing.L }} > {instanceActive !== -1 ? (