Skip to content

Commit

Permalink
feat: cancel option in media sync notification
Browse files Browse the repository at this point in the history
  • Loading branch information
BrayanDSO committed Apr 11, 2024
1 parent 1e3615f commit 5a4955c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,13 @@ class SyncMediaWorker(
}

override suspend fun getForegroundInfo(): ForegroundInfo {
val title = applicationContext.getString(R.string.syncing_media)
val cancelTitle = applicationContext.getString(R.string.dialog_cancel)
val notification = buildNotification {
setContentTitle(applicationContext.getString(R.string.syncing_media))
setContentTitle(title)
setOngoing(true)
setProgress(0, 0, true)
addAction(R.drawable.close_icon, cancelTitle, cancelIntent)
foregroundServiceBehavior = NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE
}
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
Expand Down

0 comments on commit 5a4955c

Please sign in to comment.