mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
phishing alert implementation
we now check when building the string through the `AttributedStringBuilder` if a URL is actually hiding a different link, if so, we create a custom URL that contains both the external and the internal URL to advise the user through an Alert about the risk
This commit is contained in:
@@ -137,11 +137,14 @@ struct MessageText: UIViewRepresentable {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@available(iOS 17.0, *)
|
||||
func textView(_ textView: UITextView, menuConfigurationFor textItem: UITextItem, defaultMenu: UIMenu) -> UITextItem.MenuConfiguration? {
|
||||
switch textItem.content {
|
||||
case let .link(url):
|
||||
guard !url.requiresConfirmation else {
|
||||
return nil
|
||||
}
|
||||
// We don't want to show a URL preview for permalinks
|
||||
let isPermalink = parseMatrixEntityFrom(uri: url.absoluteString) != nil
|
||||
return .init(preview: isPermalink ? nil : .default, menu: defaultMenu)
|
||||
|
||||
Reference in New Issue
Block a user