mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Use proper environment mapping
This commit is contained in:
@@ -2,6 +2,7 @@ import analytics from '@components/analytics'
|
||||
import Button from '@components/Button'
|
||||
import Icon from '@components/Icon'
|
||||
import { MenuContainer, MenuRow } from '@components/Menu'
|
||||
import { isDevelopment } from '@utils/checkEnvironment'
|
||||
import { updateInstancePush } from '@utils/slices/instances/updatePush'
|
||||
import { updateInstancePushAlert } from '@utils/slices/instances/updatePushAlert'
|
||||
import { updateInstancePushDecode } from '@utils/slices/instances/updatePushDecode'
|
||||
@@ -45,11 +46,16 @@ const TabMePush: React.FC = () => {
|
||||
setPushCanAskAgain(settings.canAskAgain)
|
||||
}
|
||||
useEffect(() => {
|
||||
Notifications.getExpoPushTokenAsync({
|
||||
experienceId: '@xmflsct/tooot'
|
||||
})
|
||||
.then(data => setPushAvailable(!!data))
|
||||
.catch(() => setPushAvailable(false))
|
||||
if (isDevelopment) {
|
||||
setPushAvailable(true)
|
||||
} else {
|
||||
Notifications.getExpoPushTokenAsync({
|
||||
experienceId: '@xmflsct/tooot'
|
||||
})
|
||||
.then(data => setPushAvailable(!!data))
|
||||
.catch(() => setPushAvailable(false))
|
||||
}
|
||||
|
||||
checkPush()
|
||||
const subscription = AppState.addEventListener('change', checkPush)
|
||||
return () => {
|
||||
@@ -106,7 +112,7 @@ const TabMePush: React.FC = () => {
|
||||
|
||||
return (
|
||||
<ScrollView>
|
||||
{pushAvailable !== false ? (
|
||||
{pushAvailable === true ? (
|
||||
<>
|
||||
{pushEnabled === false ? (
|
||||
<MenuContainer>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import * as Updates from 'expo-updates'
|
||||
import { isDevelopment } from '@utils/checkEnvironment'
|
||||
import React from 'react'
|
||||
import { ScrollView } from 'react-native-gesture-handler'
|
||||
import SettingsAnalytics from './Settings/Analytics'
|
||||
@@ -13,12 +13,7 @@ const TabMeSettings: React.FC = () => {
|
||||
<SettingsTooot />
|
||||
<SettingsAnalytics />
|
||||
|
||||
{__DEV__ ||
|
||||
['development'].some(channel =>
|
||||
Updates.releaseChannel.includes(channel)
|
||||
) ? (
|
||||
<SettingsDev />
|
||||
) : null}
|
||||
{isDevelopment ? <SettingsDev /> : null}
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@ import { MenuContainer, MenuRow } from '@components/Menu'
|
||||
import { useNavigation } from '@react-navigation/native'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
import * as Updates from 'expo-updates'
|
||||
import * as Linking from 'expo-linking'
|
||||
import * as StoreReview from 'expo-store-review'
|
||||
import * as WebBrowser from 'expo-web-browser'
|
||||
@@ -12,6 +11,7 @@ import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { getInstanceActive } from '@utils/slices/instancesSlice'
|
||||
import { isCandidate, isDevelopment } from '@utils/checkEnvironment'
|
||||
|
||||
const SettingsTooot: React.FC = () => {
|
||||
const instanceActive = useSelector(getInstanceActive)
|
||||
@@ -36,10 +36,7 @@ const SettingsTooot: React.FC = () => {
|
||||
Linking.openURL('https://www.buymeacoffee.com/xmflsct')
|
||||
}}
|
||||
/>
|
||||
{__DEV__ ||
|
||||
['release', 'development'].some(channel =>
|
||||
Updates.releaseChannel?.includes(channel)
|
||||
) ? (
|
||||
{isDevelopment || isCandidate ? (
|
||||
<MenuRow
|
||||
title={t('me.settings.review.heading')}
|
||||
content={
|
||||
|
Reference in New Issue
Block a user