Commit 2671390e authored by Dmytro Zavgorodniy's avatar Dmytro Zavgorodniy

[RNA-761] Add NotificationManager

parent 9d3c6c2d
// import { Platform } from 'react-native'
// import FCM, { FCMEvent } from 'react-native-fcm'
export default class NotificationManager {
static instance = null
user = null
static getInstance() {
if (!this.instance) {
this.instance = new NotificationManager()
}
return this.instance
}
setUser(user) {
if (this.user !== user && user !== null) {
// this.subscribeForNotifications()
} else if (user === null) {
// this.unsubscribeNotifications()
}
this.user = user
}
subscribeForNotifications = () => {
// if (Platform.OS === 'ios') {
// FCM.requestPermissions().catch(() => {
// // this.unsubscribeNotifications()
// // remove token
// })
// }
// FCM.getFCMToken().then(() => {
// // Save token
// })
//
// this.notificationListener = FCM.on(FCMEvent.Notification, async (notif) => {
// if (notif.remote_notification) {
// // parse notification
// }
// })
}
unsubscribeNotifications = () => {
// this.notificationListener.remove()
// this.refreshTokenListener.remove()
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment