From 7e81e49cc1b2d4fa4726477c4c0e0f1c22a6fbd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=B6=E6=9D=96?= Date: Thu, 12 Dec 2024 16:36:24 +0800 Subject: [PATCH] Refactor NotificationsView date formatter locale and clean up unused overlay code - Updated the date formatter in NotificationRow to use the current locale instead of a fixed "zh_CN" locale. - Removed the overlay code for clickable links in notifications, simplifying the view structure. - Ensured proper formatting and consistency in V2EXRouter by adding a newline at the end of the file. --- V2Bar/Sources/Network/V2EXRouter.swift | 2 +- V2Bar/Sources/Views/NotificationsView.swift | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/V2Bar/Sources/Network/V2EXRouter.swift b/V2Bar/Sources/Network/V2EXRouter.swift index b0492c9..24e48fb 100644 --- a/V2Bar/Sources/Network/V2EXRouter.swift +++ b/V2Bar/Sources/Network/V2EXRouter.swift @@ -130,4 +130,4 @@ extension V2EXRouter { static func notifications(page: Int) -> V2EXRouter { .notifications(page: page) } -} \ No newline at end of file +} diff --git a/V2Bar/Sources/Views/NotificationsView.swift b/V2Bar/Sources/Views/NotificationsView.swift index 1021fa3..bdfdc0e 100644 --- a/V2Bar/Sources/Views/NotificationsView.swift +++ b/V2Bar/Sources/Views/NotificationsView.swift @@ -71,8 +71,7 @@ struct NotificationRow: View { let notification: Notification private static let dateFormatter: RelativeDateTimeFormatter = { let formatter = RelativeDateTimeFormatter() - formatter.locale = Locale(identifier: "zh_CN") - formatter.unitsStyle = .short + formatter.locale = Locale.current return formatter }() @@ -98,15 +97,6 @@ struct NotificationRow: View { Text(notification.plainText) .font(.subheadline) .foregroundColor(.primary) - .overlay(alignment: .leading) { - // 覆盖可点击的链接 - HStack { - ForEach(notification.links, id: \.url) { link in - Link("", destination: link.url) - .frame(width: 0, height: 0) - } - } - } // 回复内容 if let payload = notification.payload, !payload.isEmpty {