Skip to content

Commit

Permalink
[Fix] Set onlyAlertOnce for file job & FTP server notifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanghai committed Sep 16, 2023
1 parent 050a1aa commit 5eeb8c6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import me.zhanghai.android.files.util.NotificationChannelTemplate
import me.zhanghai.android.files.util.NotificationTemplate
import me.zhanghai.android.files.util.startActivitySafe

val backgroundActivityStartNotificationTemplate: NotificationTemplate =
val backgroundActivityStartNotificationTemplate =
NotificationTemplate(
NotificationChannelTemplate(
"background_activity_start",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import me.zhanghai.android.files.R
import me.zhanghai.android.files.util.NotificationChannelTemplate
import me.zhanghai.android.files.util.NotificationTemplate

val fileJobNotificationTemplate: NotificationTemplate =
val fileJobNotificationTemplate =
NotificationTemplate(
NotificationChannelTemplate(
"file_job",
Expand All @@ -23,6 +23,7 @@ val fileJobNotificationTemplate: NotificationTemplate =
colorRes = R.color.color_primary,
smallIcon = R.drawable.notification_icon,
ongoing = true,
onlyAlertOnce = true,
category = NotificationCompat.CATEGORY_PROGRESS,
priority = NotificationCompat.PRIORITY_LOW
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import me.zhanghai.android.files.util.NotificationChannelTemplate
import me.zhanghai.android.files.util.NotificationTemplate
import me.zhanghai.android.files.util.createIntent

val ftpServerServiceNotificationTemplate: NotificationTemplate =
val ftpServerServiceNotificationTemplate =
NotificationTemplate(
NotificationChannelTemplate(
"ftp_server",
Expand All @@ -31,6 +31,7 @@ val ftpServerServiceNotificationTemplate: NotificationTemplate =
smallIcon = R.drawable.notification_icon,
contentTitleRes = R.string.ftp_server_notification_title,
ongoing = true,
onlyAlertOnce = true,
category = NotificationCompat.CATEGORY_SERVICE,
priority = NotificationCompat.PRIORITY_LOW
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class NotificationTemplate(
@StringRes val contentTitleRes: Int? = null,
@StringRes val contentTextRes: Int? = null,
val ongoing: Boolean? = null,
val onlyAlertOnce: Boolean? = null,
val autoCancel: Boolean? = null,
val category: String? = null,
val priority: Int? = null
Expand All @@ -35,6 +36,7 @@ class NotificationTemplate(
contentTitleRes?.let { setContentTitle(context.getText(contentTitleRes)) }
contentTextRes?.let { setContentText(context.getText(contentTextRes)) }
ongoing?.let { setOngoing(it) }
onlyAlertOnce?.let { setOnlyAlertOnce(it) }
autoCancel?.let { setAutoCancel(it) }
category?.let { setCategory(it) }
this@NotificationTemplate.priority?.let { priority = it }
Expand Down

0 comments on commit 5eeb8c6

Please sign in to comment.