package app.furmeet.events.brasilfurfest.notification

import android.app.job.JobParameters
import android.app.job.JobService
import app.furmeet.events.brasilfurfest.helper.resourcesAliased
import app.furmeet.events.brasilfurfest.schedule.managers.FullUpdateCheckerCancellable

class ScheduleUpdaterJobService : JobService() {
    private lateinit var fucc: FullUpdateCheckerCancellable

    override fun onStartJob(jobParameters: JobParameters): Boolean {
        resourcesAliased = resources
        fucc = FullUpdateCheckerCancellable(baseContext)
        fucc.run {
            NotificationFirer().fire(baseContext)
            jobFinished(jobParameters, true)
        }
        return true
    }

    override fun onStopJob(jobParameters: JobParameters): Boolean {
        fucc.stop()
        jobFinished(jobParameters, true)
        return true
    }

}