Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mention users with "@" in app like Instagram

I am creating an app that has photo sharing, and I am trying to add in the functionality to mention (or tag) users. Twitter is what originally starting using "@" with a username to tag users but now everything from Facebook to Instagram is using it. Is this something that is implemented on the iOS side or in the back end? I am currently programming the back end in Django, but for some reason I think this would be accomplished on the iOS end. There is surprisingly very little information out their on how to mention users in either Django or iOS.

Basically, when creating a post, I'd like to create a user mention by typing "@" followed by a username (with no spaces between) which would display their name in the post like this: @username which would be clickable, leading back to that user's profile. If I am unclear in any way with my question please let me know. Any help, such as pointing me in the right direction of where to start with something like this, would be much appreciated. Thanks! :)

like image 765
Alexander Perri Avatar asked Oct 05 '22 23:10

Alexander Perri


1 Answers

Listen to the input on iOS. When the user types an @, followed by a character, make a call to an url on your server (/user/lookup/?username=joe for example) that routes to a view which looks up up users beginning with joe. Return it as json and display it in a dropdown.

Source: How to mention users with "@" in app like Instagram

like image 61
2 revs Avatar answered Oct 10 '22 03:10

2 revs