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

Twitter: Broadcast twitter add / remove like and notify user when their tweet is liked #1022

Merged

Conversation

BackSH00TER
Copy link
Contributor

@BackSH00TER BackSH00TER commented Jul 14, 2023

Pull Request Description
Problem:
When a tweet is liked or a like is removed from a tweet, other users do not see the tweet count changing. A user only sees the count change locally from their own like/remove like.

This PR solves this problem by broadcasting the add/remove like to all players so that the counts are accurately reflected on all clients and are kept up to date.

  • updated localToggleLike to only handle toggling the isLiked field
  • added updateTweetLikes that is received on all clients to update the likes count by incrementing or decrementing depending on if the like was added/removed

Additionally this PR adds a notification when a user's tweet is liked. Notifications will only show if the user is not currently looking at the twitter app.
image

Demo: https://clipchamp.com/watch/sEdY6bgbSMa

Note: The notification playSound relies on the change presented in this PR: #1023

Pull Request Checklist:

  • Have you followed the guidelines in our Contributing document and Code of Conduct?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you built and tested NPWD in-game after the relevant change?
    • Built and tested with multiple players simultaneously liking/unliking many posts back to back and the numbers all reflected correctly and updated in real time.

@itschip itschip merged commit a853c8e into project-error:master Jul 15, 2023
@BackSH00TER BackSH00TER deleted the twitter-like-notifications branch July 20, 2023 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants