Skip to content

Commit ca81e33

Browse files
committed
refactor(notification): remove notification id
1 parent 377c97c commit ca81e33

File tree

6 files changed

+5
-59
lines changed

6 files changed

+5
-59
lines changed

feature/notification/api/src/commonMain/kotlin/net/thunderbird/feature/notification/api/content/AppNotification.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import kotlinx.datetime.toLocalDateTime
88
import net.thunderbird.feature.notification.api.LockscreenNotificationAppearance
99
import net.thunderbird.feature.notification.api.NotificationChannel
1010
import net.thunderbird.feature.notification.api.NotificationGroup
11-
import net.thunderbird.feature.notification.api.NotificationId
1211
import net.thunderbird.feature.notification.api.NotificationSeverity
1312
import net.thunderbird.feature.notification.api.ui.action.NotificationAction
1413

@@ -18,7 +17,6 @@ import net.thunderbird.feature.notification.api.ui.action.NotificationAction
1817
* This interface defines the common properties that all notifications must have.
1918
* Must not be directly implemented. You must extend [AppNotification] instead.
2019
*
21-
* @property id The unique identifier of the notification.
2220
* @property title The title of the notification.
2321
* @property accessibilityText The text to be used for accessibility purposes.
2422
* @property contentText The main content text of the notification, can be null.
@@ -28,7 +26,6 @@ import net.thunderbird.feature.notification.api.ui.action.NotificationAction
2826
* @see AppNotification
2927
*/
3028
sealed interface Notification {
31-
val id: NotificationId
3229
val title: String
3330
val accessibilityText: String
3431
val contentText: String?

feature/notification/api/src/commonMain/kotlin/net/thunderbird/feature/notification/api/content/AuthenticationErrorNotification.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.thunderbird.feature.notification.api.content
22

33
import net.thunderbird.feature.notification.api.NotificationChannel
4-
import net.thunderbird.feature.notification.api.NotificationId
54
import net.thunderbird.feature.notification.api.NotificationSeverity
65
import net.thunderbird.feature.notification.api.ui.action.NotificationAction
76
import net.thunderbird.feature.notification.resources.Res
@@ -16,7 +15,6 @@ import org.jetbrains.compose.resources.getString
1615
*/
1716
@ConsistentCopyVisibility
1817
data class AuthenticationErrorNotification private constructor(
19-
override val id: NotificationId,
2018
override val title: String,
2119
override val contentText: String?,
2220
override val channel: NotificationChannel,
@@ -36,17 +34,14 @@ data class AuthenticationErrorNotification private constructor(
3634
/**
3735
* Creates an [AuthenticationErrorNotification].
3836
*
39-
* @param id The unique identifier for this notification.
4037
* @param accountUuid The UUID of the account associated with the authentication error.
4138
* @param accountDisplayName The display name of the account associated with the authentication error.
4239
* @return An [AuthenticationErrorNotification] instance.
4340
*/
4441
suspend operator fun invoke(
45-
id: NotificationId,
4642
accountUuid: String,
4743
accountDisplayName: String,
4844
): AuthenticationErrorNotification = AuthenticationErrorNotification(
49-
id = id,
5045
title = getString(
5146
resource = Res.string.notification_authentication_error_title,
5247
accountDisplayName,

feature/notification/api/src/commonMain/kotlin/net/thunderbird/feature/notification/api/content/CertificateErrorNotification.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.thunderbird.feature.notification.api.content
22

33
import net.thunderbird.feature.notification.api.NotificationChannel
4-
import net.thunderbird.feature.notification.api.NotificationId
54
import net.thunderbird.feature.notification.api.NotificationSeverity
65
import net.thunderbird.feature.notification.api.ui.action.NotificationAction
76
import net.thunderbird.feature.notification.resources.Res
@@ -18,7 +17,6 @@ import org.jetbrains.compose.resources.getString
1817
*/
1918
@ConsistentCopyVisibility
2019
data class CertificateErrorNotification private constructor(
21-
override val id: NotificationId,
2220
override val title: String,
2321
override val contentText: String,
2422
val lockScreenTitle: String,
@@ -36,17 +34,14 @@ data class CertificateErrorNotification private constructor(
3634
/**
3735
* Creates a [CertificateErrorNotification].
3836
*
39-
* @param id The unique identifier for this notification.
4037
* @param accountUuid The UUID of the account associated with the notification.
4138
* @param accountDisplayName The display name of the account associated with the notification.
4239
* @return A [CertificateErrorNotification] instance.
4340
*/
4441
suspend operator fun invoke(
45-
id: NotificationId,
4642
accountUuid: String,
4743
accountDisplayName: String,
4844
): CertificateErrorNotification = CertificateErrorNotification(
49-
id = id,
5045
title = getString(resource = Res.string.notification_certificate_error_title, accountDisplayName),
5146
lockScreenTitle = getString(resource = Res.string.notification_certificate_error_public),
5247
contentText = getString(resource = Res.string.notification_certificate_error_text),

feature/notification/api/src/commonMain/kotlin/net/thunderbird/feature/notification/api/content/FailedToCreateNotification.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.thunderbird.feature.notification.api.content
22

33
import net.thunderbird.feature.notification.api.NotificationChannel
4-
import net.thunderbird.feature.notification.api.NotificationId
54
import net.thunderbird.feature.notification.api.NotificationSeverity
65
import net.thunderbird.feature.notification.resources.Res
76
import net.thunderbird.feature.notification.resources.notification_notify_error_text
@@ -16,7 +15,6 @@ import org.jetbrains.compose.resources.getString
1615
*/
1716
@ConsistentCopyVisibility
1817
data class FailedToCreateNotification private constructor(
19-
override val id: NotificationId,
2018
override val title: String,
2119
override val contentText: String?,
2220
override val channel: NotificationChannel,
@@ -28,17 +26,14 @@ data class FailedToCreateNotification private constructor(
2826
/**
2927
* Creates a [FailedToCreateNotification] instance.
3028
*
31-
* @param id The unique identifier for this notification.
3229
* @param accountUuid The UUID of the account associated with the failed notification.
3330
* @param failedNotification The original [AppNotification] that failed to be created.
3431
* @return A [FailedToCreateNotification] instance.
3532
*/
3633
suspend operator fun invoke(
37-
id: NotificationId,
3834
accountUuid: String,
3935
failedNotification: AppNotification,
4036
): FailedToCreateNotification = FailedToCreateNotification(
41-
id = id,
4237
title = getString(resource = Res.string.notification_notify_error_title),
4338
contentText = getString(resource = Res.string.notification_notify_error_text),
4439
channel = NotificationChannel.Miscellaneous(accountUuid = accountUuid),

feature/notification/api/src/commonMain/kotlin/net/thunderbird/feature/notification/api/content/MailNotification.kt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package net.thunderbird.feature.notification.api.content
33
import net.thunderbird.core.common.exception.rootCauseMassage
44
import net.thunderbird.feature.notification.api.NotificationChannel
55
import net.thunderbird.feature.notification.api.NotificationGroup
6-
import net.thunderbird.feature.notification.api.NotificationId
76
import net.thunderbird.feature.notification.api.NotificationSeverity
87
import net.thunderbird.feature.notification.api.ui.action.NotificationAction
98
import net.thunderbird.feature.notification.resources.Res
@@ -26,7 +25,6 @@ sealed class MailNotification : AppNotification(), SystemNotification {
2625
override val severity: NotificationSeverity = NotificationSeverity.Information
2726

2827
data class Fetching(
29-
override val id: NotificationId,
3028
override val title: String,
3129
override val accessibilityText: String,
3230
override val contentText: String?,
@@ -41,21 +39,18 @@ sealed class MailNotification : AppNotification(), SystemNotification {
4139
/**
4240
* Creates a [Fetching] notification.
4341
*
44-
* @param id The unique identifier for this notification.
4542
* @param accountUuid The UUID of the account being fetched.
4643
* @param accountDisplayName The display name of the account being fetched.
4744
* @param folderName The name of the folder being fetched, or null if fetching all folders.
4845
* @return A [Fetching] notification.
4946
*/
5047
suspend operator fun invoke(
51-
id: NotificationId,
5248
accountUuid: String,
5349
accountDisplayName: String,
5450
folderName: String?,
5551
): Fetching {
5652
val title = getString(resource = Res.string.notification_bg_sync_title)
5753
return Fetching(
58-
id = id,
5954
title = title,
6055
accessibilityText = folderName?.let { folderName ->
6156
getString(
@@ -78,7 +73,6 @@ sealed class MailNotification : AppNotification(), SystemNotification {
7873
}
7974

8075
data class Sending(
81-
override val id: NotificationId,
8276
override val title: String,
8377
override val accessibilityText: String,
8478
override val contentText: String?,
@@ -93,17 +87,14 @@ sealed class MailNotification : AppNotification(), SystemNotification {
9387
/**
9488
* Creates a [Sending] notification.
9589
*
96-
* @param id The unique identifier for this notification.
9790
* @param accountUuid The UUID of the account sending the message.
9891
* @param accountDisplayName The display name of the account sending the message.
9992
* @return A [Sending] notification.
10093
*/
10194
suspend operator fun invoke(
102-
id: NotificationId,
10395
accountUuid: String,
10496
accountDisplayName: String,
10597
): Sending = Sending(
106-
id = id,
10798
title = getString(resource = Res.string.notification_bg_send_title),
10899
accessibilityText = getString(
109100
resource = Res.string.notification_bg_send_ticker,
@@ -116,7 +107,6 @@ sealed class MailNotification : AppNotification(), SystemNotification {
116107
}
117108

118109
data class SendFailed(
119-
override val id: NotificationId,
120110
override val title: String,
121111
override val contentText: String?,
122112
override val channel: NotificationChannel,
@@ -132,17 +122,14 @@ sealed class MailNotification : AppNotification(), SystemNotification {
132122
/**
133123
* Creates a [SendFailed] notification.
134124
*
135-
* @param id The unique identifier for this notification.
136125
* @param accountUuid The UUID of the account sending the message.
137126
* @param exception The exception that occurred during sending.
138127
* @return A [SendFailed] notification.
139128
*/
140129
suspend operator fun invoke(
141-
id: NotificationId,
142130
accountUuid: String,
143131
exception: Exception,
144132
): SendFailed = SendFailed(
145-
id = id,
146133
title = getString(resource = Res.string.send_failure_subject),
147134
contentText = exception.rootCauseMassage,
148135
channel = NotificationChannel.Miscellaneous(accountUuid = accountUuid),
@@ -153,7 +140,6 @@ sealed class MailNotification : AppNotification(), SystemNotification {
153140
/**
154141
* Represents a notification for a single new email.
155142
*
156-
* @property id The unique identifier for this notification.
157143
* @property accountUuid The UUID of the account that received the email.
158144
* @property accountName The display name of the account that received the email.
159145
* @property messagesNotificationChannelSuffix The suffix for the messages notification channel.
@@ -164,7 +150,6 @@ sealed class MailNotification : AppNotification(), SystemNotification {
164150
* @property group The notification group this notification belongs to, if any.
165151
*/
166152
data class NewMailSingleMail(
167-
override val id: NotificationId,
168153
val accountUuid: String,
169154
val accountName: String,
170155
val messagesNotificationChannelSuffix: String,
@@ -197,7 +182,6 @@ sealed class MailNotification : AppNotification(), SystemNotification {
197182
/**
198183
* Represents a summary notification for new mail.
199184
*
200-
* @property id The unique identifier for this notification.
201185
* @property accountUuid The UUID of the account.
202186
* @property accountName The display name of the account.
203187
* @property messagesNotificationChannelSuffix The suffix for the messages notification channel.
@@ -207,7 +191,6 @@ sealed class MailNotification : AppNotification(), SystemNotification {
207191
*/
208192
@ConsistentCopyVisibility
209193
data class NewMailSummaryMail private constructor(
210-
override val id: NotificationId,
211194
val accountUuid: String,
212195
val accountName: String,
213196
val messagesNotificationChannelSuffix: String,
@@ -232,7 +215,6 @@ sealed class MailNotification : AppNotification(), SystemNotification {
232215
/**
233216
* Creates a [NewMailSummaryMail] notification.
234217
*
235-
* @param id The unique identifier for this notification.
236218
* @param accountUuid The UUID of the account.
237219
* @param accountDisplayName The display name of the account.
238220
* @param messagesNotificationChannelSuffix The suffix for the messages notification channel.
@@ -243,15 +225,13 @@ sealed class MailNotification : AppNotification(), SystemNotification {
243225
* @return A [NewMailSummaryMail] notification.
244226
*/
245227
suspend operator fun invoke(
246-
id: NotificationId,
247228
accountUuid: String,
248229
accountDisplayName: String,
249230
messagesNotificationChannelSuffix: String,
250231
newMessageCount: Int,
251232
additionalMessagesCount: Int,
252233
group: NotificationGroup,
253234
): NewMailSummaryMail = NewMailSummaryMail(
254-
id = id,
255235
accountUuid = accountUuid,
256236
accountName = accountDisplayName,
257237
messagesNotificationChannelSuffix = messagesNotificationChannelSuffix,

feature/notification/api/src/commonMain/kotlin/net/thunderbird/feature/notification/api/content/PushServiceNotification.kt

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.thunderbird.feature.notification.api.content
22

33
import net.thunderbird.feature.notification.api.NotificationChannel
4-
import net.thunderbird.feature.notification.api.NotificationId
54
import net.thunderbird.feature.notification.api.NotificationSeverity
65
import net.thunderbird.feature.notification.api.ui.action.NotificationAction
76
import net.thunderbird.feature.notification.resources.Res
@@ -29,7 +28,6 @@ sealed class PushServiceNotification : AppNotification(), SystemNotification {
2928
*/
3029
@ConsistentCopyVisibility
3130
data class Initializing private constructor(
32-
override val id: NotificationId,
3331
override val title: String,
3432
override val contentText: String?,
3533
override val actions: Set<NotificationAction>,
@@ -38,11 +36,9 @@ sealed class PushServiceNotification : AppNotification(), SystemNotification {
3836
/**
3937
* Creates an [Initializing] notification.
4038
*
41-
* @param id The ID of the notification.
4239
* @return An [Initializing] notification.
4340
*/
44-
suspend operator fun invoke(id: NotificationId): Initializing = Initializing(
45-
id = id,
41+
suspend operator fun invoke(): Initializing = Initializing(
4642
title = getString(resource = Res.string.push_notification_state_initializing),
4743
contentText = getString(resource = Res.string.push_notification_info),
4844
actions = buildNotificationActions(),
@@ -56,7 +52,6 @@ sealed class PushServiceNotification : AppNotification(), SystemNotification {
5652
*/
5753
@ConsistentCopyVisibility
5854
data class Listening private constructor(
59-
override val id: NotificationId,
6055
override val title: String,
6156
override val contentText: String?,
6257
override val actions: Set<NotificationAction>,
@@ -65,11 +60,9 @@ sealed class PushServiceNotification : AppNotification(), SystemNotification {
6560
/**
6661
* Creates a new [Listening] push service notification.
6762
*
68-
* @param id The ID of the notification.
6963
* @return A new [Listening] notification.
7064
*/
71-
suspend operator fun invoke(id: NotificationId): Listening = Listening(
72-
id = id,
65+
suspend operator fun invoke(): Listening = Listening(
7366
title = getString(resource = Res.string.push_notification_state_listening),
7467
contentText = getString(resource = Res.string.push_notification_info),
7568
actions = buildNotificationActions(),
@@ -83,7 +76,6 @@ sealed class PushServiceNotification : AppNotification(), SystemNotification {
8376
*/
8477
@ConsistentCopyVisibility
8578
data class WaitBackgroundSync private constructor(
86-
override val id: NotificationId,
8779
override val title: String,
8880
override val contentText: String?,
8981
override val actions: Set<NotificationAction>,
@@ -92,11 +84,9 @@ sealed class PushServiceNotification : AppNotification(), SystemNotification {
9284
/**
9385
* Creates a [WaitBackgroundSync] notification.
9486
*
95-
* @param id The ID of the notification.
9687
* @return A [WaitBackgroundSync] notification.
9788
*/
98-
suspend operator fun invoke(id: NotificationId): WaitBackgroundSync = WaitBackgroundSync(
99-
id = id,
89+
suspend operator fun invoke(): WaitBackgroundSync = WaitBackgroundSync(
10090
title = getString(resource = Res.string.push_notification_state_wait_background_sync),
10191
contentText = getString(resource = Res.string.push_notification_info),
10292
actions = buildNotificationActions(),
@@ -110,7 +100,6 @@ sealed class PushServiceNotification : AppNotification(), SystemNotification {
110100
*/
111101
@ConsistentCopyVisibility
112102
data class WaitNetwork private constructor(
113-
override val id: NotificationId,
114103
override val title: String,
115104
override val contentText: String?,
116105
override val actions: Set<NotificationAction>,
@@ -119,11 +108,9 @@ sealed class PushServiceNotification : AppNotification(), SystemNotification {
119108
/**
120109
* Creates a [WaitNetwork] notification.
121110
*
122-
* @param id The ID of the notification.
123111
* @return A [WaitNetwork] notification.
124112
*/
125-
suspend operator fun invoke(id: NotificationId): WaitNetwork = WaitNetwork(
126-
id = id,
113+
suspend operator fun invoke(): WaitNetwork = WaitNetwork(
127114
title = getString(resource = Res.string.push_notification_state_wait_network),
128115
contentText = getString(resource = Res.string.push_notification_info),
129116
actions = buildNotificationActions(),
@@ -141,7 +128,6 @@ sealed class PushServiceNotification : AppNotification(), SystemNotification {
141128
*/
142129
@ConsistentCopyVisibility
143130
data class AlarmPermissionMissing private constructor(
144-
override val id: NotificationId,
145131
override val title: String,
146132
override val contentText: String?,
147133
) : PushServiceNotification(), InAppNotification {
@@ -151,11 +137,9 @@ sealed class PushServiceNotification : AppNotification(), SystemNotification {
151137
/**
152138
* Creates an [AlarmPermissionMissing] notification.
153139
*
154-
* @param id The ID of the notification.
155140
* @return An [AlarmPermissionMissing] instance.
156141
*/
157-
suspend operator fun invoke(id: NotificationId): AlarmPermissionMissing = AlarmPermissionMissing(
158-
id = id,
142+
suspend operator fun invoke(): AlarmPermissionMissing = AlarmPermissionMissing(
159143
title = getString(resource = Res.string.push_notification_state_alarm_permission_missing),
160144
contentText = getString(resource = Res.string.push_notification_grant_alarm_permission),
161145
)

0 commit comments

Comments
 (0)