diff options
| -rw-r--r-- | Hotline.xcodeproj/project.pbxproj | 4 | ||||
| -rw-r--r-- | Hotline/Hotline/HotlineClient.swift | 2 | ||||
| -rw-r--r-- | Hotline/Models/Hotline.swift | 8 | ||||
| -rw-r--r-- | Hotline/macOS/ChatView.swift | 1 | ||||
| -rw-r--r-- | Hotline/macOS/FilePreviewImageView.swift | 1 | ||||
| -rw-r--r-- | Hotline/macOS/FilePreviewTextView.swift | 1 | ||||
| -rw-r--r-- | Hotline/macOS/FilesView.swift | 1 | ||||
| -rw-r--r-- | Hotline/macOS/MessageBoardView.swift | 2 | ||||
| -rw-r--r-- | Hotline/macOS/ServerView.swift | 151 |
9 files changed, 87 insertions, 84 deletions
diff --git a/Hotline.xcodeproj/project.pbxproj b/Hotline.xcodeproj/project.pbxproj index b6ef33b..d1448ee 100644 --- a/Hotline.xcodeproj/project.pbxproj +++ b/Hotline.xcodeproj/project.pbxproj @@ -508,7 +508,7 @@ CODE_SIGN_ENTITLEMENTS = Hotline/Hotline.entitlements; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 8; DEVELOPMENT_ASSET_PATHS = "\"Hotline/Preview Content\""; DEVELOPMENT_TEAM = 5AEEV7QB2U; "ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES; @@ -547,7 +547,7 @@ CODE_SIGN_ENTITLEMENTS = Hotline/Hotline.entitlements; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 8; DEVELOPMENT_ASSET_PATHS = "\"Hotline/Preview Content\""; DEVELOPMENT_TEAM = 5AEEV7QB2U; "ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES; diff --git a/Hotline/Hotline/HotlineClient.swift b/Hotline/Hotline/HotlineClient.swift index c1b13ff..ccb0c4c 100644 --- a/Hotline/Hotline/HotlineClient.swift +++ b/Hotline/Hotline/HotlineClient.swift @@ -178,7 +178,6 @@ class HotlineClient { } func disconnect() { - print("DISCONNECT?") for (_, replyInfo) in self.transactionLog { let replyCallback = replyInfo.1 replyCallback?(HotlineTransaction(type: replyInfo.0), .networkFailure) @@ -193,7 +192,6 @@ class HotlineClient { private func sendTransaction(_ t: HotlineTransaction, sent sentCallback: ((Bool) -> Void)? = nil, reply replyCallback: ((HotlineTransaction, HotlineTransactionError?) -> Void)? = nil) { guard let c = connection else { - print("NO CONNECTION?????") sentCallback?(false) return } diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift index c018e55..e62ac15 100644 --- a/Hotline/Models/Hotline.swift +++ b/Hotline/Models/Hotline.swift @@ -246,8 +246,6 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { self.username = username self.iconID = iconID - print("CLIENT LOGIN: '\(server.login)' '\(server.password)'") - self.client.login(server.address, port: UInt16(server.port), login: server.login, password: server.password, username: username, iconID: UInt16(iconID)) { [weak self] err, serverName, serverVersion in self?.serverVersion = serverVersion if serverName != nil { @@ -335,8 +333,6 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { continuation.resume(returning: nil) return } - - print("GET NEWS CATS FROM \(path)") }, reply: { articleText in // let parentNews = self?.findNews(in: self?.news ?? [], at: path) @@ -376,8 +372,6 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { continuation.resume(returning: []) return } - - print("GET NEWS CATS FROM \(path)") }, reply: { [weak self] categories in // let parentNews = self?.findNews(in: self?.news ?? [], at: path) @@ -445,8 +439,6 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { } return } - - print("GET NEWS CATS FROM \(path)") }, reply: { [weak self] categories in let parentNews = self?.findNews(in: self?.news ?? [], at: path) diff --git a/Hotline/macOS/ChatView.swift b/Hotline/macOS/ChatView.swift index 2c154d3..7f7d677 100644 --- a/Hotline/macOS/ChatView.swift +++ b/Hotline/macOS/ChatView.swift @@ -118,7 +118,6 @@ struct ChatView: View { // withAnimation { reader.scrollTo(bottomID, anchor: .bottom) // } - print("SCROLLED TO BOTTOM") } .onAppear { reader.scrollTo(bottomID, anchor: .bottom) diff --git a/Hotline/macOS/FilePreviewImageView.swift b/Hotline/macOS/FilePreviewImageView.swift index 1ee4e9b..461f5a4 100644 --- a/Hotline/macOS/FilePreviewImageView.swift +++ b/Hotline/macOS/FilePreviewImageView.swift @@ -13,7 +13,6 @@ struct FilePreviewImageView: View { @Binding var info: PreviewFileInfo? @State var preview: FilePreview? = nil - @Namespace var mainNamespace @FocusState private var focusField: FilePreviewFocus? var body: some View { diff --git a/Hotline/macOS/FilePreviewTextView.swift b/Hotline/macOS/FilePreviewTextView.swift index 8b5b4f3..2cb192c 100644 --- a/Hotline/macOS/FilePreviewTextView.swift +++ b/Hotline/macOS/FilePreviewTextView.swift @@ -12,7 +12,6 @@ struct FilePreviewTextView: View { @Binding var info: PreviewFileInfo? @State var preview: FilePreview? = nil - @Namespace var mainNamespace @FocusState private var focusField: FilePreviewFocus? var body: some View { diff --git a/Hotline/macOS/FilesView.swift b/Hotline/macOS/FilesView.swift index 1eab0cf..b9f15db 100644 --- a/Hotline/macOS/FilesView.swift +++ b/Hotline/macOS/FilesView.swift @@ -218,7 +218,6 @@ struct FilesView: View { ToolbarItem(placement: .primaryAction) { Button { if let s = selection, !s.isFolder { - print("DOWNLOAD FILE", s.name, s.path) model.downloadFile(s.name, path: s.path) } } label: { diff --git a/Hotline/macOS/MessageBoardView.swift b/Hotline/macOS/MessageBoardView.swift index d72b122..65a947f 100644 --- a/Hotline/macOS/MessageBoardView.swift +++ b/Hotline/macOS/MessageBoardView.swift @@ -22,8 +22,6 @@ struct MessageBoardView: View { .task { if !model.messageBoardLoaded { let _ = await model.getMessageBoard() -// self.initialLoadComplete = true - print("INITIAL LOAD?") } } .overlay { diff --git a/Hotline/macOS/ServerView.swift b/Hotline/macOS/ServerView.swift index 366fff2..b21e4fb 100644 --- a/Hotline/macOS/ServerView.swift +++ b/Hotline/macOS/ServerView.swift @@ -171,88 +171,107 @@ struct ServerView: View { MenuItem(name: "Files", image: "folder", type: .files), ] + enum FocusFields { + case address + case login + case password + } + + @FocusState private var focusedField: FocusFields? + var connectForm: some View { - GroupBox { - Form { - Group { - TextField(text: $connectAddress) { - Text("Address:") - } - TextField(text: $connectLogin, prompt: Text("optional")) { - Text("Login:") + VStack(alignment: .center) { + GroupBox { + Form { + Group { + TextField(text: $connectAddress) { + Text("Address:") + } + .focused($focusedField, equals: .address) + + Text("Type the address of the Hotline server you would like to connect to. If you have an account on that server, type your login and password too.") + .font(.caption) + .foregroundStyle(.secondary) + + TextField(text: $connectLogin, prompt: Text("optional")) { + Text("Login:") + } + .focused($focusedField, equals: .login) + SecureField(text: $connectPassword, prompt: Text("optional")) { + Text("Password:") + } + .focused($focusedField, equals: .password) } - SecureField(text: $connectPassword, prompt: Text("optional")) { - Text("Password:") + .textFieldStyle(.roundedBorder) + .controlSize(.regular) + + HStack { + Button { + print("SAVE BOOKMARK... SOMEHOW") + } label: { + Text("Save...") + } + .controlSize(.regular) + .buttonStyle(.automatic) + .help("Save server as bookmark") + + Spacer() + + Button { + dismiss() + } label: { + Text("Cancel") + } + .controlSize(.regular) + .buttonStyle(.automatic) + .keyboardShortcut(.cancelAction) + + Button { + + // if var s = server { + // print("CHANGING EXISTING SERVER") + // s.name = newServer.name + // s.description = newServer.description + // s.users = newServer.users + // s.address = newServer.address + // s.port = newServer.port + // s.login = newServer.login + // s.password = newServer.password + // } + // else { + // server = newServer + // } + + Task { + await connectToServer() + } + } label: { + Text("Connect") + } + .controlSize(.regular) + .buttonStyle(.automatic) + .keyboardShortcut(.defaultAction) } + .padding(.top, 8) + } - .textFieldStyle(.roundedBorder) - .controlSize(.regular) + .padding() .onChange(of: connectAddress) { let (a, p) = Server.parseServerAddressAndPort(connectAddress) server.address = a server.port = p - print("ADDRESS CHANGED: '\(connectAddress)' \(a) \(p)") } .onChange(of: connectLogin) { server.login = connectLogin.trimmingCharacters(in: .whitespacesAndNewlines) - print("LOGIN CHANGED: '\(connectLogin)'" + $server.wrappedValue.login) } .onChange(of: connectPassword) { server.password = connectPassword - print("PASS CHANGED: '\(connectPassword)'" + server.password) - } - - HStack { - Button { - print("SAVE BOOKMARK... SOMEHOW") - } label: { - Text("Save...") - } - .controlSize(.regular) - .buttonStyle(.automatic) - .help("Save server as bookmark") - - Spacer() - - Button { - dismiss() - } label: { - Text("Cancel") - } - .controlSize(.regular) - .buttonStyle(.automatic) - .keyboardShortcut(.cancelAction) - - Button { - -// if var s = server { -// print("CHANGING EXISTING SERVER") -// s.name = newServer.name -// s.description = newServer.description -// s.users = newServer.users -// s.address = newServer.address -// s.port = newServer.port -// s.login = newServer.login -// s.password = newServer.password -// } -// else { -// server = newServer -// } - - Task { - await connectToServer() - } - } label: { - Text("Connect") - } - .controlSize(.regular) - .buttonStyle(.automatic) - .keyboardShortcut(.defaultAction) } - .padding(.top, 8) - } - .padding() +// .padding(.top, 8) + .onAppear { + focusedField = .address + } } .frame(maxWidth: 350) .padding() |