Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed ome search results not opening issue (#415)

  • Loading branch information
pavel-cliqz committed Aug 1, 2019
1 parent 76a1b36 commit 81518a3f0012ded8969cebbccb819c8b0fd9b79a
Showing with 14 additions and 1 deletion.
  1. +14 −1 Cliqz/Search/CliqzSearchViewController.swift
@@ -251,7 +251,20 @@ class CliqzSearchViewController : UIViewController, KeyboardHelperDelegate, UIAl
extension CliqzSearchViewController { extension CliqzSearchViewController {


@objc func didSelectUrl(_ notification: Notification) { @objc func didSelectUrl(_ notification: Notification) {
if let url_str = notification.object as? NSString, let url = URL(string: url_str as String) { // ReactNative is not sending encoded URL always, so for that we should have fall back mechanism
guard let url_str = notification.object as? String else {
return
}
var url: URL?

if let selectedUrl = URL(string: url_str) {
url = selectedUrl
} else if let encodedString = url_str.addingPercentEncoding(
withAllowedCharacters: NSCharacterSet.urlFragmentAllowed) {
url = URL(string: encodedString)
}

if let url = url {
#if PAID #if PAID
let isSearchEngine = notification.userInfo?[OpenURLIsSearchEngineKey] as? Bool let isSearchEngine = notification.userInfo?[OpenURLIsSearchEngineKey] as? Bool
if UserPreferences.instance.shouldShowNonPrivateSearchWarningMessage, isSearchEngine ?? false { if UserPreferences.instance.shouldShowNonPrivateSearchWarningMessage, isSearchEngine ?? false {

0 comments on commit 81518a3

Please sign in to comment.