This commit is contained in:
fmodf 2024-07-01 10:47:39 +02:00
parent ac58f634a0
commit 31592a0e17
2 changed files with 9 additions and 5 deletions

View file

@ -30,12 +30,16 @@ struct ConversationMessageRow: View {
.offset(offset)
.gesture(
DragGesture(minimumDistance: 20, coordinateSpace: .local)
.onChanged { value in
var width = value.translation.width
width = width > 0 ? 0 : width
offset = CGSize(width: width, height: 0)
}
.onEnded { value in
withAnimation(.easeOut(duration: 0.1)) {
if value.translation.width < 0 {
offset = CGSize(width: -50, height: 0)
if value.translation.width <= -90 {
Vibration.success.vibrate()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
store.dispatch(.conversationAction(.setReplyText(message.body ?? "")))
withAnimation(.easeOut(duration: 0.1)) {
offset = .zero