Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More correct usage of expedited workers #566

Merged
merged 11 commits into from
Feb 22, 2024
Prev Previous commit
Next Next commit
RefreshCollectionsWorker is not long-running -> no foreground service…
… type needed
  • Loading branch information
rfc2822 committed Feb 13, 2024
commit 20d008bfb374edf01cad9f5015532194eaad2763
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import android.accounts.Account
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.ServiceInfo
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.hilt.work.HiltWorker
Expand Down Expand Up @@ -254,10 +252,7 @@ class RefreshCollectionsWorker @AssistedInject constructor(
.setOngoing(true)
.setPriority(NotificationCompat.PRIORITY_LOW)
.build()
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
ForegroundInfo(NotificationUtils.NOTIFY_SYNC_EXPEDITED, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)
else
ForegroundInfo(NotificationUtils.NOTIFY_SYNC_EXPEDITED, notification)
return ForegroundInfo(NotificationUtils.NOTIFY_SYNC_EXPEDITED, notification)
}

private fun notifyRefreshError(contentText: String, contentIntent: Intent) {
Expand Down
Loading