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