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
6 changes: 6 additions & 0 deletions feature/notification/api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.internal.config.LanguageFeature

plugins {
id(ThunderbirdPlugins.Library.kmpCompose)
}
Expand All @@ -9,6 +11,10 @@ kotlin {
implementation(projects.core.outcome)
}
}

sourceSets.all {
languageSettings.enableLanguageFeature(LanguageFeature.ExpectActualClasses.name)
}
}

android {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package net.thunderbird.feature.notification.api.ui.icon

import net.thunderbird.feature.notification.api.R
import net.thunderbird.feature.notification.api.ui.icon.atom.Notification
import net.thunderbird.feature.notification.api.ui.icon.atom.Warning

internal actual val NotificationIcons.AuthenticationError: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_warning,
inAppNotificationIcon = Warning,
)

internal actual val NotificationIcons.CertificateError: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_warning,
inAppNotificationIcon = Warning,
)

internal actual val NotificationIcons.FailedToCreate: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_warning,
inAppNotificationIcon = Warning,
)

internal actual val NotificationIcons.MailFetching: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_sync_animated,
)

internal actual val NotificationIcons.MailSending: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_sync_animated,
)

internal actual val NotificationIcons.MailSendFailed: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_warning,
inAppNotificationIcon = Warning,
)

internal actual val NotificationIcons.NewMailSingleMail: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_new_email,
)

internal actual val NotificationIcons.NewMailSummaryMail: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_new_email,
)

internal actual val NotificationIcons.PushServiceInitializing: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_notification,
)

internal actual val NotificationIcons.PushServiceListening: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_notification,
)

internal actual val NotificationIcons.PushServiceWaitBackgroundSync: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_notification,
)

internal actual val NotificationIcons.PushServiceWaitNetwork: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_notification,
)

