Skip to content
New issue

Have a question about this project? 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

[Reactions v2] New reactions query endpoint #3167

Merged
merged 13 commits into from Apr 30, 2024

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Apr 24, 2024

🔗 Issue Links

Resolves https://github.com/GetStream/ios-issues-tracking/issues/787

🎯 Goal

Adds the new reactions v2 query endpoint to be able to filter reactions based on type and author.

📝 Summary

  • Adds new ChatReactionListController
  • Adds new Slack Reactions List View to the Slack Example app

🛠 Implementation

Creates a new ChatReactionListController to follow the SDK pattern, where each query endpoint represents a controller.

TODO:

  • Everything is tested besides the ReactionListController.
  • Website docs for the new reaction list controller

🎨 Showcase

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2024-04-26.at.21.58.36.mp4

🧪 Manual Testing Notes

Note: Backend user enrichment is not working on the new query reactions endpoint. So this is not testable until it is fixed on the backend.

  1. Open the Slack Example App
  2. Go to a channel
  3. Long press on a reaction
  4. It should show only the reactions of that type.

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change follows zero ⚠️ policy (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (docusaurus, tutorial, CMS)

@nuno-vieira nuno-vieira changed the title Add/new reactions v2 query endpoint [Reactions v2] New reactions query endpoint Apr 24, 2024
Copy link

github-actions bot commented Apr 24, 2024

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@nuno-vieira nuno-vieira added ✅ Feature An issue or PR related to a feature 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK labels Apr 24, 2024
@nuno-vieira nuno-vieira force-pushed the add/new-reactions-v2-query-endpoint branch from e719621 to 83ec4ff Compare April 26, 2024 20:46
@nuno-vieira nuno-vieira marked this pull request as ready for review April 26, 2024 20:56
@nuno-vieira nuno-vieira requested a review from a team as a code owner April 26, 2024 20:56
@Stream-iOS-Bot
Copy link
Collaborator

StreamChat XCMetrics

target metric benchmark branch performance status
MessageList Hitches total duration 10 ms 2.5 ms 75.0% 🔼 🟢
Duration 2.6 s 2.55 s 1.92% 🔼 🟢
Hitch time ratio 4 ms per s 0.99 ms per s 75.25% 🔼 🟢
Frame rate 79 fps 78.39 fps 0.77% 🔼 🟢
Number of hitches 1 0.2 80.0% 🔼 🟢
ChannelList Hitches total duration 12.5 ms 16.69 ms -33.52% 🔽 🔴
Duration 2.6 s 0.82 s 68.46% 🔼 🟢
Hitch time ratio 5 ms per s 20.51 ms per s -310.2% 🔽 🔴
Frame rate 76 fps 63.2 fps 16.84% 🔼 🟢
Number of hitches 1.2 0.8 33.33% 🔼 🟢


override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let reaction = reactions[indexPath.row]
let cell = UITableViewCell(style: .value1, reuseIdentifier: "slack-reaction-cell")
Copy link
Contributor

@laevandus laevandus Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a sample app, but just wondering why it was not using dequeueReusableCell(withIdentifier:for:). Not that it makes a huge difference here. I guess because there are only a couple of cells so it does not matter. Just thinking out aloud, feel free to ignore.


import CoreData

class ReactionListUpdater: Worker {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking if we should keep it next to the old load reactions method in MessageUpdater.

// At the moment, we do not allow changing the query sorting.
request.sortDescriptors = [.init(key: #keyPath(MessageReactionDTO.createdAt), ascending: false)]

let messageIdPredicate = NSPredicate(format: "message.id == %@", query.messageId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was a nasty bug here - the message id wasn't used in the predicate. Therefore, whenever a reaction type was present, it showed all the reactions for all messages.

@testableapple testableapple added the 🟢 QAed A PR that was QAed label Apr 29, 2024
Copy link

sonarcloud bot commented Apr 30, 2024

@martinmitrevski martinmitrevski merged commit e8c9b9e into develop Apr 30, 2024
15 of 16 checks passed
@martinmitrevski martinmitrevski deleted the add/new-reactions-v2-query-endpoint branch April 30, 2024 05:31
@testableapple testableapple mentioned this pull request Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Feature An issue or PR related to a feature 🟢 QAed A PR that was QAed 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants