aboutsummaryrefslogtreecommitdiff
path: root/Hotline
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2023-12-06 23:18:24 -0800
committerDustin Mierau <dustin@mierau.me>2023-12-06 23:18:24 -0800
commit2305aa8eab18ec5e60d940351793642145de5bd5 (patch)
treec6e16acb7726b9d4d63c4e2e8dcf1b4974d77103 /Hotline
parente3392bb948ad53889ad334140952f2acf614668e (diff)
Few small tweaks.
Diffstat (limited to 'Hotline')
-rw-r--r--Hotline/Hotline/HotlineClient.swift2
-rw-r--r--Hotline/Views/ChatView.swift31
-rw-r--r--Hotline/Views/ServerView.swift6
3 files changed, 33 insertions, 6 deletions
diff --git a/Hotline/Hotline/HotlineClient.swift b/Hotline/Hotline/HotlineClient.swift
index 9d62811..1eb7719 100644
--- a/Hotline/Hotline/HotlineClient.swift
+++ b/Hotline/Hotline/HotlineClient.swift
@@ -409,6 +409,8 @@ class HotlineClient {
return
}
+ self.transactionLog[transaction.id] = nil
+
print("HotlineClient reply in response to \(repliedTransactionType)")
switch(repliedTransactionType) {
diff --git a/Hotline/Views/ChatView.swift b/Hotline/Views/ChatView.swift
index 1aee6b2..108aea3 100644
--- a/Hotline/Views/ChatView.swift
+++ b/Hotline/Views/ChatView.swift
@@ -1,5 +1,11 @@
import SwiftUI
+extension View {
+ func endEditing() {
+ UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
+ }
+}
+
struct ChatView: View {
@Environment(HotlineClient.self) private var hotline
@Environment(\.colorScheme) var colorScheme
@@ -54,18 +60,37 @@ struct ChatView: View {
}
}
}
+ .scrollDismissesKeyboard(.interactively)
+ .onTapGesture {
+ self.endEditing()
+ }
Divider()
HStack(alignment: .top) {
- Image(systemName: "chevron.right")
+ Image(systemName: "chevron.right").opacity(0.4)
TextField("", text: $input, axis: .vertical)
+ .autocapitalization(.none)
.lineLimit(1...5)
.onSubmit {
- hotline.sendChat(message: self.input)
- // HotlineClient.shared.sendChat(message: self.input)
+ if !self.input.isEmpty {
+ hotline.sendChat(message: self.input)
+ }
self.input = ""
}
+ .frame(maxWidth: .infinity)
+ Button {
+ if !self.input.isEmpty {
+ hotline.sendChat(message: self.input)
+ }
+ self.input = ""
+ } label: {
+ Image(systemName: self.input.isEmpty ? "arrow.up.circle" : "arrow.up.circle.fill")
+ .resizable()
+ .scaledToFit()
+ .frame(width: 24.0, height: 24.0)
+ .opacity(self.input.isEmpty ? 0.4 : 1.0)
+ }
}.padding()
}
.navigationBarTitleDisplayMode(.inline)
diff --git a/Hotline/Views/ServerView.swift b/Hotline/Views/ServerView.swift
index 8e50d83..221156a 100644
--- a/Hotline/Views/ServerView.swift
+++ b/Hotline/Views/ServerView.swift
@@ -31,13 +31,13 @@ struct ServerView: View {
TabView {
ChatView()
.tabItem {
- Image(systemName: "message")
+ Image(systemName: "bubble")
}
.tag(Tab.chat)
UserListView()
.tabItem {
- Image(systemName: "person.fill")
+ Image(systemName: "person.2")
}
.tag(Tab.users)
@@ -49,7 +49,7 @@ struct ServerView: View {
MessageBoardView()
.tabItem {
- Image(systemName: "pin")
+ Image(systemName: "book.closed")
}
.tag(Tab.messageBoard)