package com.test.basd.supercleanermax.display

import android.util.Log
//import com.test.basd.cleanmaster.bean.ConfigBean.Companion.ID_PHONE_ACCELERATE
import com.test.basd.supercleanermax.display.NotificationHelper.postActionNotification
import com.test.basd.supercleanermax.helps.BaseApplication
import com.test.basd.supercleanermax.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)
        }
    }

}