mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
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
This commit is contained in:
parent
9f0fe5ebf1
commit
b4763bde9c
1 changed files with 40 additions and 47 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue