-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Malicious site protection address bar and privacy dashboard changes #3718
base: alessandro/malicious-site-protection-navigation-detection-async
Are you sure you want to change the base?
Changes from all commits
83cb6f0
31282b9
b4d4dd0
bfe728f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Alert-Recolorable-24.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,20 @@ import UIKit | |
import Lottie | ||
|
||
enum PrivacyIcon { | ||
case daxLogo, shield, shieldWithDot | ||
case daxLogo, shield, shieldWithDot, alert | ||
|
||
fileprivate var staticImage: UIImage? { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why static? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not a great name if it raises questions. As There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe static makes sense in this context, even the imageView was named staticImageView. Let me know if you can think of a better name |
||
switch self { | ||
case .daxLogo: return UIImage(resource: .logoIcon) | ||
case .alert: return UIImage(resource: .alertColor24) | ||
default: return nil | ||
} | ||
} | ||
} | ||
|
||
class PrivacyIconView: UIView { | ||
|
||
@IBOutlet var daxLogoImageView: UIImageView! | ||
@IBOutlet var staticImageView: UIImageView! | ||
@IBOutlet var staticShieldAnimationView: LottieAnimationView! | ||
@IBOutlet var staticShieldDotAnimationView: LottieAnimationView! | ||
|
||
|
@@ -91,16 +99,17 @@ class PrivacyIconView: UIView { | |
|
||
private func updateShieldImageView(for icon: PrivacyIcon) { | ||
switch icon { | ||
case .daxLogo: | ||
daxLogoImageView.isHidden = false | ||
case .daxLogo, .alert: | ||
staticImageView.isHidden = false | ||
staticImageView.image = icon.staticImage | ||
staticShieldAnimationView.isHidden = true | ||
staticShieldDotAnimationView.isHidden = true | ||
case .shield: | ||
daxLogoImageView.isHidden = true | ||
staticImageView.isHidden = true | ||
staticShieldAnimationView.isHidden = false | ||
staticShieldDotAnimationView.isHidden = true | ||
case .shieldWithDot: | ||
daxLogoImageView.isHidden = true | ||
staticImageView.isHidden = true | ||
staticShieldAnimationView.isHidden = true | ||
staticShieldDotAnimationView.isHidden = false | ||
} | ||
|
@@ -116,6 +125,10 @@ class PrivacyIconView: UIView { | |
accessibilityLabel = UserText.privacyIconShield | ||
accessibilityHint = UserText.privacyIconOpenDashboardHint | ||
accessibilityTraits = .button | ||
case .alert: | ||
accessibilityLabel = UserText.privacyIconShield | ||
accessibilityHint = UserText.privacyIconOpenDashboardHint | ||
accessibilityTraits = .button | ||
} | ||
} | ||
|
||
|
@@ -134,7 +147,7 @@ class PrivacyIconView: UIView { | |
|
||
staticShieldAnimationView.isHidden = true | ||
staticShieldDotAnimationView.isHidden = true | ||
daxLogoImageView.isHidden = true | ||
staticImageView.isHidden = true | ||
} | ||
|
||
func shieldAnimationView(for icon: PrivacyIcon) -> LottieAnimationView? { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// SpecialErrorPageThreatProvider.swift | ||
// DuckDuckGo | ||
// | ||
// Copyright © 2024 DuckDuckGo. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Foundation | ||
import MaliciousSiteProtection | ||
|
||
protocol SpecialErrorPageThreatProvider: AnyObject { | ||
/// Provides the current threat kind detected. | ||
/// | ||
/// - Returns: An optional `ThreatKind` that indicates the current threat type, or `nil` if no threat is detected. | ||
@MainActor | ||
var currentThreatKind: ThreatKind? { get } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1060,6 +1060,7 @@ class TabViewController: UIViewController { | |
let privacyInfo = PrivacyInfo(url: url, | ||
parentEntity: entity, | ||
protectionStatus: makeProtectionStatus(for: host), | ||
malicousSiteThreatKind: specialErrorPageNavigationHandler.currentThreatKind, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo; malicous There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mind if I do this fix as a separate PR? I noticed it's an existing typo made in few different places. I will fix it in BSK and then make a PR for iOS and macOS. But because this PR is pointing at specific branch for privacy dashboard it’s a bit tricky to do this fix unless I merge that one first. As I’m merging this PR in my main feature branch there are no issues to merge the PR pointing at that branch. I will ensure it points at exact version before ship review. |
||
shouldCheckServerTrust: shouldCheckServerTrust) | ||
let isValid = certificateTrustEvaluator.evaluateCertificateTrust(trust: webView.serverTrust) | ||
if let isValid { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does it look like for ssl error page now? I remember decision was not to show any icon, are we good there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this change we didn’t show any icon. We agreed to show the same icon for the special error pages, SSL included.