From 64368ad8690f0a071f2490e8429c0437694133ee Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Wed, 3 Jan 2024 15:40:24 -0800 Subject: Fix issue with username saving to server with each change in username textfield. --- Hotline/macOS/ChatView.swift | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'Hotline/macOS/ChatView.swift') diff --git a/Hotline/macOS/ChatView.swift b/Hotline/macOS/ChatView.swift index d94634a..d9e1f54 100644 --- a/Hotline/macOS/ChatView.swift +++ b/Hotline/macOS/ChatView.swift @@ -171,7 +171,6 @@ struct ChatView: View { } } .navigationTitle(self.model.serverTitle) - .navigationSubtitle(self.model.users.count > 0 ? "^[\(self.model.users.count) user](inflect: true) online" : "") .background(Color(nsColor: .textBackgroundColor)) .toolbar { ToolbarItem(placement: .primaryAction) { @@ -181,17 +180,17 @@ struct ChatView: View { } } label: { Image(systemName: "square.and.arrow.up") - }.help("Save Chat") + }.help("Save Chat...") } } - .fileExporter(isPresented: $showingExporter, document: chatDocument, contentType: .utf8PlainText, defaultFilename: "\(model.serverTitle) Chat") { result in -// switch result { -// case .success(let url): -// print("Saved to \(url)") -// -// case .failure(let error): -// print(error.localizedDescription) -// } + .fileExporter(isPresented: $showingExporter, document: self.chatDocument, contentType: .utf8PlainText, defaultFilename: "\(self.model.serverTitle) Chat.txt") { result in + switch result { + case .success(let url): + print("Saved to \(url)") + + case .failure(let error): + print(error.localizedDescription) + } self.chatDocument.text = "" } } @@ -200,7 +199,6 @@ struct ChatView: View { var text: String = String() self.chatDocument.text = "" - for msg in model.chat { if msg.type == .agreement { text.append(msg.text) -- cgit