package com.test.basd.smartjunkcleaner.display

import android.util.Log
//import com.test.basd.cleanmaster.bean.ConfigBean.Companion.ID_PHONE_ACCELERATE
import com.test.basd.smartjunkcleaner.display.NotificationHelper.postActionNotification
import com.test.basd.smartjunkcleaner.helps.BaseApplication
import com.test.basd.smartjunkcleaner.helps.EventHelper
import java.util.TimerTask

/**
 * 循环推送任务
 */
class NotificationTimerTask(val eventParams: EventParams?) : TimerTask() {

    private val TAG = "NotificationTimerTask"


    override fun run() {
        oneShotNotification()
    }


    fun oneShotNotification(noLimit: Boolean = false) {

        val id = NotificationHelper.getPresentPushId()
        val isPush = PushStrategy.isPush(id, eventParams = eventParams)
        val log = "isPush=$isPush " + "id=${id} "
        EventHelper.event("pushCircleOrder_isPush", log)
        Log.d(TAG, log)
        if (isPush || noLimit) {
            val extra: Int? = null
//            if (id == ID_PHONE_ACCELERATE) {
//                extra = RamMemoryEx.getMemoryUsage(BaseApplication.context).toInt()
//                Log.d("MyService", "ram:      $extra")
//            }

            BaseApplication.context.postActionNotification(id, extra, 200000)
        }
    }

}