Commit 1f38e9b6ff
Verified · cmc
Layout: unified · split
gitbay/Account/NotificationsViewModel.swift +3 −3
| @@ -3,7 +3,7 @@ import Observation | ||
| 3 | 3 | |
| 4 | 4 | /// One row of `notifications list`. `read_at` is omitempty: absent means |
| 5 | 5 | /// unread, which is the common case for the default (unread-only) listing. |
| 6 | nonisolated struct Notification: Decodable, Sendable, Hashable, Identifiable { | |
| 6 | nonisolated struct InboxNotification: Decodable, Sendable, Hashable, Identifiable { | |
| 7 | 7 | let id: Int64 |
| 8 | 8 | let repo: String |
| 9 | 9 | let kind: String |
| @@ -53,7 +53,7 @@ nonisolated enum NotificationDestination: Hashable, Sendable { | ||
| 53 | 53 | @MainActor |
| 54 | 54 | final class NotificationsViewModel { |
| 55 | 55 | |
| 56 | let list: PagedListModel<Notification> | |
| 56 | let list: PagedListModel<InboxNotification> | |
| 57 | 57 | /// Off shows unread only, the default listing; on adds `--all`. |
| 58 | 58 | var showAll = false { |
| 59 | 59 | didSet { |
| @@ -77,7 +77,7 @@ final class NotificationsViewModel { | ||
| 77 | 77 | ) |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | var state: LoadState<[Notification]> { list.state } | |
| 80 | var state: LoadState<[InboxNotification]> { list.state } | |
| 81 | 81 | |
| 82 | 82 | func load() async { |
| 83 | 83 | await list.reload() |
gitbayTests/NotificationTests.swift +2 −2
| @@ -22,10 +22,10 @@ private func argvOf(_ seen: StubProtocol.Seen) throws -> [String] { | ||
| 22 | 22 | return try #require(body["argv"] as? [String]) |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | private func decode(_ json: String) throws -> gitbay.Notification { | |
| 25 | private func decode(_ json: String) throws -> InboxNotification { | |
| 26 | 26 | let decoder = JSONDecoder() |
| 27 | 27 | decoder.dateDecodingStrategy = .iso8601 |
| 28 | return try decoder.decode(gitbay.Notification.self, from: Data(json.utf8)) | |
| 28 | return try decoder.decode(InboxNotification.self, from: Data(json.utf8)) | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | private let unreadBuild = """ |