2018-01-04 19:52:25 +01:00
|
|
|
package jp.juggler.subwaytooter
|
|
|
|
|
|
|
|
import android.content.BroadcastReceiver
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.Intent
|
2020-12-11 18:30:10 +01:00
|
|
|
import jp.juggler.subwaytooter.notification.PollingWorker
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-12-01 00:02:18 +01:00
|
|
|
import jp.juggler.util.LogCategory
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
class EventReceiver : BroadcastReceiver() {
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
internal val log = LogCategory("EventReceiver")
|
|
|
|
const val ACTION_NOTIFICATION_DELETE = "notification_delete"
|
|
|
|
}
|
2018-01-21 13:46:36 +01:00
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
override fun onReceive(context : Context, intent : Intent?) {
|
2019-10-22 20:21:03 +02:00
|
|
|
when(val action = intent?.action) {
|
|
|
|
|
|
|
|
Intent.ACTION_BOOT_COMPLETED ->
|
|
|
|
PollingWorker.queueBootCompleted(context)
|
|
|
|
|
|
|
|
Intent.ACTION_MY_PACKAGE_REPLACED ->
|
|
|
|
PollingWorker.queuePackageReplaced(context)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2020-01-16 10:31:14 +01:00
|
|
|
ACTION_NOTIFICATION_DELETE ->
|
|
|
|
PollingWorker.queueNotificationDeleted( context,intent.data)
|
2019-10-22 20:21:03 +02:00
|
|
|
|
2021-06-13 13:48:48 +02:00
|
|
|
else -> log.e("onReceive: unsupported action ${action}")
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|