From b4763bde9c340e5bd6436b111f93106754774c98 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 9 Sep 2025 17:24:12 -0700 Subject: [PATCH] Remove keyboardtoolbar (#1385) * No more keyboard toolbar, just us an hstack * Change textarea to be styled without an overlay * fix empty message check * Touch up keyboard toolbar --- .../TextMessageField/TextMessageField.swift | 87 +++++++++---------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/Meshtastic/Views/Messages/TextMessageField/TextMessageField.swift b/Meshtastic/Views/Messages/TextMessageField/TextMessageField.swift index cc0f9b84..c5d44f96 100644 --- a/Meshtastic/Views/Messages/TextMessageField/TextMessageField.swift +++ b/Meshtastic/Views/Messages/TextMessageField/TextMessageField.swift @@ -19,64 +19,57 @@ struct TextMessageField: View { var body: some View { SessionReplayPrivacyView(textAndInputPrivacy: .maskAllInputs) { VStack(spacing: 0) { - HStack(alignment: .top) { - if replyMessageId != 0 { - HStack { - Button { - withAnimation(.easeInOut(duration: 0.2)) { - replyMessageId = 0 - } - isFocused = false - } label: { - Image(systemName: "x.circle.fill") + HStack(alignment: .bottom) { + if replyMessageId != 0 || isFocused { + Button { + withAnimation(.easeInOut(duration: 0.2)) { + replyMessageId = 0 } - Text("Reply") + isFocused = false + } label: { + Image(systemName: "x.circle.fill") + .font(.largeTitle) + } + if replyMessageId != 0 { + Text("Reply") + .padding(.bottom, 10) } - .padding(.top) } - - ZStack { - TextField("Message", text: $typingMessage, axis: .vertical) - .onChange(of: typingMessage) { _, value in - totalBytes = value.utf8.count - while totalBytes > Self.maxbytes { - typingMessage = String(typingMessage.dropLast()) - totalBytes = typingMessage.utf8.count - } + TextField("Message", text: $typingMessage, axis: .vertical) + .padding(10) + .background( + Capsule() + .strokeBorder(.tertiary, lineWidth: 1) + .background(Capsule().fill(Color.white)) + ) + .clipShape(Capsule()) + .onChange(of: typingMessage) { _, value in + totalBytes = value.utf8.count + while totalBytes > Self.maxbytes { + typingMessage = String(typingMessage.dropLast()) + totalBytes = typingMessage.utf8.count } - .keyboardType(.default) - // Remove toolbar here - .padding(.horizontal, 8) - .focused($isFocused) - .multilineTextAlignment(.leading) - .frame(minHeight: 50) - .onSubmit { + } + .keyboardType(.default) + .focused($isFocused) + .multilineTextAlignment(.leading) + .onSubmit { #if targetEnvironment(macCatalyst) - sendMessage() + sendMessage() #endif - } - - Text(typingMessage) - .opacity(0) - .padding(.all, 0) - } - .overlay(RoundedRectangle(cornerRadius: 20).stroke(.tertiary, lineWidth: 1)) - - Button(action: sendMessage) { - Image(systemName: "arrow.up.circle.fill") - .font(.largeTitle) - .foregroundColor(.accentColor) + } + if !typingMessage.isEmpty { + Button(action: sendMessage) { + Image(systemName: "arrow.up.circle.fill") + .font(.largeTitle) + .foregroundColor(.accentColor) + } } } - .padding(.horizontal, 15) - .padding(.top, 15) - .padding(.bottom, 10) + .padding(15) Divider() if isFocused { HStack { - Button("Dismiss") { - isFocused = false - } Spacer() AlertButton { typingMessage += "🔔 Alert Bell Character! \u{7}" } Spacer()