Search relays during mentions autocomplete
Issues covered
#1560
Description
This PR includes functionality for autocomplete to also search the query in the user's relay list . It contains the following changes:
- Refactors
AuthorListViewto useSearchController.
How to test
- Build the code.
- Tap post button at the bottom of the screen.
- Tap the @ button or type "@" into the textfield.
- Type in the search bar.
- Please check that Authors who weren't in Core Data before the AuthorListView opened are showing up in the list of results.
Screenshots/Video
Before:
https://github.com/user-attachments/assets/a31797af-91f7-45e7-914a-d9fa8a4bb2dd
After:
https://github.com/user-attachments/assets/a48e355f-84a7-401e-bb73-d3d2ed9acd3d
👀
👀
Thank you for the suggestions @mplorentz and thanks for pair programming with me on this @joshuatbrown
After refactoring the AuthorListView based on @mplorentz detailed suggestion, it works perfectly now.
@joshuatbrown, also suggested making the keyboard button show "search" instead of "return"; and also searching the query when the user clicks this button.
This has also been added by changing the return button's label in the "SearchBar" view.
👀
This looks great! One thing we discussed but I'm not sure how to handle: changing the SearchController's analytics tracking. It currently tracks "Discover Search Started", for example, when we're searching on the mentions screen. @mplorentz do you have a good sense of what we should track here? I'm assuming we want a new event along the lines of "Mentions Search Started", but I'm not sure if we also want an event comparable to the "Discover Search Displayed Author". I suppose so? Maybe call it "Mentions Search Selected Author"?
Aaah, thanks for bringing this up again. I totally forgot. I think Selected sounds like the user has selected an option. Looks like Linda created a new ticket for tracking mentions. But I feel we definitely need to differentiate the "Discover Search started" from the "Mentions search started" in this PR.
Oh good catch on the tracking. I agree that we shouldn't merge this if it's firing Discover Search Started from the mentions view, because that could mess up our production data.
Maybe we make a new enum called SearchLocation or something? And pass it into SearchController.init and then the Search controller can fire the right events?
Duplicating the existing events but replacing "Discover" with "Mentions" sounds good to me.
👀