element-hq / element-ios

A glossy Matrix collaboration client for iOS
https://element.io
Apache License 2.0
1.73k stars 490 forks source link

Riot iOS fails to linkify some known TLDs #2849

Open anoadragon453 opened 4 years ago

anoadragon453 commented 4 years ago

Riot iOS is failing to turn links like maunium.dev into a link. Is there a list of known TLDs somewhere that Riot iOS uses, and if so can we use a regex instead (or does Apple provide an API or this)? As otherwise we'll always be out of date as new TLDs come out.

Related: #772

SBiOSoftWhare commented 4 years ago

Message cells use UITextView that can detect automaticaly some data (like links) and convert them to URLs (see UITextView.dataDetectorTypes property documentation for more information). The Apple link detector does not detect every kind of links and unfortunately we can't set a custom data detector to the UITextView.

We have to manually detect custom links. To achieve this we plan to:

Note: Once it's all done it will also be possible to use UILabel instead of UITextView to display links. Handling tap gesture on it will be another subject.