internal actual val NotificationIcons.AlarmPermissionMissing: NotificationIcon
get() = NotificationIcon(
systemNotificationIcon = R.drawable.ic_notification,
inAppNotificationIcon = Notification,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package net.thunderbird.feature.notification.api.ui.icon

actual typealias SystemNotificationIcon = Int
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
>
<path
android:fillColor="@android:color/white"
android:pathData="M480,720L640,560L584,504L520,568L520,400L440,400L440,568L376,504L320,560L480,720ZM200,320L200,760Q200,760 200,760Q200,760 200,760L760,760Q760,760 760,760Q760,760 760,760L760,320L200,320ZM200,840Q167,840 143.5,816.5Q120,793 120,760L120,261Q120,247 124.5,234Q129,221 138,210L188,149Q199,135 215.5,127.5Q232,120 250,120L710,120Q728,120 744.5,127.5Q761,135 772,149L822,210Q831,221 835.5,234Q840,247 840,261L840,760Q840,793 816.5,816.5Q793,840 760,840L200,840ZM216,240L744,240L710,200Q710,200 710,200Q710,200 710,200L250,200Q250,200 250,200Q250,200 250,200L216,240ZM480,540L480,540L480,540Q480,540 480,540Q480,540 480,540L480,540Q480,540 480,540Q480,540 480,540L480,540Z"
/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
>
<path
android:fillColor="@android:color/white"
android:pathData="M280,840Q247,840 223.5,816.5Q200,793 200,760L200,240L160,240L160,160L360,160L360,120L600,120L600,160L800,160L800,240L760,240L760,760Q760,793 736.5,816.5Q713,840 680,840L280,840ZM680,240L280,240L280,760Q280,760 280,760Q280,760 280,760L680,760Q680,760 680,760Q680,760 680,760L680,240ZM360,680L440,680L440,320L360,320L360,680ZM520,680L600,680L600,320L520,320L520,680ZM280,240L280,240L280,760Q280,760 280,760Q280,760 280,760L280,760Q280,760 280,760Q280,760 280,760L280,240Z"
/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
>
<path
android:fillColor="@android:color/white"
android:pathData="M638,880L468,710L524,654L638,768L864,542L920,598L638,880ZM480,440L800,240L160,240L480,440ZM480,520L160,320L160,720Q160,720 160,720Q160,720 160,720L366,720L446,800L160,800Q127,800 103.5,776.5Q80,753 80,720L80,240Q80,207 103.5,183.5Q127,160 160,160L800,160Q833,160 856.5,183.5Q880,207 880,240L880,414L800,494L800,320L480,520ZM480,520L480,520L480,520L480,520L480,520L480,520L480,520L480,520L480,520Q480,520 480,520Q480,520 480,520L480,520ZM480,440L480,440L480,440L480,440ZM480,520L480,520L480,520L480,520L480,520L480,520L480,520Z"
/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
>
<path
android:fillColor="@android:color/white"
android:pathData="M160,800Q127,800 103.5,776.5Q80,753 80,720L80,240Q80,207 103.5,183.5Q127,160 160,160L564,160Q560,180 560,200Q560,220 564,240L160,240L480,440L626,349Q640,362 656.5,371.5Q673,381 691,388L480,520L160,320L160,720Q160,720 160,720Q160,720 160,720L800,720Q800,720 800,720Q800,720 800,720L800,396Q823,391 843,382Q863,373 880,360L880,720Q880,753 856.5,776.5Q833,800 800,800L160,800ZM160,240L160,240L160,240L160,720Q160,720 160,720Q160,720 160,720L160,720Q160,720 160,720Q160,720 160,720L160,240Q160,240 160,240Q160,240 160,240Q160,240 160,240Q160,240 160,240ZM760,320Q710,320 675,285Q640,250 640,200Q640,150 675,115Q710,80 760,80Q810,80 845,115Q880,150 880,200Q880,250 845,285Q810,320 760,320Z"
/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,3.5C8.953,3.5 6.5,5.953 6.5,9V12V13.5C5.392,13.5 4.5,14.392 4.5,15.5V17C4.5,17.277 4.723,17.5 5,17.5H6.5H7H17H17.5H19C19.277,17.5 19.5,17.277 19.5,17V15.5C19.5,14.392 18.608,13.5 17.5,13.5V10.5V9C17.5,5.953 15.047,3.5 12,3.5Z"
android:strokeAlpha="0.2"
android:fillColor="#1A202C"
android:fillAlpha="0.2"/>
<path
android:pathData="M12,3C8.685,3 6,5.685 6,9V12V13.207C4.895,13.465 4,14.318 4,15.5V17C4,17.545 4.455,18 5,18H6.5H7H9C9,19.653 10.347,21 12,21C13.653,21 15,19.653 15,18H17H17.5H19C19.545,18 20,17.545 20,17V15.5C20,14.318 19.105,13.465 18,13.207V10.5V9C18,5.685 15.315,3 12,3ZM12,4C14.779,4 17,6.221 17,9V10.5V13.5C17,13.633 17.053,13.76 17.146,13.854C17.24,13.947 17.367,14 17.5,14C18.34,14 19,14.66 19,15.5V17H17.5H17H14.5H9.5H7H6.5H5V15.5C5,14.66 5.66,14 6.5,14C6.633,14 6.76,13.947 6.854,13.854C6.947,13.76 7,13.633 7,13.5V12V9C7,6.221 9.221,4 12,4ZM10,18H14C14,19.117 13.117,20 12,20C10.883,20 10,19.117 10,18Z"
android:fillColor="#1A202C"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
>
<path
android:fillColor="@android:color/white"
android:pathData="M480,800Q346,800 253,707Q160,614 160,480Q160,346 253,253Q346,160 480,160Q549,160 612,188.5Q675,217 720,270L720,160L800,160L800,440L520,440L520,360L688,360Q656,304 600.5,272Q545,240 480,240Q380,240 310,310Q240,380 240,480Q240,580 310,650Q380,720 480,720Q557,720 619,676Q681,632 706,560L790,560Q762,666 676,733Q590,800 480,800Z"
/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true"
>
<path
android:fillColor="@android:color/white"
android:pathData="M760,760L760,600Q760,550 725,515Q690,480 640,480L273,480L417,624L360,680L120,440L360,200L417,256L273,400L640,400Q723,400 781.5,458.5Q840,517 840,600L840,760L760,760Z"
/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
>
<path
android:fillColor="@android:color/white"
android:pathData="M480,680Q497,680 508.5,668.5Q520,657 520,640Q520,623 508.5,611.5Q497,600 480,600Q463,600 451.5,611.5Q440,623 440,640Q440,657 451.5,668.5Q463,680 480,680ZM440,520L520,520L520,280L440,280L440,520ZM330,840L120,630L120,330L330,120L630,120L840,330L840,630L630,840L330,840ZM364,760L596,760L760,596L760,364L596,200L364,200L200,364L200,596L364,760ZM480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480Z"
/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
>
<path
android:fillColor="@android:color/white"
android:pathData="M370,880L354,752Q341,747 329.5,740Q318,733 307,725L188,775L78,585L181,507Q180,500 180,493.5Q180,487 180,480Q180,473 180,466.5Q180,460 181,453L78,375L188,185L307,235Q318,227 330,220Q342,213 354,208L370,80L590,80L606,208Q619,213 630.5,220Q642,227 653,235L772,185L882,375L779,453Q780,460 780,466.5Q780,473 780,480Q780,487 780,493.5Q780,500 778,507L881,585L771,775L653,725Q642,733 630,740Q618,747 606,752L590,880L370,880ZM440,800L519,800L533,694Q564,686 590.5,670.5Q617,655 639,633L738,674L777,606L691,541Q696,527 698,511.5Q700,496 700,480Q700,464 698,448.5Q696,433 691,419L777,354L738,286L639,328Q617,305 590.5,289.5Q564,274 533,266L520,160L441,160L427,266Q396,274 369.5,289.5Q343,305 321,327L222,286L183,354L269,418Q264,433 262,448Q260,463 260,480Q260,496 262,511Q264,526 269,541L183,606L222,674L321,632Q343,655 369.5,670.5Q396,686 427,694L440,800ZM482,620Q540,620 581,579Q622,538 622,480Q622,422 581,381Q540,340 482,340Q423,340 382.5,381Q342,422 342,480Q342,538 382.5,579Q423,620 482,620ZM480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480Z"
/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false"
>

<item
android:drawable="@drawable/notification_icon_check_mail_anim_0"
android:duration="100"
/>
<item
android:drawable="@drawable/notification_icon_check_mail_anim_1"
android:duration="100"
/>
<item
android:drawable="@drawable/notification_icon_check_mail_anim_2"
android:duration="100"
/>
<item
android:drawable="@drawable/notification_icon_check_mail_anim_3"
android:duration="100"
/>
<item
android:drawable="@drawable/notification_icon_check_mail_anim_4"
android:duration="100"
/>
<item
android:drawable="@drawable/notification_icon_check_mail_anim_5"
android:duration="100"
/>

</animation-list>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
>
<path
android:fillColor="@android:color/white"
android:pathData="M40,840L480,80L920,840L40,840ZM178,760L782,760L480,240L178,760ZM480,720Q497,720 508.5,708.5Q520,697 520,680Q520,663 508.5,651.5Q497,640 480,640Q463,640 451.5,651.5Q440,663 440,680Q440,697 451.5,708.5Q463,720 480,720ZM440,600L520,600L520,400L440,400L440,600ZM480,500L480,500L480,500L480,500Z"
/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import net.thunderbird.feature.notification.api.NotificationGroup
import net.thunderbird.feature.notification.api.NotificationId
import net.thunderbird.feature.notification.api.NotificationSeverity
import net.thunderbird.feature.notification.api.ui.action.NotificationAction
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcon

/**
* Represents a notification that can be displayed to the user.
Expand All @@ -28,6 +29,7 @@ import net.thunderbird.feature.notification.api.ui.action.NotificationAction
* @property authenticationRequired Indicates whether authentication is required to view the notification.
* @property channel The notification channel to which this notification belongs.
* @property group The notification group to which this notification belongs, can be null.
* @property icon The notification icon.
* @see AppNotification
*/
sealed interface Notification {
Expand All @@ -41,6 +43,7 @@ sealed interface Notification {
val authenticationRequired: Boolean
val channel: NotificationChannel
val group: NotificationGroup?
val icon: NotificationIcon
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import net.thunderbird.feature.notification.api.NotificationChannel
import net.thunderbird.feature.notification.api.NotificationId
import net.thunderbird.feature.notification.api.NotificationSeverity
import net.thunderbird.feature.notification.api.ui.action.NotificationAction
import net.thunderbird.feature.notification.api.ui.icon.AuthenticationError
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcon
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcons
import net.thunderbird.feature.notification.resources.api.Res
import net.thunderbird.feature.notification.resources.api.notification_authentication_error_text
import net.thunderbird.feature.notification.resources.api.notification_authentication_error_title
Expand All @@ -20,6 +23,7 @@ data class AuthenticationErrorNotification private constructor(
override val title: String,
override val contentText: String?,
override val channel: NotificationChannel,
override val icon: NotificationIcon = NotificationIcons.AuthenticationError,
) : AppNotification(), SystemNotification, InAppNotification {
override val severity: NotificationSeverity = NotificationSeverity.Fatal
override val actions: Set<NotificationAction> = setOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import net.thunderbird.feature.notification.api.NotificationChannel
import net.thunderbird.feature.notification.api.NotificationId
import net.thunderbird.feature.notification.api.NotificationSeverity
import net.thunderbird.feature.notification.api.ui.action.NotificationAction
import net.thunderbird.feature.notification.api.ui.icon.CertificateError
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcon
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcons
import net.thunderbird.feature.notification.resources.api.Res
import net.thunderbird.feature.notification.resources.api.notification_certificate_error_public
import net.thunderbird.feature.notification.resources.api.notification_certificate_error_text
Expand All @@ -22,6 +25,7 @@ data class CertificateErrorNotification private constructor(
override val contentText: String,
val lockScreenTitle: String,
override val channel: NotificationChannel,
override val icon: NotificationIcon = NotificationIcons.CertificateError,
) : AppNotification(), SystemNotification, InAppNotification {
override val severity: NotificationSeverity = NotificationSeverity.Fatal
override val actions: Set<NotificationAction> = setOf(NotificationAction.UpdateServerSettings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package net.thunderbird.feature.notification.api.content
import net.thunderbird.feature.notification.api.NotificationChannel
import net.thunderbird.feature.notification.api.NotificationId
import net.thunderbird.feature.notification.api.NotificationSeverity
import net.thunderbird.feature.notification.api.ui.icon.FailedToCreate
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcon
import net.thunderbird.feature.notification.api.ui.icon.NotificationIcons
import net.thunderbird.feature.notification.resources.api.Res
import net.thunderbird.feature.notification.resources.api.notification_notify_error_text
import net.thunderbird.feature.notification.resources.api.notification_notify_error_title
Expand All @@ -21,6 +24,7 @@ data class FailedToCreateNotification private constructor(
override val contentText: String?,
override val channel: NotificationChannel,
val failedNotification: AppNotification,
override val icon: NotificationIcon = NotificationIcons.FailedToCreate,
) : AppNotification(), SystemNotification, InAppNotification {
override val severity: NotificationSeverity = NotificationSeverity.Critical

Expand Down
Loading