Skip to content

Commit

Permalink
Refactor NotificationsView date formatter locale and clean up unused …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
ygsgdbd committed Dec 12, 2024
1 parent 39f9893 commit 7e81e49
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion V2Bar/Sources/Network/V2EXRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ extension V2EXRouter {
static func notifications(page: Int) -> V2EXRouter {
.notifications(page: page)
}
}
}
12 changes: 1 addition & 11 deletions V2Bar/Sources/Views/NotificationsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}()

Expand All @@ -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 {
Expand Down

0 comments on commit 7e81e49

Please sign in to comment.