From 58b69e7aa2a879f32c9d79126902b6e1cce37f42 Mon Sep 17 00:00:00 2001 From: fmodf Date: Mon, 1 Jul 2024 13:54:43 +0200 Subject: [PATCH] wip --- .../View/Screens/Conversation/ConversationMessageRow.swift | 2 +- .../View/Screens/Conversation/ConversationScreen.swift | 5 ++++- .../View/Screens/Conversation/ConversationTextInput.swift | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ConversationsClassic/View/Screens/Conversation/ConversationMessageRow.swift b/ConversationsClassic/View/Screens/Conversation/ConversationMessageRow.swift index 6607364..eb5c171 100644 --- a/ConversationsClassic/View/Screens/Conversation/ConversationMessageRow.swift +++ b/ConversationsClassic/View/Screens/Conversation/ConversationMessageRow.swift @@ -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 diff --git a/ConversationsClassic/View/Screens/Conversation/ConversationScreen.swift b/ConversationsClassic/View/Screens/Conversation/ConversationScreen.swift index 3c0bb18..f1b53e2 100644 --- a/ConversationsClassic/View/Screens/Conversation/ConversationScreen.swift +++ b/ConversationsClassic/View/Screens/Conversation/ConversationScreen.swift @@ -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) } diff --git a/ConversationsClassic/View/Screens/Conversation/ConversationTextInput.swift b/ConversationsClassic/View/Screens/Conversation/ConversationTextInput.swift index 1fcc953..a7ba660 100644 --- a/ConversationsClassic/View/Screens/Conversation/ConversationTextInput.swift +++ b/ConversationsClassic/View/Screens/Conversation/ConversationTextInput.swift @@ -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