package com.convenient.android.common.utils.firebase

import android.os.Bundle
import com.convenient.android.common.config.MyPdfBaseModule
import com.google.firebase.analytics.FirebaseAnalytics

/**
 * @classname:
 * @author: LiuXiaoLong
 * @date: 2022/7/29
 * description: firebase埋点
 */
object FirebaseEventUtils {

    private val mFirebaseAnalytics : FirebaseAnalytics by lazy(LazyThreadSafetyMode.SYNCHRONIZED){
        FirebaseAnalytics.getInstance(MyPdfBaseModule.getAppContext()!!).apply {
            setAnalyticsCollectionEnabled(true)
        }
    }


    fun logEvent(eventName : String, bundle : (Bundle)-> Unit){
        mFirebaseAnalytics.logEvent(eventName, Bundle().apply {
            bundle.invoke(this)
        })
    }

    fun logEvent(eventName: String, bundle: Bundle){
        mFirebaseAnalytics.logEvent(eventName, bundle)
    }


}