package com.base.appzxhy.business.push.fcm

import android.annotation.SuppressLint
import com.base.appzxhy.bean.push.NotificationSendBean
import com.base.appzxhy.bean.push.NotificationSendBean.Companion.POPUP_WHERE_FCM
import com.base.appzxhy.business.helper.EventUtils.event
import com.base.appzxhy.business.push.notification.MyNotificationManager
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import org.json.JSONObject

@SuppressLint("MissingFirebaseInstanceTokenRefresh")
class MessagingService : FirebaseMessagingService() {
    override fun onMessageReceived(remoteMessage: RemoteMessage) {
        super.onMessageReceived(remoteMessage)
        val data = JSONObject(remoteMessage.data.toString())
        event("FCM_Received", "MessagingService", data)
        MyNotificationManager.submitSendBean(NotificationSendBean(this, POPUP_WHERE_FCM))
    }
}