diff --git a/IceCubesApp/Resources/Localization/Localizable.xcstrings b/IceCubesApp/Resources/Localization/Localizable.xcstrings index 771807d5..afcafa83 100644 --- a/IceCubesApp/Resources/Localization/Localizable.xcstrings +++ b/IceCubesApp/Resources/Localization/Localizable.xcstrings @@ -3097,7 +3097,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "包含动画的 GIF" + "value" : "动画 GIF" } }, "zh-Hant" : { @@ -8570,7 +8570,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "滚动时间线。" + "value" : "滑动时间线。" } }, "zh-Hant" : { @@ -8969,7 +8969,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "Account" + "value" : "账户" } } } @@ -13503,6 +13503,12 @@ "state" : "translated", "value" : "Supprimer l'avatar" } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "删除头像" + } } } }, @@ -13733,7 +13739,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "保存个人资料时出错, 请重试。" + "value" : "保存个人资料时出错,请重试。" } }, "zh-Hant" : { @@ -13971,7 +13977,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "编辑横幅图片" + "value" : "编辑横幅" } }, "zh-Hant" : { @@ -14002,6 +14008,12 @@ "state" : "translated", "value" : "Supprimer la bannière" } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "删除横幅" + } } } }, @@ -16720,13 +16732,13 @@ "one" : { "stringUnit" : { "state" : "translated", - "value" : "%2$@粉丝" + "value" : "%2$@ 粉丝" } }, "other" : { "stringUnit" : { "state" : "translated", - "value" : "%2$@粉丝" + "value" : "%2$@ 粉丝" } } } @@ -19368,7 +19380,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "标签组图标(SFSymbol)" + "value" : "标签组图标(SFSymbol 名)" } }, "zh-Hant" : { @@ -20755,7 +20767,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "AppAccount" + "value" : "App 账户" } } } @@ -28571,8 +28583,8 @@ }, "zh-Hans" : { "stringUnit" : { - "state" : "needs_review", - "value" : "当下流行的网页" + "state" : "translated", + "value" : "新闻" } }, "zh-Hant" : { @@ -33129,7 +33141,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "Key" + "value" : "密钥" } } } @@ -45583,7 +45595,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "Require Alt Text to Post" + "value" : "有 ALT 才能发布" } }, "zh-Hant" : { @@ -82259,7 +82271,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "TimelineFilter" + "value" : "时间线过滤器" } } } diff --git a/Packages/StatusKit/Sources/StatusKit/Detail/StatusDetailView.swift b/Packages/StatusKit/Sources/StatusKit/Detail/StatusDetailView.swift index 2d1c297f..ee5bbe11 100644 --- a/Packages/StatusKit/Sources/StatusKit/Detail/StatusDetailView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Detail/StatusDetailView.swift @@ -137,13 +137,6 @@ public struct StatusDetailView: View { } } } - #if !os(visionOS) - .listRowBackground(viewModel.highlightRowColor) - #endif - .listRowInsets(.init(top: 12, - leading: .layoutPadding, - bottom: 12, - trailing: .layoutPadding)) } } diff --git a/Packages/StatusKit/Sources/StatusKit/Row/StatusRowView.swift b/Packages/StatusKit/Sources/StatusKit/Row/StatusRowView.swift index 3b69548b..7cc5981d 100644 --- a/Packages/StatusKit/Sources/StatusKit/Row/StatusRowView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Row/StatusRowView.swift @@ -15,6 +15,8 @@ public struct StatusRowView: View { @Environment(\.accessibilityVoiceOverEnabled) private var accessibilityVoiceOverEnabled @Environment(\.isStatusFocused) private var isFocused @Environment(\.indentationLevel) private var indentationLevel + @Environment(\.isHomeTimeline) private var isHomeTimeline + @Environment(RouterPath.self) private var routerPath: RouterPath @Environment(QuickLook.self) private var quickLook @@ -151,7 +153,7 @@ public struct StatusRowView: View { .foregroundStyle(.background).hoverEffect()) .listRowHoverEffectDisabled() #else - .listRowBackground(viewModel.highlightRowColor) + .listRowBackground(viewModel.makeBackgroundColor(isHomeTimeline: isHomeTimeline)) #endif .listRowInsets(.init(top: 0, leading: .layoutPadding, diff --git a/Packages/StatusKit/Sources/StatusKit/Row/StatusRowViewModel.swift b/Packages/StatusKit/Sources/StatusKit/Row/StatusRowViewModel.swift index 03946b98..b1fbd5ba 100644 --- a/Packages/StatusKit/Sources/StatusKit/Row/StatusRowViewModel.swift +++ b/Packages/StatusKit/Sources/StatusKit/Row/StatusRowViewModel.swift @@ -18,6 +18,8 @@ import SwiftUI let client: Client let routerPath: RouterPath + + let userFollowedTag: HTMLString.Link? private let theme = Theme.shared private let userMentionned: Bool @@ -103,8 +105,35 @@ import SwiftUI status.reblog?.inReplyToId != nil || status.reblog?.inReplyToAccountId != nil || status.inReplyToId != nil || status.inReplyToAccountId != nil } + + @ViewBuilder + func makeBackgroundColor(isHomeTimeline: Bool) -> some View { + if isHomeTimeline { + homeBackgroundColor + } else { + backgroundColor + } + } + + @ViewBuilder + var homeBackgroundColor: some View { + if status.visibility == .direct { + theme.tintColor.opacity(0.15) + } else if userMentionned { + theme.secondaryBackgroundColor + } else { + if userFollowedTag != nil { + makeDecorativeGradient(startColor: .teal, endColor: theme.primaryBackgroundColor) + } else if status.reblog != nil { + makeDecorativeGradient(startColor: theme.tintColor, endColor: theme.primaryBackgroundColor) + } else { + theme.primaryBackgroundColor + } + } + } - var highlightRowColor: Color { + @ViewBuilder + var backgroundColor: some View { if status.visibility == .direct { theme.tintColor.opacity(0.15) } else if userMentionned { @@ -113,6 +142,18 @@ import SwiftUI theme.primaryBackgroundColor } } + + func makeDecorativeGradient(startColor: Color, endColor: Color) -> some View { + LinearGradient(stops: [ + .init(color: startColor.opacity(0.3), location: 0.03), + .init(color: startColor.opacity(0.2), location: 0.06), + .init(color: startColor.opacity(0.1), location: 0.09), + .init(color: startColor.opacity(0.05), location: 0.15), + .init(color: endColor, location: 0.25), + ], + startPoint: .topLeading, + endPoint: .bottomTrailing) + } public init(status: Status, client: Client, @@ -146,6 +187,10 @@ import SwiftUI } else { userMentionned = false } + + userFollowedTag = finalStatus.content.links.first(where: { link in + link.type == .hashtag && CurrentAccount.shared.tags.contains(where: { $0.name.lowercased() == link.title.lowercased() }) + }) isFiltered = filter != nil diff --git a/Packages/StatusKit/Sources/StatusKit/Row/Subviews/StatusRowTagView.swift b/Packages/StatusKit/Sources/StatusKit/Row/Subviews/StatusRowTagView.swift index 28e35639..b144f846 100644 --- a/Packages/StatusKit/Sources/StatusKit/Row/Subviews/StatusRowTagView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Row/Subviews/StatusRowTagView.swift @@ -5,17 +5,14 @@ import SwiftUI struct StatusRowTagView: View { @Environment(CurrentAccount.self) private var currentAccount @Environment(RouterPath.self) private var routerPath + @Environment(Theme.self) private var theme @Environment(\.isHomeTimeline) private var isHomeTimeline let viewModel: StatusRowViewModel var body: some View { - if isHomeTimeline, - let tag = viewModel.finalStatus.content.links.first(where: { link in - link.type == .hashtag && currentAccount.tags.contains(where: { $0.name.lowercased() == link.title.lowercased() }) - }) - { + if isHomeTimeline, let tag = viewModel.userFollowedTag { Text("#\(tag.title)") .font(.scaledFootnote) .foregroundStyle(.secondary)