messages: add http prefix to ActiveLabel highlighted urls that lack one
Change-Id: Ic2c407c8aaf2d793e37e94094ebb261abe47ed39
Reviewed-by: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
diff --git a/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift b/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift
index 540dcb5..4be13ac 100644
--- a/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift
+++ b/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift
@@ -349,7 +349,10 @@
cell.messageLabel.enabledTypes = [.url]
cell.messageLabel.setTextWithLineSpacing(withText: messageVM.content, withLineSpacing: 2)
cell.messageLabel.handleURLTap { url in
- UIApplication.shared.openURL(url)
+ let urlString = url.absoluteString
+ if let prefixedUrl = URL(string: urlString.contains("http") ? urlString : "http://\(urlString)") {
+ UIApplication.shared.openURL(prefixedUrl)
+ }
}
cell.topCorner.isHidden = true