package com.base.locationsharewhite.fcm

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.applovin.sdk.AppLovinSdkUtils.runOnUiThread
import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.fcm.NotificationUiUtil.sendNotificationIfCan
import com.base.locationsharewhite.helper.EventUtils.event
import com.base.locationsharewhite.helper.MyApplication
import com.base.locationsharewhite.utils.ToastUtils.toast

class FcmReceiver : BroadcastReceiver() {
    private val TAG = "FcmReceiver"

    override fun onReceive(context: Context, intent: Intent) {
        event("FCM_Received", null, null, false)

        sendNotificationIfCan(context, PopupConstObject.POPUP_WHERE_FCM, null)

        if (BuildConfig.DEBUG) {
            runOnUiThread {
                runCatching {
                    MyApplication.appContext.toast("FcmReceiver fcm")
                }
            }
        }
    }
}
