Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 3814850c authored by Rafael Tonholo's avatar Rafael Tonholo Committed by GitHub
Browse files

Merge pull request #10025 from...

Merge pull request #10025 from rafaeltonholo/feat/9989/display-account-visual-in-app-error-indication

feat(in-app-notifications): add account error indication
parents 9688eb87 21fb582a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -144,4 +144,6 @@ object Icons {
        val VisibilityOff: ImageVector
            get() = MaterialIcons.Filled.VisibilityOff
    }

    object DualTone
}
+220 −0
Original line number Diff line number Diff line
package net.thunderbird.core.ui.compose.designsystem.atom.icon.dualtone

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icon
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icons

@Suppress("MagicNumber", "UnusedReceiverParameter")
val Icons.DualTone.Warning: ImageVector
    get() {
        val current = _warningDualTone
        if (current != null) return current

        return ImageVector.Builder(
            name = "app.k9mail.core.ui.compose.theme2.MainTheme.WarningDualTone",
            defaultWidth = 24.0.dp,
            defaultHeight = 24.0.dp,
            viewportWidth = 24.0f,
            viewportHeight = 24.0f,
        ).apply {
            path(
                fill = SolidColor(Color(0xFF4C4D58)),
                fillAlpha = 0.2f,
                strokeAlpha = 0.2f,
            ) {
                moveTo(x = 20.2f, y = 20.25f)
                horizontalLineTo(x = 3.8f)
                arcToRelative(
                    a = 1.5f,
                    b = 1.5f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = true,
                    dx1 = -1.35f,
                    dy1 = -2.24f,
                )
                lineToRelative(dx = 8.2f, dy = -14.24f)
                arcToRelative(
                    a = 1.57f,
                    b = 1.57f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = true,
                    dx1 = 2.7f,
                    dy1 = 0.0f,
                )
                lineToRelative(dx = 8.2f, dy = 14.24f)
                arcToRelative(
                    a = 1.5f,
                    b = 1.5f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = true,
                    dx1 = -1.35f,
                    dy1 = 2.24f,
                )
            }
            path(
                fill = SolidColor(Color(0xFF4C4D58)),
            ) {
                moveTo(x = 22.2f, y = 17.63f)
                lineTo(x = 14.0f, y = 3.4f)
                arcToRelative(
                    a = 2.32f,
                    b = 2.32f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = false,
                    dx1 = -4.0f,
                    dy1 = 0.0f,
                )
                lineTo(x = 1.8f, y = 17.63f)
                arcToRelative(
                    a = 2.2f,
                    b = 2.2f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = false,
                    dx1 = 0.0f,
                    dy1 = 2.23f,
                )
                arcToRelative(
                    a = 2.3f,
                    b = 2.3f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = false,
                    dx1 = 2.0f,
                    dy1 = 1.14f,
                )
                horizontalLineToRelative(dx = 16.4f)
                arcToRelative(
                    a = 2.3f,
                    b = 2.3f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = false,
                    dx1 = 2.3f,
                    dy1 = -2.25f,
                )
                arcToRelative(
                    a = 2.0f,
                    b = 2.0f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = false,
                    dx1 = -0.3f,
                    dy1 = -1.12f,
                )
                moveToRelative(dx = -1.3f, dy = 1.48f)
                arcToRelative(
                    a = 0.8f,
                    b = 0.8f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = true,
                    dx1 = -0.7f,
                    dy1 = 0.39f,
                )
                horizontalLineTo(x = 3.8f)
                arcToRelative(
                    a = 0.8f,
                    b = 0.8f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = true,
                    dx1 = -0.7f,
                    dy1 = -0.4f,
                )
                arcToRelative(
                    a = 0.7f,
                    b = 0.7f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = true,
                    dx1 = 0.0f,
                    dy1 = -0.72f,
                )
                lineToRelative(dx = 8.2f, dy = -14.24f)
                arcToRelative(
                    a = 0.82f,
                    b = 0.82f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = true,
                    dx1 = 1.4f,
                    dy1 = 0.0f,
                )
                lineToRelative(dx = 8.2f, dy = 14.24f)
                arcToRelative(
                    a = 0.7f,
                    b = 0.7f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = true,
                    dx1 = 0.0f,
                    dy1 = 0.73f,
                )
                moveToRelative(dx = -9.65f, dy = -5.61f)
                verticalLineTo(y = 9.75f)
                arcToRelative(
                    a = 0.75f,
                    b = 0.75f,
                    theta = 0.0f,
                    isMoreThanHalf = true,
                    isPositiveArc = true,
                    dx1 = 1.5f,
                    dy1 = 0.0f,
                )
                verticalLineToRelative(dy = 3.75f)
                arcToRelative(
                    a = 0.75f,
                    b = 0.75f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = true,
                    dx1 = -1.5f,
                    dy1 = 0.0f,
                )
                moveToRelative(dx = 1.88f, dy = 3.38f)
                arcToRelative(
                    a = 1.13f,
                    b = 1.13f,
                    theta = 0.0f,
                    isMoreThanHalf = true,
                    isPositiveArc = true,
                    dx1 = -2.26f,
                    dy1 = 0.0f,
                )
                arcToRelative(
                    a = 1.13f,
                    b = 1.13f,
                    theta = 0.0f,
                    isMoreThanHalf = false,
                    isPositiveArc = true,
                    dx1 = 2.26f,
                    dy1 = 0.0f,
                )
            }
        }.build().also { _warningDualTone = it }
    }

