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

Allow push count badge

This commit is contained in:
Zhiyuan Zheng
2022-06-03 21:25:20 +02:00
parent 9b109ba1bb
commit 31a3e87963
11 changed files with 166 additions and 147 deletions

View File

@ -5,6 +5,7 @@ import { MenuContainer, MenuRow } from '@components/Menu'
import CustomText from '@components/Text'
import { useAppDispatch } from '@root/store'
import { isDevelopment } from '@utils/checkEnvironment'
import { getExpoToken } from '@utils/slices/appSlice'
import { updateInstancePush } from '@utils/slices/instances/updatePush'
import { updateInstancePushAlert } from '@utils/slices/instances/updatePushAlert'
import { updateInstancePushDecode } from '@utils/slices/instances/updatePushDecode'
@ -45,16 +46,12 @@ const TabMePush: React.FC = () => {
setPushEnabled(settings.granted)
setPushCanAskAgain(settings.canAskAgain)
}
const expoToken = useSelector(getExpoToken)
useEffect(() => {
if (isDevelopment) {
setPushAvailable(true)
} else {
Notifications.getExpoPushTokenAsync({
experienceId: '@xmflsct/tooot',
applicationId: 'com.xmflsct.app.tooot'
})
.then(data => setPushAvailable(!!data))
.catch(() => setPushAvailable(false))
setPushAvailable(!!expoToken)
}
checkPush()