8000 Fix translated message showing original text in message actions overlay by nuno-vieira · Pull Request #810 · GetStream/stream-chat-swiftui · GitHub
[go: up one dir, main page]

Skip to content

Fix translated message showing original text in message actions overlay #810

New issue

Have a question about this project 8000 ? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix having message edit action on Giphy messages [#806](https://github.com/GetStream/stream-chat-swiftui/pull/806)
- Fix being able to long press an unsent Giphy message [#806](https://github.com/GetStream/stream-chat-swiftui/pull/806)
- Fix being able to swipe to reply an unsent Giphy message [#806](https://github.com/GetStream/stream-chat-swiftui/pull/806)
- Fix translated message showing original text in message actions overlay [#810](https://github.com/GetStream/stream-chat-swiftui/pull/810)

### 🔄 Changed
- Deprecated `ComposerConfig.attachmentPayloadConverter` in favour of `MessageComposerViewModel.convertAddedAssetsToPayloads()` [#806](https://github.com/GetStream/stream-chat-swiftui/pull/806)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,13 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
Group {
if messageDisplayInfo.frame.height > messageContainerHeight {
ScrollView {
MessageView(
factory: factory,
message: messageDisplayInfo.message,
contentWidth: messageDisplayInfo.contentWidth,
isFirst: messageDisplayInfo.isFirst,
scrolledId: .constant(nil)
)
messageView
}
} else {
MessageView(
factory: factory,
message: messageDisplayInfo.message,
contentWidth: messageDisplayInfo.contentWidth,
isFirst: messageDisplayInfo.isFirst,
scrolledId: .constant(nil)
)
messageView
}
}
.environment(\.channelTranslationLanguage, channel.membership?.language)
.scaleEffect(popIn || willPopOut ? 1 : 0.95)
.animation(willPopOut ? .easeInOut : popInAnimation, value: popIn)
.offset(
Expand Down Expand Up @@ -228,6 +217,16 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
}
}

private var messageView: some View {
MessageView(
factory: factory,
message: messageDisplayInfo.message,
contentWidth: messageDisplayInfo.contentWidth,
isFirst: messageDisplayInfo.isFirst,
scrolledId: .constant(nil)
)
}

private func dismissReactionsOverlay(completion: @escaping () -> Void) {
withAnimation {
willPopOut = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,36 @@ class ReactionsOverlayView_Tests: StreamChatTestCase {
// Then
XCTAssert(offset == 12.5)
}

func test_reactionsOverlayView_translated() {
// Given
let testMessage = ChatMessage.mock(
id: "test",
cid: .unique,
text: "Hello",
author: .mock(id: "test", name: "martin"),
translations: [.portuguese: "Olá"]
)
let messageDisplayInfo = MessageDisplayInfo(
message: testMessage,
frame: self.messageDisplayInfo.frame,
contentWidth: self.messageDisplayInfo.contentWidth,
isFirst: true
)
let view = VerticallyCenteredView {
ReactionsOverlayView(
factory: DefaultViewFactory.shared,
channel: .mock(cid: .unique, membership: .mock(id: "test", language: .portuguese)),
currentSnapshot: self.overlayImage,
messageDisplayInfo: messageDisplayInfo,
onBackgroundTap: {},
onActionExecuted: { _ in }
)
}

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision))
}
}

struct VerticallyCenteredView<Content: View>: View {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
0