mirror of
				https://github.com/tooot-app/app
				synced 2025-06-05 22:19:13 +02:00 
			
		
		
		
	Now fix push not available
Because expo-application is not installed
This commit is contained in:
		| @@ -4,7 +4,7 @@ import Icon from '@components/Icon' | |||||||
| import { MenuContainer, MenuRow } from '@components/Menu' | import { MenuContainer, MenuRow } from '@components/Menu' | ||||||
| import CustomText from '@components/Text' | import CustomText from '@components/Text' | ||||||
| import { useAppDispatch } from '@root/store' | import { useAppDispatch } from '@root/store' | ||||||
| import { isDevelopment, isRelease } from '@utils/checkEnvironment' | import { isDevelopment } from '@utils/checkEnvironment' | ||||||
| import { updateInstancePush } from '@utils/slices/instances/updatePush' | import { updateInstancePush } from '@utils/slices/instances/updatePush' | ||||||
| import { updateInstancePushAlert } from '@utils/slices/instances/updatePushAlert' | import { updateInstancePushAlert } from '@utils/slices/instances/updatePushAlert' | ||||||
| import { updateInstancePushDecode } from '@utils/slices/instances/updatePushDecode' | import { updateInstancePushDecode } from '@utils/slices/instances/updatePushDecode' | ||||||
| @@ -36,8 +36,7 @@ const TabMePush: React.FC = () => { | |||||||
|   const dispatch = useAppDispatch() |   const dispatch = useAppDispatch() | ||||||
|   const instancePush = useSelector(getInstancePush) |   const instancePush = useSelector(getInstancePush) | ||||||
|  |  | ||||||
|   const [pushAvailable, setPushAvailable] = |   const [pushAvailable, setPushAvailable] = useState<boolean>() | ||||||
|     useState<Notifications.ExpoPushToken>() |  | ||||||
|   const [pushEnabled, setPushEnabled] = useState<boolean>() |   const [pushEnabled, setPushEnabled] = useState<boolean>() | ||||||
|   const [pushCanAskAgain, setPushCanAskAgain] = useState<boolean>() |   const [pushCanAskAgain, setPushCanAskAgain] = useState<boolean>() | ||||||
|   const checkPush = async () => { |   const checkPush = async () => { | ||||||
| @@ -48,13 +47,14 @@ const TabMePush: React.FC = () => { | |||||||
|   } |   } | ||||||
|   useEffect(() => { |   useEffect(() => { | ||||||
|     if (isDevelopment) { |     if (isDevelopment) { | ||||||
|       setPushAvailable({ data: '', type: 'expo' }) |       setPushAvailable(true) | ||||||
|     } else { |     } else { | ||||||
|       Notifications.getExpoPushTokenAsync({ |       Notifications.getExpoPushTokenAsync({ | ||||||
|         experienceId: '@xmflsct/tooot' |         experienceId: '@xmflsct/tooot', | ||||||
|  |         applicationId: 'com.xmflsct.tooot.app' | ||||||
|       }) |       }) | ||||||
|         .then(data => setPushAvailable(data)) |         .then(data => setPushAvailable(!!data)) | ||||||
|         .catch(() => setPushAvailable(undefined)) |         .catch(() => setPushAvailable(false)) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     checkPush() |     checkPush() | ||||||
| @@ -190,13 +190,6 @@ const TabMePush: React.FC = () => { | |||||||
|             /> |             /> | ||||||
|           </MenuContainer> |           </MenuContainer> | ||||||
|           <MenuContainer>{alerts}</MenuContainer> |           <MenuContainer>{alerts}</MenuContainer> | ||||||
|           {!isRelease ? ( |  | ||||||
|             <MenuContainer> |  | ||||||
|               <CustomText fontSize='M' style={{ color: colors.primaryDefault }}> |  | ||||||
|                 {pushAvailable.data} |  | ||||||
|               </CustomText> |  | ||||||
|             </MenuContainer> |  | ||||||
|           ) : null} |  | ||||||
|         </> |         </> | ||||||
|       ) : ( |       ) : ( | ||||||
|         <View |         <View | ||||||
|   | |||||||
| @@ -25,7 +25,8 @@ const pushUseConnect = ({ t, instances }: Params) => { | |||||||
|         ? 'DEVELOPMENT_TOKEN_1' |         ? 'DEVELOPMENT_TOKEN_1' | ||||||
|         : ( |         : ( | ||||||
|             await Notifications.getExpoPushTokenAsync({ |             await Notifications.getExpoPushTokenAsync({ | ||||||
|               experienceId: '@xmflsct/tooot' |               experienceId: '@xmflsct/tooot', | ||||||
|  |               applicationId: 'com.xmflsct.tooot.app' | ||||||
|             }) |             }) | ||||||
|           ).data |           ).data | ||||||
|  |  | ||||||
|   | |||||||
| @@ -17,7 +17,8 @@ export const updateInstancePush = createAsyncThunk( | |||||||
|       ? 'DEVELOPMENT_TOKEN_1' |       ? 'DEVELOPMENT_TOKEN_1' | ||||||
|       : ( |       : ( | ||||||
|           await Notifications.getExpoPushTokenAsync({ |           await Notifications.getExpoPushTokenAsync({ | ||||||
|             experienceId: '@xmflsct/tooot' |             experienceId: '@xmflsct/tooot', | ||||||
|  |             applicationId: 'com.xmflsct.tooot.app' | ||||||
|           }) |           }) | ||||||
|         ).data |         ).data | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,7 +24,8 @@ export const updateInstancePushDecode = createAsyncThunk( | |||||||
|       ? 'DEVELOPMENT_TOKEN_1' |       ? 'DEVELOPMENT_TOKEN_1' | ||||||
|       : ( |       : ( | ||||||
|           await Notifications.getExpoPushTokenAsync({ |           await Notifications.getExpoPushTokenAsync({ | ||||||
|             experienceId: '@xmflsct/tooot' |             experienceId: '@xmflsct/tooot', | ||||||
|  |             applicationId: 'com.xmflsct.tooot.app' | ||||||
|           }) |           }) | ||||||
|         ).data |         ).data | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user