From fbfae5262724ac81edf90f457ef73158915aae63 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sun, 20 Nov 2022 14:41:41 +0100 Subject: [PATCH] Try fix #451 Android does not support true context menu anyway, thus removing per toot component. --- package.json | 2 +- src/components/Timeline/Default.tsx | 11 +- src/components/Timeline/Notifications.tsx | 241 ++++++++++++---------- 3 files changed, 140 insertions(+), 114 deletions(-) diff --git a/package.json b/package.json index fca7ccd7..5179551f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tooot", - "version": "4.6.1", + "version": "4.6.2", "description": "tooot for Mastodon", "author": "xmflsct ", "license": "GPL-3.0-or-later", diff --git a/src/components/Timeline/Default.tsx b/src/components/Timeline/Default.tsx index 8eb7876d..5adcf7e4 100644 --- a/src/components/Timeline/Default.tsx +++ b/src/components/Timeline/Default.tsx @@ -17,7 +17,7 @@ import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import { uniqBy } from 'lodash' import React, { useRef } from 'react' -import { Pressable, StyleProp, View, ViewStyle } from 'react-native' +import { Platform, Pressable, StyleProp, View, ViewStyle } from 'react-native' import { useSelector } from 'react-redux' import TimelineContextMenu from './Shared/ContextMenu' import TimelineFeedback from './Shared/Feedback' @@ -156,6 +156,15 @@ const TimelineDefault: React.FC = ({ return disableOnPress ? ( {main()} + ) : Platform.OS === 'android' ? ( + {}} + > + {main()} + ) : ( { - const copiableContent = useRef<{ content: string; complete: boolean }>({ - content: '', - complete: false +const TimelineNotifications: React.FC = ({ + notification, + queryKey, + highlighted = false +}) => { + const copiableContent = useRef<{ content: string; complete: boolean }>({ + content: '', + complete: false + }) + + const filtered = + notification.status && + shouldFilter({ + copiableContent, + status: notification.status, + queryKey }) + if (notification.status && filtered) { + return + } - const filtered = - notification.status && - shouldFilter({ - copiableContent, - status: notification.status, - queryKey + const { colors } = useTheme() + const instanceAccount = useSelector(getInstanceAccount, (prev, next) => prev?.id === next?.id) + const navigation = useNavigation>() + + const actualAccount = notification.status ? notification.status.account : notification.account + + const onPress = useCallback(() => { + analytics('timeline_notification_press') + notification.status && + navigation.push('Tab-Shared-Toot', { + toot: notification.status, + rootQueryKey: queryKey }) - if (notification.status && filtered) { - return - } - - const { colors } = useTheme() - const instanceAccount = useSelector(getInstanceAccount, (prev, next) => prev?.id === next?.id) - const navigation = useNavigation>() - - const actualAccount = notification.status ? notification.status.account : notification.account - - const onPress = useCallback(() => { - analytics('timeline_notification_press') - notification.status && - navigation.push('Tab-Shared-Toot', { - toot: notification.status, - rootQueryKey: queryKey - }) - }, []) + }, []) + const main = () => { return ( - - + {notification.type !== 'mention' ? ( + + ) : null} + + {}} > - {notification.type !== 'mention' ? ( - - ) : null} - - - - - - - - {notification.status ? ( - - {notification.status.content.length > 0 ? ( - - ) : null} - {notification.status.poll ? ( - - ) : null} - {notification.status.media_attachments.length > 0 ? ( - - ) : null} - {notification.status.card ? : null} - - - ) : null} + + + {notification.status ? ( - d?.id !== instanceAccount?.id), - d => d?.id - ).map(d => d?.acct)} - reblog={false} - /> + + {notification.status.content.length > 0 ? ( + + ) : null} + {notification.status.poll ? ( + + ) : null} + {notification.status.media_attachments.length > 0 ? ( + + ) : null} + {notification.status.card ? : null} + + ) : null} - - + + + {notification.status ? ( + d?.id !== instanceAccount?.id), + d => d?.id + ).map(d => d?.acct)} + reblog={false} + /> + ) : null} + ) - }, - (prev, next) => isEqual(prev.notification, next.notification) -) + } + + return Platform.OS === 'android' ? ( + {}} + > + {main()} + + ) : ( + + {}} + > + {main()} + + + ) +} export default TimelineNotifications