package com.example.vastlib.pin

import android.app.NotificationManager
import android.os.Bundle
import android.service.notification.StatusBarNotification
import com.example.vastlib.utils.LogUtils

object NotificationManger {
    const val NotifyNfm = "NOTIFY_NFM"
    var listener:((Bundle)->Unit)? = null

    fun StatusBarNotification.comeON(){
        notification.extras?.let {content->
            val nfm = NotificationMessage(
                content = content.getCharSequence("android.text", "").toString(),
                from = content.getString("android.title",""),
                time = System.currentTimeMillis(),
                app = packageName,
            )
            val bundle = Bundle()
            bundle.putSerializable(NotifyNfm, nfm)
            listener?.invoke(bundle)
            LogUtils.info("content notify: $content")
        }
    }
}
