From 85ca98c0e387be4428d8a161b0a051af63fffa80 Mon Sep 17 00:00:00 2001 From: Brandon Date: Fri, 15 Nov 2019 16:00:59 -0500 Subject: [PATCH] Fix #1963, #1964 - Icon not showing in the URL bar and alignment being far off --- Client/Frontend/Browser/BrowserViewController.swift | 4 ++-- .../Onboarding/OnboardingWebViewController.swift | 9 ++++++--- .../Browser/Toolbars/UrlBar/TabLocationView.swift | 13 ++++++------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Client/Frontend/Browser/BrowserViewController.swift b/Client/Frontend/Browser/BrowserViewController.swift index a59d9939154..ad728d08829 100644 --- a/Client/Frontend/Browser/BrowserViewController.swift +++ b/Client/Frontend/Browser/BrowserViewController.swift @@ -1256,9 +1256,9 @@ class BrowserViewController: UIViewController { } tab.contentIsSecure = false - topToolbar.contentIsSecure = tab.contentIsSecure - + guard let serverTrust = tab.webView?.serverTrust else { + topToolbar.contentIsSecure = tab.contentIsSecure break } diff --git a/Client/Frontend/Browser/Onboarding/OnboardingWebViewController.swift b/Client/Frontend/Browser/Onboarding/OnboardingWebViewController.swift index 3824d6de70a..6095220cebc 100644 --- a/Client/Frontend/Browser/Onboarding/OnboardingWebViewController.swift +++ b/Client/Frontend/Browser/Onboarding/OnboardingWebViewController.swift @@ -112,9 +112,12 @@ class OnboardingWebViewController: UIViewController, WKNavigationDelegate { if let trust = webView.serverTrust { toolbar.secureIcon.isHidden = false - let x509 = SecPolicyCreateBasicX509() - let sslPolicy = SecPolicyCreateSSL(true, (webView.url?.host ?? "") as CFString) - SecTrustSetPolicies(trust, [x509, sslPolicy] as CFTypeRef) + let policies = [ + SecPolicyCreateBasicX509(), + SecPolicyCreateSSL(true, webView.url?.host as CFString?) + ] + + SecTrustSetPolicies(trust, policies as CFTypeRef) var result: SecTrustResultType = .invalid SecTrustEvaluate(trust, &result) diff --git a/Client/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift b/Client/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift index fa74748c63a..c986409008b 100644 --- a/Client/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift +++ b/Client/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift @@ -74,11 +74,10 @@ class TabLocationView: UIView { } private func updateLockImageView() { - let wasHidden = lockImageView.isHidden - lockImageView.isHidden = !contentIsSecure - - if wasHidden != lockImageView.isHidden { - UIAccessibility.post(notification: .layoutChanged, argument: nil) + if contentIsSecure { + lockImageView.tintColor = #colorLiteral(red: 0, green: 0.6860338449, blue: 0, alpha: 1) + } else { + lockImageView.tintColor = .red } } @@ -138,7 +137,7 @@ class TabLocationView: UIView { fileprivate lazy var lockImageView: UIImageView = { let lockImageView = UIImageView(image: #imageLiteral(resourceName: "lock_verified").template) - lockImageView.isHidden = true // Hidden by default + lockImageView.isHidden = false lockImageView.tintColor = #colorLiteral(red: 0.3764705882, green: 0.3843137255, blue: 0.4, alpha: 1) lockImageView.isAccessibilityElement = true lockImageView.contentMode = .center @@ -400,7 +399,7 @@ extension TabLocationView: TabEventHandler { class DisplayTextField: UITextField { weak var accessibilityActionsSource: AccessibilityActionsSource? var hostString: String = "" - let pathPadding: CGFloat = 20.0 + let pathPadding: CGFloat = 5.0 override var accessibilityCustomActions: [UIAccessibilityCustomAction]? { get {