Comments (6)
And sometimes the translated message wont load until i pressed back and then reopen the channel. Is it known bug or already solved? Thanks
from stream-chat-swift.
Hi @ikaru19,
Can you please provide your customization code? Otherwise I can't pinpoint if there is any issue.
Best,
Nuno
from stream-chat-swift.
here is the code when i listen to the new message update when there is new translated or updated message
func eventsController(_ controller: EventsController, didReceiveEvent event: Event) {
// Handle any event received
switch event {
case let data as MessageUpdatedEvent:
let message: ChatMessage = data.message
if let messageIndexPath = super.getIndexPath(forMessageId: message.id),
let cid = message.cid {
ChatClient.shared.messageController(cid: cid, messageId: message.id).synchronize(){[weak self] _ in
self?.updateMessage(at: messageIndexPath, with: message)
var cell = self?.listView.cellForRow(at: messageIndexPath) as! ChatMessageCell
cell.messageContentView?.content = message
cell.messageContentView?.updateContent()
cell.updateDataCell(data: message)
}
let changes: [ListChange<ChatMessage>] = [
.update(message, index: messageIndexPath)
]
super.updateMessages(with: changes)
listView.reloadData()
}
break
case let data as MessageDeletedEvent:
let message: ChatMessage = data.message
if let messageIndexPath = super.getIndexPath(forMessageId: message.id),
let cid = message.cid {
ChatClient.shared.messageController(cid: cid, messageId: message.id).synchronize(){[weak self] _ in
self?.deleteMessage(at: messageIndexPath)
}
}
break
default:
break
}
}
// Here is how handle on the ChatMessageContentView
func updateContent(with message: ChatMessage) {
if let languageCode = getUserLanguageCodeFromCache(),
let languageName = getUserLanguageNameFromCache(),
let translations = message.translations,
let resultTranslation = translations[languageCode]
{
textView?.text = resultTranslation
let translationSuffix = " - Translated to \(languageName)"
if let timestampLabelText = timestampLabel?.text,
!timestampLabelText.contains("- Translated to") {
timestampLabel?.text?.append(translationSuffix)
translationLabel?.removeFromSuperview()
}
self.footnoteContainer?.isHidden = false
seeOriginalLabel?.isHidden = false
isOriginalMessage = false
}
updateSeeOriginalLabel()
}
func updateSeeOriginalLabel() {
seeOriginalLabel?.text = isOriginalMessage ? "See Translated" : "See Original"
}
from stream-chat-swift.
Hi @ikaru19,
You don't need to do the didReceiveEvent
changes. Whenever the message is updated, the cell will be automatically updated. You should not be doing this manually yourself. I can see that in fact, we have an issue that the cell might not update when new translations are inserted, so we need to fix this on our side.
Besides this, the way you determine how to show the original or the translated message is not correct. Creating a property in the cell like you are doing isOriginalMessage
won't work because if the cell is reloaded, you lose the state. So you will need to create a property in extraData like shouldShowOriginalMessage: Bool
to control this. Whenever the user selects "showOriginal" or "showTranslated" you need to change to update this extra data property.
We will make sure we fix the issue of new translations not updating the cell, but you also need to update your implemention of showing the original message.
Best,
Nuno
from stream-chat-swift.
Hi @ikaru19,
The fix I mentioned above will be available on the 4.51.0 Release. Please, keep an eye on the new releases.
Thank you for the report!
Best,
Nuno
from stream-chat-swift.
Hello @ikaru19, we have released a new iOS SDK version 4.51.0 which addresses this issue. Thank you for reporting it.
from stream-chat-swift.
Related Issues (20)
- Slack-style reactions HOT 8
- For iOS is not a valid binary HOT 2
- Not able to connect user to the Chat HOT 2
- Token provider keeps retrying after calling disconnect HOT 5
- Passing an Invalid Token during connection triggers an infinity loop. HOT 3
- Unable to receive push Notifications: error "DeviceTokenNotForTopic" HOT 2
- Missing super.init in AsyncOperation HOT 2
- Error "'shared' is unavailable in application extensions for iOS..." when using UNNotificationServiceExtension HOT 1
- App crash on creating a new 1:1 chat, found nil when unwrapping optional in ListDataBaseObserver HOT 26
- Composer text input not resizing correctly HOT 6
- Message author miscomputed after user id change during the same session HOT 3
- Multiple didUpdateChannel with unreadCount 0 HOT 23
- Upload Image to GetStream CDN HOT 1
- Message Search Not Working HOT 11
- Custom subview of ChatMessageContentView is not sized correctly HOT 5
- TokenProvider not triggering refresh and causing infinite API calls HOT 5
- Is it possible for me to query a channel to direct message only? HOT 1
- Test
- Mute intervals for channels doesn't seem to work HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stream-chat-swift.