I recently built a social media app for sharing audio. Everything is (almost) set up except for the likes, dislikes, and followers option. I set up the likes, so when the user clicks the thumbs up button, the like count adds one. Easy-peasy. Just like the dislikes and followers.
Here is where the problem starts.
A user clicks the like/dislike/follow button. The like count adds one. The user clicks it again. It adds another one. Is there some way to make it so that when the user clicks it, it adds one, but when that user clicks it again, it subtracts one?
I doubt what youâre asking for is possible right now with Adalo, so now you need to look for a workaround to the problem.
You probably need to move away from a +1 counter to making a collection (table) of votes and record the user ID with the vote. That might get you closer, but I donât think thereâs a âif uniqueâ type filter option in Adalo yet either.
So maybe you need to get creative from there still⌠Perhaps record a datetime of when the votes happened, and only count where user ID = x and date = most recent, something like that.
I wonder also if the visibility settings might allow you to disappear or replace the like button by using a greater than filter somehow.
Maybe youâd need to use the blank screen trick for that, so you do the like, then send to a blank screen where it updates a field, say âVoted = trueâ, then returns them to the previous screen but now the visibility settings can see the field you updated and see theyâve already voted, so it wonât display the like button or it will display it differently (greyed out, unlinked, etc)
I think Iâd start with the visibility settings and blank page trick first if I was you, seems like it gets you closest.
To my mind, may be youâre overcomplicating things here?
See tutorial here:
and here:
For the âFavoriteâ button, the thing which is not very clear in a tutorial, is that you need to create a âmany-to-manyâ relationship between User and Destination. And then with the help of Toggle component, this relationship could be set and un-set.
You will get the total count of likes by Current Destination â User relationship â Count.
Replace âFavoritesâ with âLikesâ and you will get the Likes system. If you would like to have âDislikesâ, you can just replicate the same logic.
I can do the video, but I think itâs already covered somewhere