From 02a90e84f317bb588463a7eb34a9db52cccdb97a Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 12 Jan 2023 20:17:26 +0100 Subject: [PATCH 1/8] Wrong side of fixing crash --- package.json | 2 +- src/screens/Tabs/Public/Root.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6f896f9a..418088f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tooot", - "version": "4.8.1", + "version": "4.8.2", "description": "tooot for Mastodon", "author": "xmflsct ", "license": "GPL-3.0-or-later", diff --git a/src/screens/Tabs/Public/Root.tsx b/src/screens/Tabs/Public/Root.tsx index 9633aa41..c20a4398 100644 --- a/src/screens/Tabs/Public/Root.tsx +++ b/src/screens/Tabs/Public/Root.tsx @@ -38,7 +38,7 @@ const Root: React.FC( - Math.min( + Math.max( 0, segments.findIndex(segment => segment === previousSegment) ) From 03fd770a413469241c4d2dba89b4ebbde50a3273 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 12 Jan 2023 20:28:43 +0100 Subject: [PATCH 2/8] Hide useless cards --- src/components/Timeline/Shared/Card.tsx | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/components/Timeline/Shared/Card.tsx b/src/components/Timeline/Shared/Card.tsx index 03d29f18..4579a88a 100644 --- a/src/components/Timeline/Shared/Card.tsx +++ b/src/components/Timeline/Shared/Card.tsx @@ -12,7 +12,6 @@ import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import React, { useContext, useEffect, useState } from 'react' import { Pressable, View } from 'react-native' -import { Circle } from 'react-native-animated-spinkit' import TimelineDefault from '../Default' import StatusContext from './Context' @@ -62,21 +61,14 @@ const TimelineCard: React.FC = () => { } }, []) + if (loading) { + return null + } + if ((!status.card?.image || !status.card.title) && !status.card?.description) { + return null + } + const cardContent = () => { - if (loading) { - return ( - - - - ) - } if (match?.status && foundStatus) { return } From a37f66d0800ccd82d3647d7986a79a1dbe06fb1f Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 12 Jan 2023 20:58:57 +0100 Subject: [PATCH 3/8] Fix unidentified mentions --- src/components/Parse/HTML.tsx | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/components/Parse/HTML.tsx b/src/components/Parse/HTML.tsx index 8b3ed892..e8cd52b3 100644 --- a/src/components/Parse/HTML.tsx +++ b/src/components/Parse/HTML.tsx @@ -4,7 +4,8 @@ import ParseEmojis from '@components/Parse/Emojis' import StatusContext from '@components/Timeline/Shared/Context' import { useNavigation, useRoute } from '@react-navigation/native' import { StackNavigationProp } from '@react-navigation/stack' -import { TabLocalStackParamList } from '@utils/navigation/navigators' +import { urlMatcher } from '@utils/helpers/urlMatcher' +import { TabLocalStackParamList, TabSharedStackParamList } from '@utils/navigation/navigators' import { useAccountStorage, useGlobalStorage } from '@utils/storage/actions' import { StyleConstants } from '@utils/styles/constants' import layoutAnimation from '@utils/styles/layoutAnimation' @@ -152,22 +153,34 @@ const ParseHTML: React.FC = ({ ) } if (classes.includes('mention') && (status?.mentions?.length || mentions?.length)) { - const matchedMention = (status?.mentions || mentions || []).find( + let matchedMention: + | TabSharedStackParamList['Tab-Shared-Account']['account'] + | undefined = (status?.mentions || mentions || []).find( mention => mention.url === href ) if ( matchedMention && - excludeMentions?.current.find(eM => eM.id === matchedMention.id) + excludeMentions?.current.find(eM => eM.id === matchedMention?.id) ) { prevMentionRemoved.current = true return null } + + if (!matchedMention) { + const match = urlMatcher(href) + if (match?.account?.acct) { + // @ts-ignore + matchedMention = { ...match.account, url: href } + } + } + const paramsAccount = (params as { account: Mastodon.Account } | undefined)?.account - const sameAccount = paramsAccount?.id === matchedMention?.id + const sameAccount = paramsAccount ? paramsAccount.id === matchedMention?.id : false + return ( matchedMention && !disableDetails && From 2a19e1fc2a12bce41bbb9f196bd22a75312c7284 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 12 Jan 2023 21:04:50 +0100 Subject: [PATCH 4/8] Fix #654 --- src/screens/Compose/utils/parseState.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/Compose/utils/parseState.ts b/src/screens/Compose/utils/parseState.ts index 99cce590..3998ea08 100644 --- a/src/screens/Compose/utils/parseState.ts +++ b/src/screens/Compose/utils/parseState.ts @@ -20,7 +20,7 @@ const assignVisibility = ( return { visibility: 'unlisted', visibilityLock: false } } case 'public': - switch (preferences) { + switch (preferences?.['posting:default:visibility']) { case 'private': return { visibility: 'private', visibilityLock: false } case 'unlisted': From 81b810496b1e2efcc9fe64670059fce2726d39fa Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 12 Jan 2023 21:12:51 +0100 Subject: [PATCH 5/8] No need to show initial toot in history Nothing changed in there --- src/screens/Tabs/Shared/History.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/screens/Tabs/Shared/History.tsx b/src/screens/Tabs/Shared/History.tsx index 13c80fb1..72d51762 100644 --- a/src/screens/Tabs/Shared/History.tsx +++ b/src/screens/Tabs/Shared/History.tsx @@ -161,13 +161,15 @@ const TabSharedHistory: React.FC ( - - )} + renderItem={({ item, index }) => + index === dataReversed.length - 1 ? null : ( + + ) + } ItemSeparatorComponent={ComponentSeparator} /> ) From bebf4c7101e1644cb4e2736491a0e1820a2b6ea2 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 12 Jan 2023 21:24:45 +0100 Subject: [PATCH 6/8] Update TextInput.tsx There are still reports of text not wrapping #571 --- src/screens/Compose/Root/Header/TextInput.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/screens/Compose/Root/Header/TextInput.tsx b/src/screens/Compose/Root/Header/TextInput.tsx index f02fb225..92b219e0 100644 --- a/src/screens/Compose/Root/Header/TextInput.tsx +++ b/src/screens/Compose/Root/Header/TextInput.tsx @@ -30,6 +30,8 @@ const ComposeTextInput: React.FC = () => { paddingBottom: StyleConstants.Spacing.M, marginHorizontal: StyleConstants.Spacing.Global.PagePadding, color: colors.primaryDefault, + borderBottomWidth: 0.5, + borderBottomColor: colors.backgroundDefaultTransparent, fontSize: adaptedFontsize, lineHeight: adaptedLineheight }} From fa066daa59fdb8215f0c3855f290924717a4a678 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Thu, 12 Jan 2023 21:28:29 +0100 Subject: [PATCH 7/8] Update HeaderConversation.tsx --- src/components/Timeline/Shared/HeaderConversation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Timeline/Shared/HeaderConversation.tsx b/src/components/Timeline/Shared/HeaderConversation.tsx index d09bce7c..db93625e 100644 --- a/src/components/Timeline/Shared/HeaderConversation.tsx +++ b/src/components/Timeline/Shared/HeaderConversation.tsx @@ -56,7 +56,7 @@ const HeaderConversation = ({ conversation }: Props) => { {t('componentTimeline:shared.header.conversation.withAccounts')} {conversation.accounts.map((account, index) => ( - {index !== 0 ? t('common:separator') : undefined} + {index !== 0 ? t('common:separator') : ' '} Date: Thu, 12 Jan 2023 21:44:28 +0100 Subject: [PATCH 8/8] Fix Android does not support menu sub --- .../Timeline/Shared/HeaderAndroid.tsx | 32 ++++-------- src/screens/Tabs/Shared/Account/index.tsx | 49 ++++++++++++------- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/src/components/Timeline/Shared/HeaderAndroid.tsx b/src/components/Timeline/Shared/HeaderAndroid.tsx index 9f9ec504..b81864af 100644 --- a/src/components/Timeline/Shared/HeaderAndroid.tsx +++ b/src/components/Timeline/Shared/HeaderAndroid.tsx @@ -68,28 +68,16 @@ const TimelineHeaderAndroid: React.FC = () => { ) case 'sub': return ( - // @ts-ignore - - - - {item.trigger.icon ? ( - - ) : null} - - - {item.items.map(sub => ( - - - {sub.icon ? ( - - ) : null} - - ))} - - + + {item.items.map(sub => ( + + + {sub.icon ? ( + + ) : null} + + ))} + ) } })} diff --git a/src/screens/Tabs/Shared/Account/index.tsx b/src/screens/Tabs/Shared/Account/index.tsx index cd74adef..15d8bb89 100644 --- a/src/screens/Tabs/Shared/Account/index.tsx +++ b/src/screens/Tabs/Shared/Account/index.tsx @@ -13,7 +13,7 @@ import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import React, { Fragment, useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' -import { Text, View } from 'react-native' +import { Platform, Text, View } from 'react-native' import { useSharedValue } from 'react-native-reanimated' import * as DropdownMenu from 'zeego/dropdown-menu' import AccountAttachments from './Attachments' @@ -110,19 +110,34 @@ const TabSharedAccount: React.FC ) case 'sub': - return ( - // @ts-ignore - - - - {item.trigger.icon ? ( - - ) : null} - - + if (Platform.OS === 'ios') { + return ( + // @ts-ignore + + + + {item.trigger.icon ? ( + + ) : null} + + + {item.items.map(sub => ( + + + {sub.icon ? ( + + ) : null} + + ))} + + + ) + } else { + return ( + {item.items.map(sub => ( @@ -131,9 +146,9 @@ const TabSharedAccount: React.FC ) : null} ))} - - - ) + + ) + } } })}