This commit is contained in:
fmodf 2024-07-01 13:54:43 +02:00
parent c0ae9c8c4c
commit 58b69e7aa2
3 changed files with 6 additions and 3 deletions

View file

@ -29,7 +29,7 @@ struct ConversationMessageRow: View {
.background(Color.clearTappable)
.offset(offset)
.gesture(
DragGesture(minimumDistance: 20, coordinateSpace: .local)
DragGesture(minimumDistance: 30, coordinateSpace: .local)
.onChanged { value in
var width = value.translation.width
width = width > 0 ? 0 : width

View file

@ -7,6 +7,7 @@ struct ConversationScreen: View {
@EnvironmentObject var store: AppStore
@State private var autoScroll = true
@State private var firstIsVisible = true
var body: some View {
ZStack {
@ -29,11 +30,13 @@ struct ConversationScreen: View {
.id(message.id)
.onAppear {
if message.id == messages.first?.id {
firstIsVisible = true
autoScroll = true
}
}
.onDisappear {
if message.id == messages.first?.id {
firstIsVisible = false
autoScroll = false
}
}
@ -46,7 +49,7 @@ struct ConversationScreen: View {
.scrollDismissesKeyboard(.immediately)
.scrollIndicators(.hidden)
.onChange(of: autoScroll) { new in
if new {
if new, !firstIsVisible {
withAnimation {
proxy.scrollTo(messages.first?.id, anchor: .top)
}

View file

@ -95,7 +95,7 @@ struct ConversationTextInput: View {
private var composedMessage: String {
var result = ""
if !replyText.isEmpty {
result += replyText + "\n"
result += replyText + "\n\n"
}
result += messageStr
return result