diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a2d01ea..b35daf57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). # Upcoming +### 🐞 Fixed +- Fix message long press taking too much time to show actions [#648](https://github.com/GetStream/stream-chat-swiftui/pull/648) ### 🔄 Changed - Message composer now uses `.uploadFile` capability when showing attachment picker icon [#646](https://github.com/GetStream/stream-chat-swiftui/pull/646) - `ChannelInfoView` now uses `.updateChannelMembers` capability to show "Add Users" button [#651](https://github.com/GetStream/stream-chat-swiftui/pull/651) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift index ea39a48d..0aff7889 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift @@ -121,11 +121,14 @@ public struct MessageContainerView: View { handleGestureForMessage(showsMessageActions: true) } } - .onLongPressGesture(perform: { - if !message.isDeleted { - handleGestureForMessage(showsMessageActions: true) - } - }) + .highPriorityGesture( + LongPressGesture() + .onEnded { _ in + if !message.isDeleted { + handleGestureForMessage(showsMessageActions: true) + } + } + ) .offset(x: min(self.offsetX, maximumHorizontalSwipeDisplacement)) .simultaneousGesture( DragGesture( diff --git a/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift b/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift index 9812fa70..455506a4 100644 --- a/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift +++ b/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift @@ -931,22 +931,12 @@ extension UserRobot { let image = attributes.image(in: messageCell) if isPresent { image.wait() - sleep(2) // At the moment, this assert is flaky without it } else { image.waitForDisappearance() } let errMessage = isPresent ? "Image is not presented" : "Image is presented" - XCTAssertTrue(image.exists, errMessage, file: file, line: line) - - image.safeTap() - image.waitForDisappearance(timeout: 2) - if image.exists { - image.safeTap() - } - - let fullscreenImage = attributes.fullscreenImage().wait() - XCTAssertTrue(fullscreenImage.exists, "Fullscreen \(errMessage)", file: file, line: line) + XCTAssertEqual(isPresent, image.exists, errMessage, file: file, line: line) return self }