Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions feature/notification/api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ kotlin {
implementation(projects.core.common)
implementation(projects.core.outcome)
}
commonTest.dependencies {
implementation(projects.feature.notification.testing)
}
}

sourceSets.all {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sealed interface Notification {
* @property actions A set of actions that can be performed on the notification. Defaults to an empty set.
* @see Notification
*/
sealed class AppNotification : Notification {
abstract class AppNotification : Notification {
override val accessibilityText: String = title

@OptIn(ExperimentalTime::class)
Expand All @@ -70,7 +70,7 @@ sealed class AppNotification : Notification {
* @see SystemNotificationStyle
* @see net.thunderbird.feature.notification.api.ui.style.systemNotificationStyle
*/
sealed interface SystemNotification : Notification {
interface SystemNotification : Notification {
val subText: String? get() = null
val channel: NotificationChannel
val group: NotificationGroup? get() = null
Expand Down Expand Up @@ -112,6 +112,6 @@ sealed interface SystemNotification : Notification {
* @see InAppNotificationStyle
* @see net.thunderbird.feature.notification.api.ui.style.inAppNotificationStyle
*/
sealed interface InAppNotification : Notification {
interface InAppNotification : Notification {
val inAppNotificationStyle: InAppNotificationStyle get() = InAppNotificationStyle.Undefined
}
1 change: 1 addition & 0 deletions feature/notification/impl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ kotlin {
}
commonTest.dependencies {
implementation(projects.core.logging.testing)
implementation(projects.feature.notification.testing)
}
androidUnitTest.dependencies {
implementation(libs.androidx.test.core)
Expand Down
15 changes: 15 additions & 0 deletions feature/notification/testing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
plugins {
id(ThunderbirdPlugins.Library.kmpCompose)
}

android {
namespace = "net.thunderbird.feature.notification.testing"
}

kotlin {
sourceSets {
commonMain.dependencies {
api(projects.feature.notification.api)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package net.thunderbird.feature.notification.testing.fake.icon

import net.thunderbird.feature.notification.api.ui.icon.SystemNotificationIcon

internal actual val EMPTY_SYSTEM_NOTIFICATION_ICON: SystemNotificationIcon = 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package net.thunderbird.feature.notification.testing.fake

import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import net.thunderbird.feature.notification.api.NotificationSeverity
import net.thunderbird.feature.notification.api.content.AppNotification
import net.thunderbird.feature.notification.api.content.InAppNotification
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcon

data class FakeInAppOnlyNotification(
override val title: String = "fake title",
override val contentText: String? = "fake content",
override val severity: NotificationSeverity = NotificationSeverity.Information,
override val icon: NotificationIcon = NotificationIcon(
inAppNotificationIcon = ImageVector.Builder(
defaultWidth = 0.dp,
defaultHeight = 0.dp,
viewportWidth = 0f,
viewportHeight = 0f,
).build(),
),
) : AppNotification(), InAppNotification
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.thunderbird.feature.notification.testing.fake

import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import net.thunderbird.feature.notification.api.NotificationChannel
import net.thunderbird.feature.notification.api.NotificationSeverity
import net.thunderbird.feature.notification.api.content.AppNotification
import net.thunderbird.feature.notification.api.content.InAppNotification
import net.thunderbird.feature.notification.api.content.SystemNotification
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcon
import net.thunderbird.feature.notification.testing.fake.icon.EMPTY_SYSTEM_NOTIFICATION_ICON

data class FakeNotification(
override val title: String = "fake title",
override val contentText: String? = "fake content",
override val severity: NotificationSeverity = NotificationSeverity.Information,
override val icon: NotificationIcon = NotificationIcon(
systemNotificationIcon = EMPTY_SYSTEM_NOTIFICATION_ICON,
inAppNotificationIcon = ImageVector.Builder(
defaultWidth = 0.dp,
defaultHeight = 0.dp,
viewportWidth = 0f,
viewportHeight = 0f,
).build(),
),
override val channel: NotificationChannel = NotificationChannel.Messages(
accountUuid = "",
suffix = "",
),
) : AppNotification(), SystemNotification, InAppNotification
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.thunderbird.feature.notification.testing.fake

import net.thunderbird.feature.notification.api.NotificationChannel
import net.thunderbird.feature.notification.api.NotificationSeverity
import net.thunderbird.feature.notification.api.content.AppNotification
import net.thunderbird.feature.notification.api.content.SystemNotification
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcon
import net.thunderbird.feature.notification.testing.fake.icon.EMPTY_SYSTEM_NOTIFICATION_ICON

data class FakeSystemOnlyNotification(
override val title: String = "fake title",
override val contentText: String? = "fake content",
override val severity: NotificationSeverity = NotificationSeverity.Information,
override val icon: NotificationIcon = NotificationIcon(
systemNotificationIcon = EMPTY_SYSTEM_NOTIFICATION_ICON,
),
override val channel: NotificationChannel = NotificationChannel.Messages(
accountUuid = "",
suffix = "",
),
) : AppNotification(), SystemNotification
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package net.thunderbird.feature.notification.testing.fake.icon

import net.thunderbird.feature.notification.api.ui.icon.SystemNotificationIcon

internal expect val EMPTY_SYSTEM_NOTIFICATION_ICON: SystemNotificationIcon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package net.thunderbird.feature.notification.testing.fake.icon

import net.thunderbird.feature.notification.api.ui.icon.SystemNotificationIcon

internal actual val EMPTY_SYSTEM_NOTIFICATION_ICON: SystemNotificationIcon = 0
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ include(
include(
":feature:notification:api",
":feature:notification:impl",
":feature:notification:testing",
)

include(
Expand Down