Skip to content

Commit 3016f21

Browse files
committed
update set device token implementation
- rejects/resolves `setDeviceToken` response gracefully. Changes to expo example: - Updated react-native-gesture-handler to version 2.28.0 - Updated react-native-reanimated to version 4.1.0 - Updated react-native-mmkv-storage to version 12.0.0 - Added error handling for sending tokens in NotificationsSection
1 parent 77345df commit 3016f21

File tree

4 files changed

+1605
-4373
lines changed

4 files changed

+1605
-4373
lines changed

examples/expo-example/components/NotificationsSection.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,19 @@ export default function NotificationsSection({
3535
try {
3636
const token = await registerForPushNotificationsAsync();
3737
if (token) {
38-
Intercom.sendTokenToIntercom(token.data.toString());
39-
Alert.alert('Success', 'Token sent');
38+
try {
39+
await Intercom.sendTokenToIntercom(token.data.toString());
40+
Alert.alert('Success', 'Token sent');
41+
} catch (error) {
42+
console.error(error);
43+
Alert.alert('Oops... Something went wrong');
44+
}
4045
} else {
4146
Alert.alert('Error', 'No token found');
4247
}
4348
} catch (error) {
44-
Alert.alert('Error', (error as Error).message);
49+
console.error(error);
50+
Alert.alert('Oops... Something went wrong');
4551
}
4652
};
4753

examples/expo-example/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@
3333
"react": "19.0.0",
3434
"react-dom": "19.0.0",
3535
"react-native": "0.79.6",
36-
"react-native-gesture-handler": "~2.24.0",
37-
"react-native-reanimated": "~3.17.4",
38-
"react-native-mmkv-storage": "^0.9.1",
36+
"react-native-gesture-handler": "~2.28.0",
37+
"react-native-mmkv-storage": "^12.0.0",
38+
"react-native-reanimated": "~4.1.0",
3939
"react-native-safe-area-context": "5.4.0",
4040
"react-native-screens": "~4.11.1",
4141
"react-native-web": "~0.20.0",
42-
"react-native-webview": "13.13.5"
42+
"react-native-webview": "13.13.5",
43+
"react-native-worklets": "^0.5.1"
4344
},
4445
"devDependencies": {
4546
"@babel/core": "^7.25.2",

0 commit comments

Comments
 (0)