Skip to content

Commit c14fb5d

Browse files
Merge pull request #9518 from rafaeltonholo/feat/9312/add-notification-testing-module
chore(notification): add `:feature:notification:testing` module
2 parents 60372f9 + d5049ec commit c14fb5d

File tree

11 files changed

+111
-3
lines changed

11 files changed

+111
-3
lines changed

feature/notification/api/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ kotlin {
1010
implementation(projects.core.common)
1111
implementation(projects.core.outcome)
1212
}
13+
commonTest.dependencies {
14+
implementation(projects.feature.notification.testing)
15+
}
1316
}
1417

1518
sourceSets.all {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ sealed interface Notification {
4949
* @property actions A set of actions that can be performed on the notification. Defaults to an empty set.
5050
* @see Notification
5151
*/
52-
sealed class AppNotification : Notification {
52+
abstract class AppNotification : Notification {
5353
override val accessibilityText: String = title
5454

5555
@OptIn(ExperimentalTime::class)
@@ -70,7 +70,7 @@ sealed class AppNotification : Notification {
7070
* @see SystemNotificationStyle
7171
* @see net.thunderbird.feature.notification.api.ui.style.systemNotificationStyle
7272
*/
73-
sealed interface SystemNotification : Notification {
73+
interface SystemNotification : Notification {
7474
val subText: String? get() = null
7575
val channel: NotificationChannel
7676
val group: NotificationGroup? get() = null
@@ -112,6 +112,6 @@ sealed interface SystemNotification : Notification {
112112
* @see InAppNotificationStyle
113113
* @see net.thunderbird.feature.notification.api.ui.style.inAppNotificationStyle
114114
*/
115-
sealed interface InAppNotification : Notification {
115+
interface InAppNotification : Notification {
116116
val inAppNotificationStyle: InAppNotificationStyle get() = InAppNotificationStyle.Undefined
117117
}

feature/notification/impl/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ kotlin {
1212
}
1313
commonTest.dependencies {
1414
implementation(projects.core.logging.testing)
15+
implementation(projects.feature.notification.testing)
1516
}
1617
androidUnitTest.dependencies {
1718
implementation(libs.androidx.test.core)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
plugins {
2+
id(ThunderbirdPlugins.Library.kmpCompose)
3+
}
4+
5+
android {
6+
namespace = "net.thunderbird.feature.notification.testing"
7+
}
8+
9+
kotlin {
10+
sourceSets {
11+
commonMain.dependencies {
12+
api(projects.feature.notification.api)
13+
}
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package net.thunderbird.feature.notification.testing.fake.icon
2+
3+
import net.thunderbird.feature.notification.api.ui.icon.SystemNotificationIcon
4+
5+
internal actual val EMPTY_SYSTEM_NOTIFICATION_ICON: SystemNotificationIcon = 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package net.thunderbird.feature.notification.testing.fake
2+
3+
import androidx.compose.ui.graphics.vector.ImageVector
4+
import androidx.compose.ui.unit.dp
5+
import net.thunderbird.feature.notification.api.NotificationSeverity
6+
import net.thunderbird.feature.notification.api.content.AppNotification
7+
import net.thunderbird.feature.notification.api.content.InAppNotification
8+
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcon
9+
10+
data class FakeInAppOnlyNotification(
11+
override val title: String = "fake title",
12+
override val contentText: String? = "fake content",
13+
override val severity: NotificationSeverity = NotificationSeverity.Information,
14+
override val icon: NotificationIcon = NotificationIcon(
15+
inAppNotificationIcon = ImageVector.Builder(
16+
defaultWidth = 0.dp,
17+
defaultHeight = 0.dp,
18+
viewportWidth = 0f,
19+
viewportHeight = 0f,
20+
).build(),
21+
),
22+
) : AppNotification(), InAppNotification
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package net.thunderbird.feature.notification.testing.fake
2+
3+
import androidx.compose.ui.graphics.vector.ImageVector
4+
import androidx.compose.ui.unit.dp
5+
import net.thunderbird.feature.notification.api.NotificationChannel
6+
import net.thunderbird.feature.notification.api.NotificationSeverity
7+
import net.thunderbird.feature.notification.api.content.AppNotification
8+
import net.thunderbird.feature.notification.api.content.InAppNotification
9+
import net.thunderbird.feature.notification.api.content.SystemNotification
10+
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcon
11+
import net.thunderbird.feature.notification.testing.fake.icon.EMPTY_SYSTEM_NOTIFICATION_ICON
12+
13+
data class FakeNotification(
14+
override val title: String = "fake title",
15+
override val contentText: String? = "fake content",
16+
override val severity: NotificationSeverity = NotificationSeverity.Information,
17+
override val icon: NotificationIcon = NotificationIcon(
18+
systemNotificationIcon = EMPTY_SYSTEM_NOTIFICATION_ICON,
19+
inAppNotificationIcon = ImageVector.Builder(
20+
defaultWidth = 0.dp,
21+
defaultHeight = 0.dp,
22+
viewportWidth = 0f,
23+
viewportHeight = 0f,
24+
).build(),
25+
),
26+
override val channel: NotificationChannel = NotificationChannel.Messages(
27+
accountUuid = "",
28+
suffix = "",
29+
),
30+
) : AppNotification(), SystemNotification, InAppNotification
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package net.thunderbird.feature.notification.testing.fake
2+
3+
import net.thunderbird.feature.notification.api.NotificationChannel
4+
import net.thunderbird.feature.notification.api.NotificationSeverity
5+
import net.thunderbird.feature.notification.api.content.AppNotification
6+
import net.thunderbird.feature.notification.api.content.SystemNotification
7+
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcon
8+
import net.thunderbird.feature.notification.testing.fake.icon.EMPTY_SYSTEM_NOTIFICATION_ICON
9+
10+
data class FakeSystemOnlyNotification(
11+
override val title: String = "fake title",
12+
override val contentText: String? = "fake content",
13+
override val severity: NotificationSeverity = NotificationSeverity.Information,
14+
override val icon: NotificationIcon = NotificationIcon(
15+
systemNotificationIcon = EMPTY_SYSTEM_NOTIFICATION_ICON,
16+
),
17+
override val channel: NotificationChannel = NotificationChannel.Messages(
18+
accountUuid = "",
19+
suffix = "",
20+
),
21+
) : AppNotification(), SystemNotification
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package net.thunderbird.feature.notification.testing.fake.icon
2+
3+
import net.thunderbird.feature.notification.api.ui.icon.SystemNotificationIcon
4+
5+
internal expect val EMPTY_SYSTEM_NOTIFICATION_ICON: SystemNotificationIcon
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package net.thunderbird.feature.notification.testing.fake.icon
2+
3+
import net.thunderbird.feature.notification.api.ui.icon.SystemNotificationIcon
4+
5+
internal actual val EMPTY_SYSTEM_NOTIFICATION_ICON: SystemNotificationIcon = 0

0 commit comments

Comments
 (0)