Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit 81518a3

Browse files
authored
Fixed ome search results not opening issue (#415)
1 parent 76a1b36 commit 81518a3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Cliqz/Search/CliqzSearchViewController.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,20 @@ class CliqzSearchViewController : UIViewController, KeyboardHelperDelegate, UIAl
251251
extension CliqzSearchViewController {
252252

253253
@objc func didSelectUrl(_ notification: Notification) {
254-
if let url_str = notification.object as? NSString, let url = URL(string: url_str as String) {
254+
// ReactNative is not sending encoded URL always, so for that we should have fall back mechanism
255+
guard let url_str = notification.object as? String else {
256+
return
257+
}
258+
var url: URL?
259+
260+
if let selectedUrl = URL(string: url_str) {
261+
url = selectedUrl
262+
} else if let encodedString = url_str.addingPercentEncoding(
263+
withAllowedCharacters: NSCharacterSet.urlFragmentAllowed) {
264+
url = URL(string: encodedString)
265+
}
266+
267+
if let url = url {
255268
#if PAID
256269
let isSearchEngine = notification.userInfo?[OpenURLIsSearchEngineKey] as? Bool
257270
if UserPreferences.instance.shouldShowNonPrivateSearchWarningMessage, isSearchEngine ?? false {

0 commit comments

Comments
 (0)