Skip to content

Commit b9db5e6

Browse files
committed
fix(notifications): remove tap action from in-app notification
1 parent ca31dde commit b9db5e6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

feature/notification/api/src/commonMain/kotlin/net/thunderbird/feature/notification/api/ui/host/visual/InAppNotificationVisual.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ data class BannerGlobalVisual(
6262
},
6363
severity = notification.severity,
6464
action = notification
65-
.actions
65+
.actionsWithoutTap
6666
.let { actions ->
6767
check(actions.size in 0..1) {
6868
"A notification with a BannerGlobalNotification style must have at zero or one action"
@@ -125,7 +125,7 @@ data class BannerInlineVisual(
125125
supportingText = checkContentText(notification.contentText),
126126
severity = notification.severity,
127127
actions = notification
128-
.actions
128+
.actionsWithoutTap
129129
.let { actions ->
130130
check(actions.size in 1..2) {
131131
"A notification with a BannerInlineNotification style must have at one or two actions"
@@ -197,7 +197,7 @@ data class SnackbarVisual(
197197
message = checkNotNull(notification.contentText) {
198198
"A notification with a SnackbarNotification style must have a contentText not null"
199199
},
200-
action = checkNotNull(notification.actions.singleOrNull()) {
200+
action = checkNotNull(notification.actionsWithoutTap.singleOrNull()) {
201201
"A notification with a SnackbarNotification style must have exactly one action"
202202
},
203203
duration = style.duration,
@@ -219,3 +219,8 @@ private inline fun <
219219
transform(style)
220220
}
221221
}
222+
223+
private val InAppNotification.actionsWithoutTap: Set<NotificationAction>
224+
get() = actions
225+
.filterNot { it is NotificationAction.Tap }
226+
.toSet()

0 commit comments

Comments
 (0)