summaryrefslogtreecommitdiff
path: root/Hutch/Views/Inbox/InboxView.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-03-19 01:53:46 -0500
committerChristian Cleberg <[email protected]>2026-03-19 01:53:46 -0500
commit1e3c748119c6e9eec27f02146f17ea0302ff648a (patch)
tree6a5a7c6d22a9022b1b3daa3710768d12981ca0ed /Hutch/Views/Inbox/InboxView.swift
parent441b69afae30ee6b662be38004fd7b5de1e47302 (diff)
downloadhutch-1e3c748119c6e9eec27f02146f17ea0302ff648a.tar.gz
hutch-1e3c748119c6e9eec27f02146f17ea0302ff648a.tar.bz2
hutch-1e3c748119c6e9eec27f02146f17ea0302ff648a.zip
feat: add inbox threads and move builds under more
Diffstat (limited to 'Hutch/Views/Inbox/InboxView.swift')
-rw-r--r--Hutch/Views/Inbox/InboxView.swift23
1 files changed, 22 insertions, 1 deletions
diff --git a/Hutch/Views/Inbox/InboxView.swift b/Hutch/Views/Inbox/InboxView.swift
index e5f3619..602f8d9 100644
--- a/Hutch/Views/Inbox/InboxView.swift
+++ b/Hutch/Views/Inbox/InboxView.swift
@@ -31,6 +31,12 @@ struct InboxView: View {
NavigationLink(value: thread) {
InboxThreadRow(thread: thread)
}
+ .swipeActions(edge: .leading, allowsFullSwipe: true) {
+ readStateAction(for: thread, in: viewModel)
+ }
+ .swipeActions(edge: .trailing, allowsFullSwipe: true) {
+ readStateAction(for: thread, in: viewModel)
+ }
}
}
.listStyle(.plain)
@@ -39,7 +45,7 @@ struct InboxView: View {
SRHTLoadingStateView(message: "Loading inbox…")
} else if let error = viewModel.error, viewModel.threads.isEmpty {
SRHTErrorStateView(
- title: "Couldn't Load Threads",
+ title: "Failed to load inbox",
message: error,
retryAction: { await viewModel.loadThreads() }
)
@@ -64,6 +70,21 @@ struct InboxView: View {
}
}
}
+
+ @ViewBuilder
+ private func readStateAction(for thread: InboxThreadSummary, in viewModel: InboxViewModel) -> some View {
+ Button {
+ withAnimation(.easeInOut(duration: 0.2)) {
+ viewModel.toggleThreadReadState(thread)
+ }
+ } label: {
+ Label(
+ thread.isUnread ? "Mark as Read" : "Mark as Unread",
+ systemImage: thread.isUnread ? "envelope.open" : "envelope.badge"
+ )
+ }
+ .tint(thread.isUnread ? .blue : .gray)
+ }
}
private struct InboxThreadRow: View {