1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Ready for push feature

This commit is contained in:
Zhiyuan Zheng
2021-03-04 01:03:53 +01:00
parent a4a6e9316b
commit cc02626adb
17 changed files with 255 additions and 135 deletions

View File

@ -0,0 +1,35 @@
import apiInstance from '@api/instance'
import { NavigationContainerRef } from '@react-navigation/native'
const pushUseNavigate = (
navigationRef: React.RefObject<NavigationContainerRef>,
id?: Mastodon.Notification['id']
) => {
navigationRef.current?.navigate('Screen-Tabs', {
screen: 'Tab-Notifications',
params: {
screen: 'Tab-Notifications-Root'
}
})
if (!id) {
return
}
apiInstance<Mastodon.Notification>({
method: 'get',
url: `notifications/${id}`
}).then(({ body }) => {
if (body.status) {
navigationRef.current?.navigate('Screen-Tabs', {
screen: 'Tab-Notifications',
params: {
screen: 'Tab-Shared-Toot',
params: { toot: body.status }
}
})
}
})
}
export default pushUseNavigate