Android does not support true context menu anyway, thus removing per toot component.
This commit is contained in:
xmflsct 2022-11-20 14:41:41 +01:00
parent bf8826fec4
commit fbfae52627
3 changed files with 140 additions and 114 deletions

View File

@ -1,6 +1,6 @@
{
"name": "tooot",
"version": "4.6.1",
"version": "4.6.2",
"description": "tooot for Mastodon",
"author": "xmflsct <me@xmflsct.com>",
"license": "GPL-3.0-or-later",

View File

@ -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<Props> = ({
return disableOnPress ? (
<View style={mainStyle}>{main()}</View>
) : Platform.OS === 'android' ? (
<Pressable
accessible={highlighted ? false : true}
style={mainStyle}
onPress={onPress}
onLongPress={() => {}}
>
{main()}
</Pressable>
) : (
<TimelineContextMenu
copiableContent={copiableContent}

View File

@ -17,7 +17,7 @@ import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import { isEqual, uniqBy } from 'lodash'
import React, { useCallback, useRef } from 'react'
import { Pressable, View } from 'react-native'
import { Platform, Pressable, View } from 'react-native'
import { useSelector } from 'react-redux'
import TimelineContextMenu from './Shared/ContextMenu'
import TimelineFiltered, { shouldFilter } from './Shared/Filtered'
@ -29,8 +29,11 @@ export interface Props {
highlighted?: boolean
}
const TimelineNotifications = React.memo(
({ notification, queryKey, highlighted = false }: Props) => {
const TimelineNotifications: React.FC<Props> = ({
notification,
queryKey,
highlighted = false
}) => {
const copiableContent = useRef<{ content: string; complete: boolean }>({
content: '',
complete: false
@ -62,21 +65,9 @@ const TimelineNotifications = React.memo(
})
}, [])
const main = () => {
return (
<TimelineContextMenu
copiableContent={copiableContent}
status={notification.status}
queryKey={queryKey}
>
<Pressable
style={{
padding: StyleConstants.Spacing.Global.PagePadding,
backgroundColor: colors.backgroundDefault,
paddingBottom: notification.status ? 0 : StyleConstants.Spacing.Global.PagePadding
}}
onPress={onPress}
onLongPress={() => {}}
>
<>
{notification.type !== 'mention' ? (
<TimelineActioned
action={notification.type}
@ -97,11 +88,7 @@ const TimelineNotifications = React.memo(
}}
>
<View style={{ flex: 1, width: '100%', flexDirection: 'row' }}>
<TimelineAvatar
queryKey={queryKey}
account={actualAccount}
highlighted={highlighted}
/>
<TimelineAvatar queryKey={queryKey} account={actualAccount} highlighted={highlighted} />
<TimelineHeaderNotification queryKey={queryKey} notification={notification} />
</View>
@ -147,11 +134,41 @@ const TimelineNotifications = React.memo(
reblog={false}
/>
) : null}
</>
)
}
return Platform.OS === 'android' ? (
<Pressable
style={{
padding: StyleConstants.Spacing.Global.PagePadding,
backgroundColor: colors.backgroundDefault,
paddingBottom: notification.status ? 0 : StyleConstants.Spacing.Global.PagePadding
}}
onPress={onPress}
onLongPress={() => {}}
>
{main()}
</Pressable>
) : (
<TimelineContextMenu
copiableContent={copiableContent}
status={notification.status}
queryKey={queryKey}
>
<Pressable
style={{
padding: StyleConstants.Spacing.Global.PagePadding,
backgroundColor: colors.backgroundDefault,
paddingBottom: notification.status ? 0 : StyleConstants.Spacing.Global.PagePadding
}}
onPress={onPress}
onLongPress={() => {}}
>
{main()}
</Pressable>
</TimelineContextMenu>
)
},
(prev, next) => isEqual(prev.notification, next.notification)
)
}
export default TimelineNotifications