aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS/Board
diff options
context:
space:
mode:
Diffstat (limited to 'Hotline/macOS/Board')
-rw-r--r--Hotline/macOS/Board/MessageBoardEditorView.swift14
-rw-r--r--Hotline/macOS/Board/MessageBoardView.swift6
2 files changed, 10 insertions, 10 deletions
diff --git a/Hotline/macOS/Board/MessageBoardEditorView.swift b/Hotline/macOS/Board/MessageBoardEditorView.swift
index 474384e..ea1754c 100644
--- a/Hotline/macOS/Board/MessageBoardEditorView.swift
+++ b/Hotline/macOS/Board/MessageBoardEditorView.swift
@@ -8,7 +8,7 @@ struct MessageBoardEditorView: View {
@Environment(\.controlActiveState) private var controlActiveState
@Environment(\.colorScheme) private var colorScheme
@Environment(\.dismiss) private var dismiss
- @Environment(Hotline.self) private var model: Hotline
+ @Environment(HotlineState.self) private var model: HotlineState
@State private var text: String = ""
@State private var sending: Bool = false
@@ -17,11 +17,11 @@ struct MessageBoardEditorView: View {
func sendPost() async {
sending = true
-
+
let cleanedText = text.trimmingCharacters(in: .whitespacesAndNewlines)
-
- model.postToMessageBoard(text: cleanedText)
- let _ = await model.getMessageBoard()
+
+ try? await model.postToMessageBoard(text: cleanedText)
+ let _ = try? await model.getMessageBoard()
// let success = await model.postNewsArticle(title: title, body: text, at: path, parentID: parentID)
// if success {
@@ -69,9 +69,9 @@ struct MessageBoardEditorView: View {
else {
Button {
sending = true
- model.postToMessageBoard(text: text)
Task {
- let _ = await model.getMessageBoard()
+ try? await model.postToMessageBoard(text: text)
+ let _ = try? await model.getMessageBoard()
Task { @MainActor in
sending = false
dismiss()
diff --git a/Hotline/macOS/Board/MessageBoardView.swift b/Hotline/macOS/Board/MessageBoardView.swift
index f870b0c..8788d66 100644
--- a/Hotline/macOS/Board/MessageBoardView.swift
+++ b/Hotline/macOS/Board/MessageBoardView.swift
@@ -1,7 +1,7 @@
import SwiftUI
struct MessageBoardView: View {
- @Environment(Hotline.self) private var model: Hotline
+ @Environment(HotlineState.self) private var model: HotlineState
@State private var composerDisplayed: Bool = false
@State private var composerText: String = ""
@@ -25,7 +25,7 @@ struct MessageBoardView: View {
}
.task {
if !model.messageBoardLoaded {
- let _ = await model.getMessageBoard()
+ let _ = try? await model.getMessageBoard()
}
}
.overlay {
@@ -98,5 +98,5 @@ struct MessageBoardView: View {
#Preview {
MessageBoardView()
- .environment(Hotline(trackerClient: HotlineTrackerClient(), client: HotlineClient()))
+ .environment(HotlineState())
}