diff --git a/babel.config.js b/babel.config.js index 46de4f08..784ef4d1 100644 --- a/babel.config.js +++ b/babel.config.js @@ -9,11 +9,7 @@ module.exports = { }, ], 'preval', + 'react-native-paper/babel', 'react-native-reanimated/plugin', ], - env: { - production: { - plugins: ['react-native-paper/babel'], - }, - }, }; diff --git a/patches/expo-notifications+0.28.18.patch b/patches/expo-notifications+0.28.18.patch new file mode 100644 index 00000000..a302ae69 --- /dev/null +++ b/patches/expo-notifications+0.28.18.patch @@ -0,0 +1,28 @@ +diff --git a/node_modules/expo-notifications/build/getDevicePushTokenAsync.js b/node_modules/expo-notifications/build/getDevicePushTokenAsync.js +index 5deaa81..2b1cf95 100644 +--- a/node_modules/expo-notifications/build/getDevicePushTokenAsync.js ++++ b/node_modules/expo-notifications/build/getDevicePushTokenAsync.js +@@ -7,6 +7,9 @@ let nativeTokenPromise = null; + * @header fetch + */ + export default async function getDevicePushTokenAsync() { ++ if (Platform.OS === 'android') { ++ throw new Error("Push notifications are not supported on Android."); ++ } + if (!PushTokenManager.getDevicePushTokenAsync) { + throw new UnavailabilityError('ExpoNotifications', 'getDevicePushTokenAsync'); + } +diff --git a/node_modules/expo-notifications/build/getExpoPushTokenAsync.js b/node_modules/expo-notifications/build/getExpoPushTokenAsync.js +index b313f88..88578ad 100644 +--- a/node_modules/expo-notifications/build/getExpoPushTokenAsync.js ++++ b/node_modules/expo-notifications/build/getExpoPushTokenAsync.js +@@ -43,6 +43,9 @@ const productionBaseUrl = 'https://exp.host/--/api/v2/'; + * ``` + */ + export default async function getExpoPushTokenAsync(options = {}) { ++ if (Platform.OS === 'android') { ++ throw new Error("Push notifications are not supported on Android."); ++ } + const devicePushToken = options.devicePushToken || (await getDevicePushTokenAsync()); + const deviceId = options.deviceId || (await getDeviceIdAsync()); + const projectId = options.projectId || Constants.easConfig?.projectId; diff --git a/src/helpers/notification.ts b/src/helpers/notification.ts index 825edcf8..5d815de1 100644 --- a/src/helpers/notification.ts +++ b/src/helpers/notification.ts @@ -84,11 +84,10 @@ export const setUpPushNotifications = async () => { if (Platform.OS !== 'ios') { return; } - console.log('hi'); + if (!(await registerForPushNotifications())) { return; } - console.log('hello'); Notifications.setNotificationHandler({ handleNotification: async () => ({