fixed legacy refresh service
This commit is contained in:
parent
5b1ac84a3b
commit
7af26a34b9
|
@ -23,10 +23,8 @@ import android.app.Service
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import org.mariotaku.abstask.library.AbstractTask
|
||||
import org.mariotaku.ktextension.convert
|
||||
import org.mariotaku.twidere.TwidereConstants.LOGTAG
|
||||
import org.mariotaku.abstask.library.TaskStarter
|
||||
import org.mariotaku.twidere.annotation.AutoRefreshType
|
||||
import org.mariotaku.twidere.constant.IntentConstants.*
|
||||
import org.mariotaku.twidere.model.AccountPreferences
|
||||
|
@ -54,9 +52,9 @@ class RefreshService : Service() {
|
|||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
Log.d(LOGTAG, "onStartCommand ${intent?.action}")
|
||||
val task = run {
|
||||
val type = intent?.action?.convert { getRefreshType(it) } ?: return@run null
|
||||
val action = intent?.action ?: return@run null
|
||||
val type = getRefreshType(action) ?: return@run null
|
||||
return@run createJobTask(this, type)
|
||||
} ?: run {
|
||||
stopSelfResult(startId)
|
||||
|
@ -65,6 +63,7 @@ class RefreshService : Service() {
|
|||
task.callback = {
|
||||
stopSelfResult(startId)
|
||||
}
|
||||
TaskStarter.execute(task)
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue