|
@@ -15,6 +15,8 @@ import { setupInterceptors } from 'src/utils/request';
|
|
import { ErrorModal } from 'src/components';
|
|
import { ErrorModal } from 'src/components';
|
|
import { NotificationProvider } from 'src/contexts/NotificationContext';
|
|
import { NotificationProvider } from 'src/contexts/NotificationContext';
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
|
+import * as Notifications from 'expo-notifications';
|
|
|
|
+import { Platform } from 'react-native';
|
|
|
|
|
|
const routingInstrumentation = new Sentry.ReactNavigationInstrumentation({
|
|
const routingInstrumentation = new Sentry.ReactNavigationInstrumentation({
|
|
enableTimeToInitialDisplay: true
|
|
enableTimeToInitialDisplay: true
|
|
@@ -24,10 +26,56 @@ Sentry.init({
|
|
dsn: 'https://c9b37005f4be22a17a582603ebc17598@o4507781200543744.ingest.de.sentry.io/4507781253824592',
|
|
dsn: 'https://c9b37005f4be22a17a582603ebc17598@o4507781200543744.ingest.de.sentry.io/4507781253824592',
|
|
integrations: [new Sentry.ReactNativeTracing({ routingInstrumentation })],
|
|
integrations: [new Sentry.ReactNativeTracing({ routingInstrumentation })],
|
|
debug: false,
|
|
debug: false,
|
|
- ignoreErrors: ['Network Error', 'ECONNABORTED', 'timeout of 10000ms exceeded'],
|
|
|
|
|
|
+ ignoreErrors: ['Network Error', 'ECONNABORTED', 'timeout of 10000ms exceeded']
|
|
});
|
|
});
|
|
|
|
|
|
const App = () => {
|
|
const App = () => {
|
|
|
|
+ async function setupNotificationChannels() {
|
|
|
|
+ if (Platform.OS === 'android') {
|
|
|
|
+ await Notifications.setNotificationChannelAsync('default', {
|
|
|
|
+ name: 'default',
|
|
|
|
+ importance: Notifications.AndroidImportance.MAX,
|
|
|
|
+ vibrationPattern: [0, 250, 250, 250],
|
|
|
|
+ lightColor: '#FF231F7C'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ setupNotificationChannels();
|
|
|
|
+ }, []);
|
|
|
|
+
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ let notificationListener: any;
|
|
|
|
+ let responseListener: any;
|
|
|
|
+
|
|
|
|
+ const checkLastNotificationResponse = async () => {
|
|
|
|
+ const lastNotificationResponse = await Notifications.getLastNotificationResponseAsync();
|
|
|
|
+ if (lastNotificationResponse) {
|
|
|
|
+ const data = lastNotificationResponse.notification.request.content.data;
|
|
|
|
+ console.log('lastNotificationResponse', lastNotificationResponse.notification.request);
|
|
|
|
+ console.log('dataLast', data);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ checkLastNotificationResponse();
|
|
|
|
+
|
|
|
|
+ notificationListener = Notifications.addNotificationReceivedListener((notification) => {
|
|
|
|
+ console.log('notification', notification.request);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ responseListener = Notifications.addNotificationResponseReceivedListener((response) => {
|
|
|
|
+ const data = response.notification.request.content.data;
|
|
|
|
+ console.log('payload', response.notification.request.trigger?.payload);
|
|
|
|
+ console.log('data', data);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return () => {
|
|
|
|
+ if (notificationListener) notificationListener.remove();
|
|
|
|
+ if (responseListener) responseListener.remove();
|
|
|
|
+ };
|
|
|
|
+ }, []);
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
<QueryClientProvider client={queryClient}>
|
|
<NotificationProvider>
|
|
<NotificationProvider>
|