Comments (8)
No problem @borut-t 👍
from stream-chat-swift.
Hi @borut-t,
We have an example of Slack Reactions in our Slack Demo App. Here is an example: https://github.com/GetStream/stream-chat-swift/blob/develop/Examples/SlackClone/SlackReactionsView.swift,
In order to load all reactions you will need to use the ChatMessageController.loadReactions
and ChatMessageController.loadNextReactions
for that.
Thanks,
Nuno
from stream-chat-swift.
I'm closing this one for now. Feel free to re-open the issue if you are still having troubles.
Best,
Nuno
from stream-chat-swift.
@nuno-vieira thanks for the example. I was looking at the example and could not find the point where app loads reactions.
However, when examining the code and trying to understand how this works, I got a bit worried. You've mentioned I should call loadReactions/loadNextReactions
APIs in order to fetch reactions. And this is a bit concerning to me. Loading all reactions for every message while user scrolls through messages will be certainly a sluggish experience.
And I'm not really sure how I can do that using swiftui's ChatChannelView
which loads all messages for me.
I'm also looking at this code
reactions = content.reactionScores.map {
let userReactionIDs = Set(content.currentUserReactions.map(\.type))
return ChatMessageReactionData(
type: $0.key,
score: $0.value,
isChosenByCurrentUser: userReactionIDs.contains($0.key)
)
}
.sorted(by: components.reactionsSorting)
Does it mean I could load reactions from ChatMessage.reactionScores
?
Can you elaborate a bit?
from stream-chat-swift.
Hi @borut-t, each message has reactionScores
and reactionCounts
which might be enough for you. But if you want to have the full details of the reactions, like for example the author, you will need to use loadReactions
and loadNextReactions
. Usually reactionScores
and reactionCounts
is enough to display the data in the message list. But if you want the full details, usually you tap on the reactions and it opens a detail view containing all info of the reaction, like the author etc...
from stream-chat-swift.
Hi @nuno-vieira. Thanks for the feedback!
The thing is that you have a limitation of 30 characters for the MessageReactionType
rawValue. And this blocks me from storing emoji names since the length can easily surpass this limitation. I cannot store the unicode value either since no special characters are allowed.
let emoji = 😅
let emojiUnicode = "\u{0001F605}" // not allowed for rawValue
let emojiName = "SMILING FACE WITH OPEN MOUTH AND COLD SWEAT" // too long for rawValue
I have tried with a hashing function but with this approach using reactionsScores
I don't have access to the extraData
.
What would you suggest in this case?
from stream-chat-swift.
Hi @borut-t, I think for now your only option might be using the code inside \u{XXXXXX}
, and then in your application, you wrap it with \u{}
. If that is not enough for you for some reason, you might need to open a ticket on support to request this change in the backend.
Best,
Nuno
from stream-chat-swift.
I've managed to make this work exactly like that. Now everything works. One issue is still not solvable with this approach and that is the sorting. We are now sorting based on the ChatReactionType. Not optimal, but not a big issue.
Thanks @nuno-vieira for all your help 🙌
from stream-chat-swift.
Related Issues (20)
- Showing Translated Message After Delete The Message HOT 1
- Does ChatChannelController.loadPreviousMessages has a maximum pageSize? HOT 4
- 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
- See Original and Translated Message HOT 6
- 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
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.