damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 08ca484d540cf520036ae8fb0b91c1d759578877
parent bb6a09179edd0e59beeeb39043344b5fd612cb45
Author: Terry Yiu <963907+tyiu@users.noreply.github.com>
Date:   Mon, 30 Jan 2023 11:59:20 -0500

Fix height of DM input

Changelog-Fixed: Fixed height of DM input
Closes: #434

Diffstat:
Mdamus/Views/DMChatView.swift | 34+++++++++++++++-------------------
1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/damus/Views/DMChatView.swift b/damus/Views/DMChatView.swift @@ -63,6 +63,8 @@ struct DMChatView: View { ) .padding(16) .foregroundColor(Color.primary) + .frame(minHeight: 70, maxHeight: 150, alignment: .bottom) + .fixedSize(horizontal: false, vertical: true) } @Environment(\.colorScheme) var colorScheme @@ -97,22 +99,15 @@ struct DMChatView: View { } } } - } - .frame(height: 50 + 20 * CGFloat(text_lines)) - } + .fixedSize(horizontal: false, vertical: true) + .frame(minHeight: 70, maxHeight: 150, alignment: .bottom) - var text_lines: Int { - var lines = 1 - for c in message { - if lines > 4 { - return lines - } - if c.isNewline { - lines += 1 - } + Text(message).opacity(0).padding(.all, 8) + .fixedSize(horizontal: false, vertical: true) + .frame(minHeight: 70, maxHeight: 150, alignment: .bottom) } - - return lines + .fixedSize(horizontal: false, vertical: true) + .frame(minHeight: 70, maxHeight: 150, alignment: .bottom) } func send_message() { @@ -142,12 +137,13 @@ struct DMChatView: View { Footer } + Text("Send a message to start the conversation...", comment: "Text prompt for user to send a message to the other user.") - .lineLimit(nil) - .multilineTextAlignment(.center) - .padding(.horizontal, 40) - .opacity(((dms.events.count == 0) ? 1.0 : 0.0)) - .foregroundColor(.gray) + .lineLimit(nil) + .multilineTextAlignment(.center) + .padding(.horizontal, 40) + .opacity(((dms.events.count == 0) ? 1.0 : 0.0)) + .foregroundColor(.gray) } .navigationTitle(NSLocalizedString("DMs", comment: "Navigation title for DMs view, where DM is the English abbreviation for Direct Message.")) .toolbar { Header }