"Autocomplete" to suggest fixes for invalid UserId's
Whenever we need to validate a UserId
, it would be nice if we could also help the user out when they get it slightly wrong. Especially when Matrix user id's are in such an unfamiliar format to most normal people.
This is one of the first things that Eron tends to try on a new build -- input "eron" or "michael" and see what it does. It would be good if we could pass that test the first time around.
What if we created a sort of "autocomplete" for UserId
's? Sort of like the batch of heuristics in https://gitlab.futo.org/circles/circles-ios/-/blob/main/Circles/Views/Login/WelcomeScreen.swift#L39
- If the user forgot the
@
, add it - If the user forgot a domain (and port?), add the same one as on our own
UserId
- If the user entered an email address, translate it to a Matrix userid for them
Unfortunately this can't be a static function because it needs runtime state (our currently logged-in domain). So maybe it could be an instance function on the Session
or UserId
.
Then once we have that "autocomplete" function, we could use it to suggest a solution to the user, ie by popping up a ConfirmationDialog
to say "Did you mean @bob:example.com
?"
(Copied from circles-ios#112 (closed) )