Optimize background Workers, remove redundant JobServices
1. Adapt the location callback in WeatherWorker to coroutines 2. Merge EventListenerJob into UpdateCalendarWorker 3. Remove BatteryListenerJob, as it's impossible to use Jobs to detect battery status
This commit is contained in:
@ -4,7 +4,6 @@ import android.Manifest
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.provider.CalendarContract
|
||||
import com.tommasoberlose.anotherwidget.services.EventListenerJob
|
||||
import com.tommasoberlose.anotherwidget.models.Event
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import com.tommasoberlose.anotherwidget.services.UpdateCalendarWorker
|
||||
@ -50,11 +49,11 @@ object CalendarHelper {
|
||||
}
|
||||
|
||||
fun setEventUpdatesAndroidN(context: Context) {
|
||||
EventListenerJob.schedule(context)
|
||||
UpdateCalendarWorker.enqueueTrigger(context)
|
||||
}
|
||||
|
||||
fun removeEventUpdatesAndroidN(context: Context) {
|
||||
EventListenerJob.remove(context)
|
||||
UpdateCalendarWorker.cancelTrigger(context)
|
||||
}
|
||||
|
||||
fun List<Event>.applyFilters() : List<Event> {
|
||||
|
Reference in New Issue
Block a user