Currently we’re trying to implement Follow with Amity SDK on our UGC profile page
Example: Whynottravel | Creator Profile at TrueID In-Trend
Here are our use cases
- When both non logged in & logged in user visit the page, the following & followers count should show up.
- Our site can’t know at the first load that user already logged in or not, need to wait for a moment. so on the first load page will be non logged in user.
Non Logged In
- When non logged in user visit the page, Follow Button should show as “Follow” (If user click at follow button, login modal will show up).
- If logged in user already followed the creator in the profile page, Follow Button should show as “Following”
- Logged in user should be able to click to Follow/Unfollow.
So here’re the way we decided to do
- At the first load page, we generate random string and registerSession with that randomString, so the page can load followings/followers count, and It’ll get for the count.
- After 1-2 secs our site will know if there’s logged in user or not. In-case there’s logged in user, so our site will do log-in automatically. then our site will unregisterSession the generatedString. then it’ll registerSession with correct userId (ssoid)
- After registered with correct userId, our site will try to check if logged in user is following the creator on the page.
Here are the problems we found
- After we tried to check if logged in user is following the creator on the page, sometimes it checked with generated string user, not correct userId. even if we already unregistered generated string.
- We tried to log and it showed that registerSession with correct userId is success (connectionStatus = ‘connected’). But after we click to follow user, it showed that generated string user make follow request to user on profile page. not correct userId make request to follow user.
This image shows step to register, unregister, querying data, receiving data
This image shows that the last query is check if generatedString is following 71657211.
But what it should be is, it should check if 21996792 is following 71657211. Because it tried to get follow status after registered 21996792.
Any idea about this?