From d2c520d30634e045ff9d53b82324b4262a35eaac Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sun, 29 Jan 2023 17:45:46 +0100 Subject: [PATCH] Add code code to the notifications icons --- .../Notifications/NotificationRowView.swift | 2 +- .../Notifications/NotificationTypeExt.swift | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Packages/Notifications/Sources/Notifications/NotificationRowView.swift b/Packages/Notifications/Sources/Notifications/NotificationRowView.swift index 429177a9..44c8b957 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationRowView.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationRowView.swift @@ -53,7 +53,7 @@ struct NotificationRowView: View { ZStack(alignment: .center) { Circle() .strokeBorder(Color.white, lineWidth: 1) - .background(Circle().foregroundColor(theme.tintColor)) + .background(Circle().foregroundColor(type.tintColor())) .frame(width: 24, height: 24) Image(systemName: type.iconName()) diff --git a/Packages/Notifications/Sources/Notifications/NotificationTypeExt.swift b/Packages/Notifications/Sources/Notifications/NotificationTypeExt.swift index a40a7209..49dacb36 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationTypeExt.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationTypeExt.swift @@ -1,5 +1,6 @@ import Models import SwiftUI +import DesignSystem extension Models.Notification.NotificationType { func label(count: Int) -> LocalizedStringKey { @@ -41,6 +42,19 @@ extension Models.Notification.NotificationType { return "pencil.line" } } + + func tintColor() -> Color { + switch self { + case .status, .mention, .update, .poll: + return Theme.shared.tintColor.opacity(0.80) + case .reblog: + return Color.teal.opacity(0.80) + case .follow, .follow_request: + return Color.cyan.opacity(0.80) + case .favourite: + return Color.yellow.opacity(0.80) + } + } func menuTitle() -> LocalizedStringKey { switch self {