mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Believe #638 can be closed now!
This commit is contained in:
@ -339,24 +339,25 @@ const ScreenCompose: React.FC<RootStackScreenProps<'Screen-Compose'>> = ({
|
||||
StoreReview?.isAvailableAsync()
|
||||
.then(() => StoreReview.requestReview())
|
||||
.catch(() => {})
|
||||
setGlobalStorage('app.count_till_store_review', (currentCount || 0) + 1)
|
||||
} else {
|
||||
setGlobalStorage('app.count_till_store_review', (currentCount || 0) + 1)
|
||||
}
|
||||
}
|
||||
|
||||
switch (params?.type) {
|
||||
case 'edit':
|
||||
mutateTimeline.mutate({
|
||||
type: 'editItem',
|
||||
queryKey: params.queryKey,
|
||||
rootQueryKey: params.rootQueryKey,
|
||||
status: res
|
||||
case undefined:
|
||||
case 'conversation':
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ['Timeline', { page: 'Following' }],
|
||||
exact: false
|
||||
})
|
||||
break
|
||||
case 'edit': // doesn't work
|
||||
case 'deleteEdit':
|
||||
case 'reply':
|
||||
if (params?.queryKey && params.queryKey[1].page === 'Toot') {
|
||||
queryClient.invalidateQueries(params.queryKey)
|
||||
for (const navState of params.navigationState) {
|
||||
navState && queryClient.invalidateQueries(navState)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import Timeline from '@components/Timeline'
|
||||
import TimelineDefault from '@components/Timeline/Default'
|
||||
import { NativeStackScreenProps } from '@react-navigation/native-stack'
|
||||
import { TabLocalStackParamList } from '@utils/navigation/navigators'
|
||||
import usePopToTop from '@utils/navigation/usePopToTop'
|
||||
import { useListsQuery } from '@utils/queryHooks/lists'
|
||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||
import { setAccountStorage, useAccountStorage } from '@utils/storage/actions'
|
||||
@ -176,6 +175,7 @@ const Root: React.FC<NativeStackScreenProps<TabLocalStackParamList, 'Tab-Local-R
|
||||
/>
|
||||
)
|
||||
})
|
||||
navigation.setParams({ queryKey: queryKey })
|
||||
}, [mode, queryKey[1], pageLocal, lists])
|
||||
|
||||
return (
|
||||
|
@ -1,10 +1,17 @@
|
||||
import Timeline from '@components/Timeline'
|
||||
import TimelineDefault from '@components/Timeline/Default'
|
||||
import { NativeStackScreenProps } from '@react-navigation/native-stack'
|
||||
import { TabMeStackParamList } from '@utils/navigation/navigators'
|
||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||
import React from 'react'
|
||||
import React, { useEffect } from 'react'
|
||||
|
||||
const TabMeBookmarks = () => {
|
||||
const TabMeBookmarks: React.FC<NativeStackScreenProps<TabMeStackParamList, 'Tab-Me-Bookmarks'>> = ({
|
||||
navigation
|
||||
}) => {
|
||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Bookmarks' }]
|
||||
useEffect(() => {
|
||||
navigation.setParams({ queryKey: queryKey })
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<Timeline
|
||||
|
@ -1,10 +1,17 @@
|
||||
import Timeline from '@components/Timeline'
|
||||
import TimelineConversation from '@components/Timeline/Conversation'
|
||||
import { NativeStackScreenProps } from '@react-navigation/native-stack'
|
||||
import { TabMeStackParamList } from '@utils/navigation/navigators'
|
||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||
import React from 'react'
|
||||
import React, { useEffect } from 'react'
|
||||
|
||||
const TabMeConversations = () => {
|
||||
const TabMeConversations: React.FC<
|
||||
NativeStackScreenProps<TabMeStackParamList, 'Tab-Me-Conversations'>
|
||||
> = ({ navigation }) => {
|
||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Conversations' }]
|
||||
useEffect(() => {
|
||||
navigation.setParams({ queryKey: queryKey })
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<Timeline
|
||||
|
@ -1,10 +1,17 @@
|
||||
import Timeline from '@components/Timeline'
|
||||
import TimelineDefault from '@components/Timeline/Default'
|
||||
import { NativeStackScreenProps } from '@react-navigation/native-stack'
|
||||
import { TabMeStackParamList } from '@utils/navigation/navigators'
|
||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||
import React from 'react'
|
||||
import React, { useEffect } from 'react'
|
||||
|
||||
const TabMeFavourites = () => {
|
||||
const TabMeFavourites: React.FC<
|
||||
NativeStackScreenProps<TabMeStackParamList, 'Tab-Me-Favourites'>
|
||||
> = ({ navigation }) => {
|
||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Favourites' }]
|
||||
useEffect(() => {
|
||||
navigation.setParams({ queryKey: queryKey })
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<Timeline
|
||||
|
@ -23,13 +23,13 @@ const TabMeListList: React.FC<TabMeStackScreenProps<'Tab-Me-List-List'>> = ({ na
|
||||
|
||||
return (
|
||||
<MenuContainer>
|
||||
{data?.map((params, index) => (
|
||||
{data?.map((list, index) => (
|
||||
<MenuRow
|
||||
key={index}
|
||||
iconFront='List'
|
||||
iconBack='ChevronRight'
|
||||
title={params.title}
|
||||
onPress={() => navigation.navigate('Tab-Me-List', params)}
|
||||
title={list.title}
|
||||
onPress={() => navigation.navigate('Tab-Me-List', { list })}
|
||||
/>
|
||||
))}
|
||||
</MenuContainer>
|
||||
|
@ -2,8 +2,9 @@ import Icon from '@components/Icon'
|
||||
import { displayMessage } from '@components/Message'
|
||||
import Timeline from '@components/Timeline'
|
||||
import TimelineDefault from '@components/Timeline/Default'
|
||||
import { NativeStackScreenProps } from '@react-navigation/native-stack'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { TabMeStackScreenProps } from '@utils/navigation/navigators'
|
||||
import { TabMeStackParamList } from '@utils/navigation/navigators'
|
||||
import { QueryKeyLists, useListsMutation } from '@utils/queryHooks/lists'
|
||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
@ -13,13 +14,16 @@ import { useTranslation } from 'react-i18next'
|
||||
import * as DropdownMenu from 'zeego/dropdown-menu'
|
||||
import { menuListAccounts, menuListDelete, menuListEdit } from './menus'
|
||||
|
||||
const TabMeList: React.FC<TabMeStackScreenProps<'Tab-Me-List'>> = ({
|
||||
const TabMeList: React.FC<NativeStackScreenProps<TabMeStackParamList, 'Tab-Me-List'>> = ({
|
||||
navigation,
|
||||
route: { key, params }
|
||||
route: {
|
||||
key,
|
||||
params: { list }
|
||||
}
|
||||
}) => {
|
||||
const { colors } = useTheme()
|
||||
const { t } = useTranslation(['common', 'screenTabs'])
|
||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'List', list: params.id }]
|
||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'List', list: list.id }]
|
||||
|
||||
const queryKeyLists: QueryKeyLists = ['Lists']
|
||||
const queryClient = useQueryClient()
|
||||
@ -39,9 +43,9 @@ const TabMeList: React.FC<TabMeStackScreenProps<'Tab-Me-List'>> = ({
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
const listAccounts = menuListAccounts({ params })
|
||||
const listEdit = menuListEdit({ params, key })
|
||||
const listDelete = menuListDelete({ params, mutation })
|
||||
const listAccounts = menuListAccounts({ list })
|
||||
const listEdit = menuListEdit({ list, key })
|
||||
const listDelete = menuListDelete({ list, mutation })
|
||||
|
||||
navigation.setOptions({
|
||||
headerRight: () => (
|
||||
@ -67,7 +71,8 @@ const TabMeList: React.FC<TabMeStackScreenProps<'Tab-Me-List'>> = ({
|
||||
</DropdownMenu.Root>
|
||||
)
|
||||
})
|
||||
}, [params])
|
||||
navigation.setParams({ queryKey })
|
||||
}, [list])
|
||||
|
||||
return (
|
||||
<Timeline
|
||||
|
@ -3,19 +3,19 @@ import navigationRef from '@utils/navigation/navigationRef'
|
||||
import i18next from 'i18next'
|
||||
import { Alert } from 'react-native'
|
||||
|
||||
export const menuListAccounts = ({ params }: { params: Mastodon.List }) => ({
|
||||
export const menuListAccounts = ({ list }: { list: Mastodon.List }) => ({
|
||||
key: 'list-accounts',
|
||||
onSelect: () => navigationRef.navigate<any>('Tab-Me-List-Accounts', params),
|
||||
onSelect: () => navigationRef.navigate<any>('Tab-Me-List-Accounts', list),
|
||||
title: i18next.t('screenTabs:me.listAccounts.heading'),
|
||||
icon: 'person.crop.circle.fill.badge.checkmark'
|
||||
})
|
||||
|
||||
export const menuListEdit = ({ params, key }: { params: Mastodon.List; key: string }) => ({
|
||||
export const menuListEdit = ({ list, key }: { list: Mastodon.List; key: string }) => ({
|
||||
key: 'list-edit',
|
||||
onSelect: () =>
|
||||
navigationRef.navigate<any>('Tab-Me-List-Edit', {
|
||||
type: 'edit',
|
||||
payload: params,
|
||||
payload: list,
|
||||
key
|
||||
}),
|
||||
title: i18next.t('screenTabs:me.listEdit.heading'),
|
||||
@ -23,22 +23,22 @@ export const menuListEdit = ({ params, key }: { params: Mastodon.List; key: stri
|
||||
})
|
||||
|
||||
export const menuListDelete = ({
|
||||
params,
|
||||
list,
|
||||
mutation
|
||||
}: {
|
||||
params: Mastodon.List
|
||||
list: Mastodon.List
|
||||
mutation: UseMutationResult<any, any, unknown, unknown>
|
||||
}) => ({
|
||||
key: 'list-delete',
|
||||
onSelect: () =>
|
||||
Alert.alert(
|
||||
i18next.t('screenTabs:me.listDelete.confirm.title', { list: params.title.slice(0, 20) }),
|
||||
i18next.t('screenTabs:me.listDelete.confirm.title', { list: list.title.slice(0, 20) }),
|
||||
i18next.t('screenTabs:me.listDelete.confirm.message'),
|
||||
[
|
||||
{
|
||||
text: i18next.t('common:buttons.delete'),
|
||||
style: 'destructive',
|
||||
onPress: () => mutation.mutate({ type: 'delete', payload: params })
|
||||
onPress: () => mutation.mutate({ type: 'delete', payload: list })
|
||||
},
|
||||
{ text: i18next.t('common:buttons.cancel') }
|
||||
]
|
||||
|
@ -1,19 +1,38 @@
|
||||
import { HeaderRight } from '@components/Header'
|
||||
import Timeline from '@components/Timeline'
|
||||
import TimelineNotifications from '@components/Timeline/Notifications'
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
||||
import { ScreenTabsScreenProps, TabNotificationsStackParamList } from '@utils/navigation/navigators'
|
||||
import { createNativeStackNavigator, NativeStackScreenProps } from '@react-navigation/native-stack'
|
||||
import { TabNotificationsStackParamList } from '@utils/navigation/navigators'
|
||||
import usePopToTop from '@utils/navigation/usePopToTop'
|
||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||
import React from 'react'
|
||||
import React, { useEffect } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import TabShared from '../Shared'
|
||||
import TabNotificationsFilters from './Filters'
|
||||
|
||||
const Stack = createNativeStackNavigator<TabNotificationsStackParamList>()
|
||||
|
||||
const Root = () => {
|
||||
const Root: React.FC<
|
||||
NativeStackScreenProps<TabNotificationsStackParamList, 'Tab-Notifications-Root'>
|
||||
> = ({ navigation }) => {
|
||||
const { t } = useTranslation('screenTabs')
|
||||
|
||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Notifications' }]
|
||||
useEffect(() => {
|
||||
navigation.setOptions({
|
||||
title: t('tabs.notifications.name'),
|
||||
headerRight: () => (
|
||||
<HeaderRight
|
||||
accessibilityLabel={t('notifications.filters.accessibilityLabel')}
|
||||
accessibilityHint={t('notifications.filters.accessibilityHint')}
|
||||
content='Filter'
|
||||
onPress={() => navigation.navigate('Tab-Notifications-Filters')}
|
||||
/>
|
||||
)
|
||||
})
|
||||
navigation.setParams({ queryKey })
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<Timeline
|
||||
queryKey={queryKey}
|
||||
@ -24,30 +43,12 @@ const Root = () => {
|
||||
)
|
||||
}
|
||||
|
||||
const TabNotifications = ({ navigation }: ScreenTabsScreenProps<'Tab-Notifications'>) => {
|
||||
const { t } = useTranslation('screenTabs')
|
||||
|
||||
const TabNotifications: React.FC = () => {
|
||||
usePopToTop()
|
||||
|
||||
return (
|
||||
<Stack.Navigator screenOptions={{ headerShadowVisible: false }}>
|
||||
<Stack.Screen
|
||||
name='Tab-Notifications-Root'
|
||||
component={Root}
|
||||
options={{
|
||||
title: t('tabs.notifications.name'),
|
||||
headerRight: () => (
|
||||
<HeaderRight
|
||||
accessibilityLabel={t('notifications.filters.accessibilityLabel')}
|
||||
accessibilityHint={t('notifications.filters.accessibilityHint')}
|
||||
content='Filter'
|
||||
onPress={() =>
|
||||
navigation.navigate('Tab-Notifications', { screen: 'Tab-Notifications-Filters' })
|
||||
}
|
||||
/>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<Stack.Screen name='Tab-Notifications-Root' component={Root} />
|
||||
<Stack.Screen
|
||||
name='Tab-Notifications-Filters'
|
||||
component={TabNotificationsFilters}
|
||||
|
@ -2,7 +2,8 @@ import { HeaderRight } from '@components/Header'
|
||||
import Timeline from '@components/Timeline'
|
||||
import TimelineDefault from '@components/Timeline/Default'
|
||||
import SegmentedControl from '@react-native-community/segmented-control'
|
||||
import { NativeStackScreenProps } from '@react-navigation/native-stack'
|
||||
import { useNavigation } from '@react-navigation/native'
|
||||
import { NativeStackNavigationProp, NativeStackScreenProps } from '@react-navigation/native-stack'
|
||||
import { TabPublicStackParamList } from '@utils/navigation/navigators'
|
||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||
import { getGlobalStorage, setGlobalStorage } from '@utils/storage/actions'
|
||||
@ -14,7 +15,12 @@ import { Dimensions } from 'react-native'
|
||||
import { SceneMap, TabView } from 'react-native-tab-view'
|
||||
|
||||
const Route = ({ route: { key: page } }: { route: any }) => {
|
||||
const navigation =
|
||||
useNavigation<NativeStackNavigationProp<TabPublicStackParamList, 'Tab-Public-Root'>>()
|
||||
const queryKey: QueryKeyTimeline = ['Timeline', { page }]
|
||||
useEffect(() => {
|
||||
navigation.setParams({ queryKey })
|
||||
}, [])
|
||||
return (
|
||||
<Timeline
|
||||
queryKey={queryKey}
|
||||
|
@ -51,6 +51,17 @@ const TabSharedAccount: React.FC<TabSharedStackScreenProps<'Tab-Shared-Account'>
|
||||
}
|
||||
})
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
const [queryKey, setQueryKey] = useState<QueryKeyTimeline>([
|
||||
'Timeline',
|
||||
{
|
||||
page: 'Account',
|
||||
id: account._remote ? data?.id : account.id,
|
||||
exclude_reblogs: true,
|
||||
only_media: false
|
||||
}
|
||||
])
|
||||
|
||||
const mShare = menuShare({ type: 'account', url: data?.url })
|
||||
const mAccount = menuAccount({ type: 'account', openChange: true, account: data })
|
||||
useEffect(() => {
|
||||
@ -97,19 +108,12 @@ const TabSharedAccount: React.FC<TabSharedStackScreenProps<'Tab-Shared-Account'>
|
||||
}
|
||||
})
|
||||
}, [mAccount])
|
||||
useEffect(() => {
|
||||
navigation.setParams({ queryKey })
|
||||
}, [queryKey[1]])
|
||||
|
||||
const scrollY = useSharedValue(0)
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
const [queryKey, setQueryKey] = useState<QueryKeyTimeline>([
|
||||
'Timeline',
|
||||
{
|
||||
page: 'Account',
|
||||
id: account._remote ? data?.id : account.id,
|
||||
exclude_reblogs: true,
|
||||
only_media: false
|
||||
}
|
||||
])
|
||||
const page = queryKey[1]
|
||||
|
||||
const [segment, setSegment] = useState<number>(0)
|
||||
|
@ -41,6 +41,7 @@ const TabSharedAttachments: React.FC<TabSharedStackScreenProps<'Tab-Shared-Attac
|
||||
</CustomText>
|
||||
)
|
||||
})
|
||||
navigation.setParams({ queryKey })
|
||||
}, [])
|
||||
|
||||
const queryKey: QueryKeyTimeline = [
|
||||
|
@ -17,15 +17,16 @@ const TabSharedHashtag: React.FC<TabSharedStackScreenProps<'Tab-Shared-Hashtag'>
|
||||
params: { hashtag }
|
||||
}
|
||||
}) => {
|
||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Hashtag', hashtag }]
|
||||
|
||||
useEffect(() => {
|
||||
navigation.setOptions({
|
||||
headerLeft: () => <HeaderLeft onPress={() => navigation.goBack()} />,
|
||||
title: `#${decodeURIComponent(hashtag)}`
|
||||
})
|
||||
navigation.setParams({ queryKey: queryKey })
|
||||
}, [])
|
||||
|
||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Hashtag', hashtag }]
|
||||
|
||||
const { t } = useTranslation(['common', 'screenTabs'])
|
||||
|
||||
const canFollowTags = featureCheck('follow_tags')
|
||||
|
@ -21,13 +21,17 @@ import { Path, Svg } from 'react-native-svg'
|
||||
const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||
navigation,
|
||||
route: {
|
||||
params: { toot, rootQueryKey }
|
||||
params: { toot }
|
||||
}
|
||||
}) => {
|
||||
const { colors } = useTheme()
|
||||
const { t } = useTranslation(['componentTimeline', 'screenTabs'])
|
||||
|
||||
const [hasRemoteContent, setHasRemoteContent] = useState<boolean>(false)
|
||||
const queryKey: { local: QueryKeyTimeline; remote: QueryKeyTimeline } = {
|
||||
local: ['Timeline', { page: 'Toot', toot: toot.id, remote: false }],
|
||||
remote: ['Timeline', { page: 'Toot', toot: toot.id, remote: true }]
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
navigation.setOptions({
|
||||
@ -61,6 +65,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||
),
|
||||
headerLeft: () => <HeaderLeft onPress={() => navigation.goBack()} />
|
||||
})
|
||||
navigation.setParams({ toot, queryKey: toot._remote ? queryKey.remote : queryKey.local })
|
||||
}, [hasRemoteContent])
|
||||
|
||||
const flRef = useRef<FlatList>(null)
|
||||
@ -71,10 +76,6 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||
{ ...toot, _level: 0, key: 'cached' }
|
||||
])
|
||||
const highlightIndex = useRef<number>(0)
|
||||
const queryKey: { local: QueryKeyTimeline; remote: QueryKeyTimeline } = {
|
||||
local: ['Timeline', { page: 'Toot', toot: toot.id, remote: false }],
|
||||
remote: ['Timeline', { page: 'Toot', toot: toot.id, remote: true }]
|
||||
}
|
||||
const queryLocal = useQuery(
|
||||
queryKey.local,
|
||||
async () => {
|
||||
@ -280,7 +281,6 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||
<TimelineDefault
|
||||
item={item}
|
||||
queryKey={item._remote ? queryKey.remote : queryKey.local}
|
||||
rootQueryKey={rootQueryKey}
|
||||
highlighted={toot.id === item.id || item.id === 'cached'}
|
||||
isConversation={toot.id !== item.id && item.id !== 'cached'}
|
||||
/>
|
||||
|
Reference in New Issue
Block a user