diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/service/RefreshService.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/service/RefreshService.kt index cd5c0cddf..fe8265781 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/service/RefreshService.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/service/RefreshService.kt @@ -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 }