@Suppress("ObjectPropertyName")
private var _warningDualTone: ImageVector? = null

@Preview(showBackground = true)
@Composable
private fun Preview() {
    Column {
        Image(imageVector = Icons.DualTone.Warning, contentDescription = null)
        Icon(imageVector = Icons.DualTone.Warning, contentDescription = null, tint = Color.Red)
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ dependencies {
    implementation(projects.feature.account.avatar.impl)
    implementation(projects.feature.mail.account.api)
    implementation(projects.feature.mail.folder.api)
    implementation(projects.feature.notification.api)

    implementation(projects.feature.search.implLegacy)
    implementation(projects.legacy.mailstore)
+5 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ internal object FakeData {
    val UNIFIED_DISPLAY_ACCOUNT = UnifiedDisplayAccount(
        unreadMessageCount = 224,
        starredMessageCount = 42,
        hasError = false,
    )

    val MAIL_DISPLAY_ACCOUNT = MailDisplayAccount(
@@ -51,6 +52,7 @@ internal object FakeData {
        color = Color.Red.toArgb(),
        unreadMessageCount = 0,
        starredMessageCount = 0,
        hasError = false,
    )

    val FOLDER = Folder(
@@ -156,6 +158,7 @@ internal object FakeData {
                color = Color.Green.toArgb(),
                unreadMessageCount = 2,
                starredMessageCount = 0,
                hasError = false,
            ),
            MailDisplayAccount(
                id = "account2",
@@ -164,6 +167,7 @@ internal object FakeData {
                color = Color.Red.toArgb(),
                unreadMessageCount = 12,
                starredMessageCount = 0,
                hasError = false,
            ),
            MailDisplayAccount(
                id = "account3",
@@ -172,6 +176,7 @@ internal object FakeData {
                color = Color.Cyan.toArgb(),
                unreadMessageCount = 0,
                starredMessageCount = 0,
                hasError = false,
            ),
        )
    }
+26 −0
Original line number Diff line number Diff line
@@ -30,3 +30,29 @@ internal fun AccountListItemSelectedPreview() {
        )
    }
}

@Composable
@Preview(showBackground = true)
internal fun AccountListItemWithErrorPreview() {
    PreviewWithThemes {
        AccountListItem(
            account = MAIL_DISPLAY_ACCOUNT.copy(hasError = true),
            onClick = { },
            selected = false,
            showStarredCount = false,
        )
    }
}

@Composable
@Preview(showBackground = true)
internal fun AccountListItemSelectedWithErrorPreview() {
    PreviewWithThemes {
        AccountListItem(
            account = MAIL_DISPLAY_ACCOUNT.copy(hasError = true),
            onClick = { },
            selected = true,
            showStarredCount = false,
        )
    }
}
Loading