-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
19 lines (17 loc) · 828 Bytes
/
index.js
File metadata and controls
19 lines (17 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import 'react-native-gesture-handler';
import { AppRegistry } from 'react-native';
import messaging from '@react-native-firebase/messaging';
import notifee, { EventType } from '@notifee/react-native';
import App from './App';
import { name as appName } from './app.json';
import { showIncomingWorkNotification } from './src/notifications/notificationService';
import RingtoneService from './src/notifications/RingtoneService';
// Background FCM handler
messaging().setBackgroundMessageHandler(async remoteMessage => {
if (remoteMessage.data?.type === 'NEW_WORK') {
console.log('Background FCM received', remoteMessage.data);
const notificationId = await showIncomingWorkNotification(remoteMessage.data);
RingtoneService.startRingtone();
}
});
AppRegistry.registerComponent(appName, () => App);