mirror of
https://github.com/tooot-app/app
synced 2025-02-05 04:47:37 +01:00
Fixed #200
When clearing queryClient, we may want to create a global function to refetch last read position
This commit is contained in:
parent
0cbf08ed82
commit
45ba984ea3
@ -8,6 +8,7 @@ export default (): ExpoConfig => ({
|
|||||||
name: 'tooot',
|
name: 'tooot',
|
||||||
description: 'tooot for Mastodon',
|
description: 'tooot for Mastodon',
|
||||||
slug: 'tooot',
|
slug: 'tooot',
|
||||||
|
scheme: 'tooot',
|
||||||
version: toootVersion,
|
version: toootVersion,
|
||||||
privacy: 'hidden',
|
privacy: 'hidden',
|
||||||
assetBundlePatterns: ['assets/*'],
|
assetBundlePatterns: ['assets/*'],
|
||||||
|
@ -17,12 +17,17 @@ import { updatePreviousTab } from '@utils/slices/contextsSlice'
|
|||||||
import { updateAccountPreferences } from '@utils/slices/instances/updateAccountPreferences'
|
import { updateAccountPreferences } from '@utils/slices/instances/updateAccountPreferences'
|
||||||
import { updateConfiguration } from '@utils/slices/instances/updateConfiguration'
|
import { updateConfiguration } from '@utils/slices/instances/updateConfiguration'
|
||||||
import { updateFilters } from '@utils/slices/instances/updateFilters'
|
import { updateFilters } from '@utils/slices/instances/updateFilters'
|
||||||
import { getInstanceActive, getInstances } from '@utils/slices/instancesSlice'
|
import {
|
||||||
|
getInstanceActive,
|
||||||
|
getInstances,
|
||||||
|
updateInstanceActive
|
||||||
|
} from '@utils/slices/instancesSlice'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import { themes } from '@utils/styles/themes'
|
import { themes } from '@utils/styles/themes'
|
||||||
import * as Analytics from 'expo-firebase-analytics'
|
import * as Analytics from 'expo-firebase-analytics'
|
||||||
|
import * as Linking from 'expo-linking'
|
||||||
import { addScreenshotListener } from 'expo-screen-capture'
|
import { addScreenshotListener } from 'expo-screen-capture'
|
||||||
import React, { useCallback, useEffect, useRef } from 'react'
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Alert, Platform, StatusBar } from 'react-native'
|
import { Alert, Platform, StatusBar } from 'react-native'
|
||||||
import { useQueryClient } from 'react-query'
|
import { useQueryClient } from 'react-query'
|
||||||
@ -144,6 +149,37 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
|
|||||||
routeRef.current = currentRoute
|
routeRef.current = currentRoute
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
// Deep linking for compose
|
||||||
|
const [deeplinked, setDeeplinked] = useState(false)
|
||||||
|
useEffect(() => {
|
||||||
|
const getUrlAsync = async () => {
|
||||||
|
setDeeplinked(true)
|
||||||
|
|
||||||
|
const initialUrl = await Linking.parseInitialURLAsync()
|
||||||
|
|
||||||
|
if (initialUrl.path) {
|
||||||
|
const paths = initialUrl.path.split('/')
|
||||||
|
|
||||||
|
if (paths && paths.length) {
|
||||||
|
const instanceIndex = instances.findIndex(
|
||||||
|
instance => paths[0] === `@${instance.account.acct}@${instance.uri}`
|
||||||
|
)
|
||||||
|
if (instanceIndex !== -1 && instanceActive !== instanceIndex) {
|
||||||
|
dispatch(updateInstanceActive(instances[instanceIndex]))
|
||||||
|
queryClient.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (initialUrl.hostname === 'compose') {
|
||||||
|
navigationRef.navigate('Screen-Compose')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!deeplinked) {
|
||||||
|
getUrlAsync()
|
||||||
|
}
|
||||||
|
}, [instanceActive, instances, deeplinked])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<StatusBar
|
<StatusBar
|
||||||
|
@ -95,6 +95,3 @@ const styles = StyleSheet.create({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export default AccountInformationFields
|
export default AccountInformationFields
|
||||||
function htmlToText (note: string): any {
|
|
||||||
throw new Error('Function not implemented.')
|
|
||||||
}
|
|
||||||
|
@ -43,6 +43,7 @@ const pushUseReceive = ({ queryClient, instances }: Params) => {
|
|||||||
onPress: () => {
|
onPress: () => {
|
||||||
if (notificationIndex !== -1) {
|
if (notificationIndex !== -1) {
|
||||||
dispatch(updateInstanceActive(instances[notificationIndex]))
|
dispatch(updateInstanceActive(instances[notificationIndex]))
|
||||||
|
queryClient.clear()
|
||||||
}
|
}
|
||||||
pushUseNavigate(payloadData.notification_id)
|
pushUseNavigate(payloadData.notification_id)
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ const pushUseRespond = ({ queryClient, instances, dispatch }: Params) => {
|
|||||||
)
|
)
|
||||||
if (notificationIndex !== -1) {
|
if (notificationIndex !== -1) {
|
||||||
dispatch(updateInstanceActive(instances[notificationIndex]))
|
dispatch(updateInstanceActive(instances[notificationIndex]))
|
||||||
|
queryClient.clear()
|
||||||
}
|
}
|
||||||
pushUseNavigate(payloadData.notification_id)
|
pushUseNavigate(payloadData.notification_id)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user