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.
[x] Have you followed the guidelines in our Contributing document and Code of Conduct?
[x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
[x] 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.
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.
localToggleLike
to only handle toggling theisLiked
fieldupdateTweetLikes
that is received on all clients to update thelikes
count by incrementing or decrementing depending on if the like was added/removedAdditionally 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](https://github.com/project-error/npwd/assets/18689469/a150e4f2-b05f-4e07-9091-91a30c23e489)
Demo: https://clipchamp.com/watch/sEdY6bgbSMa
Note: The notification
playSound
relies on the change presented in this PR: https://github.com/project-error/npwd/pull/1023Pull Request Checklist: