mirror of
https://github.com/tooot-app/app
synced 2025-04-24 23:18:47 +02:00
For #711
This commit is contained in:
parent
6e8cefd7c2
commit
af991fdc56
@ -37,6 +37,9 @@ const TabMePush: React.FC = () => {
|
|||||||
|
|
||||||
const appsQuery = useAppsQuery()
|
const appsQuery = useAppsQuery()
|
||||||
|
|
||||||
|
const [pushEnabled, setPushEnabled] = useState<boolean>()
|
||||||
|
const [pushCanAskAgain, setPushCanAskAgain] = useState<boolean>()
|
||||||
|
|
||||||
const checkPush = async () => {
|
const checkPush = async () => {
|
||||||
const permissions = await Notifications.getPermissionsAsync()
|
const permissions = await Notifications.getPermissionsAsync()
|
||||||
setPushEnabled(permissions.granted)
|
setPushEnabled(permissions.granted)
|
||||||
@ -47,6 +50,9 @@ const TabMePush: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
checkPush()
|
checkPush()
|
||||||
}, [])
|
}, [])
|
||||||
|
useEffect(() => {
|
||||||
|
checkPush()
|
||||||
|
}, [pushEnabled])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const subscription = AppState.addEventListener('change', checkPush)
|
const subscription = AppState.addEventListener('change', checkPush)
|
||||||
return () => {
|
return () => {
|
||||||
@ -54,9 +60,6 @@ const TabMePush: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const [pushEnabled, setPushEnabled] = useState<boolean>()
|
|
||||||
const [pushCanAskAgain, setPushCanAskAgain] = useState<boolean>()
|
|
||||||
|
|
||||||
const alerts = () =>
|
const alerts = () =>
|
||||||
push?.alerts
|
push?.alerts
|
||||||
? PUSH_DEFAULT().map(alert => (
|
? PUSH_DEFAULT().map(alert => (
|
||||||
@ -121,7 +124,7 @@ const TabMePush: React.FC = () => {
|
|||||||
<ScrollView>
|
<ScrollView>
|
||||||
{!!appsQuery.data?.vapid_key ? (
|
{!!appsQuery.data?.vapid_key ? (
|
||||||
<>
|
<>
|
||||||
{!!expoToken?.length ? (
|
{!!expoToken?.length || (!expoToken?.length && !pushEnabled) ? (
|
||||||
<>
|
<>
|
||||||
{pushEnabled === false ? (
|
{pushEnabled === false ? (
|
||||||
<MenuContainer>
|
<MenuContainer>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user