Skip to content
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 - Pixels #3779

Open
wants to merge 1 commit into
base: alessandro/malicious-site-protection-settings
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import Foundation
import Combine
import Core
import SwiftUI
import PixelKit
import MaliciousSiteProtection

final class MaliciousSiteProtectionSettingsViewModel: ObservableObject {
@Published var shouldShowMaliciousSiteProtectionSection = false
Expand Down Expand Up @@ -60,6 +62,6 @@ final class MaliciousSiteProtectionSettingsViewModel: ObservableObject {
private func updateMaliciousSiteProtection(enabled isEnabled: Bool) {
manager.isEnabled = isEnabled
isMaliciousSiteProtectionEnabled = isEnabled
PixelKit.fire(MaliciousSiteProtection.Event.settingToggled(to: isEnabled))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Core
import SpecialErrorPages
import WebKit
import MaliciousSiteProtection
import PixelKit

enum MaliciousSiteProtectionNavigationResult: Equatable {
case navigationHandled(NavigationType)
Expand Down Expand Up @@ -109,6 +110,7 @@ extension MaliciousSiteProtectionNavigationHandler: MaliciousSiteProtectionNavig
let response = MaliciousSiteDetectionNavigationResponse(navigationAction: navigationAction, errorData: errorData)
return .navigationHandled(.mainFrame(response))
} else {
PixelKit.fire(MaliciousSiteProtection.Event.iframeLoaded(category: threatKind))
// Extract the URL of the source frame (the iframe) that initiated the navigation action
let iFrameTopURL = navigationAction.sourceFrame.safeRequest?.url ?? url
let errorData = SpecialErrorData.maliciousSite(kind: threatKind, url: iFrameTopURL)
Expand Down Expand Up @@ -137,19 +139,19 @@ extension MaliciousSiteProtectionNavigationHandler: MaliciousSiteProtectionNavig
extension MaliciousSiteProtectionNavigationHandler: SpecialErrorPageActionHandler {

func visitSite(url: URL, errorData: SpecialErrorData) {
maliciousURLExemptions[url] = errorData.threatKind
bypassedMaliciousSiteThreatKind = errorData.threatKind
guard let threatKind = errorData.threatKind else {
assertionFailure("Error Data should have a threat kind")
return
}
maliciousURLExemptions[url] = threatKind
bypassedMaliciousSiteThreatKind = threatKind

// Fire Pixel
PixelKit.fire(MaliciousSiteProtection.Event.visitSite(category: threatKind))
}

func leaveSite() {
// Fire Pixel
}
func leaveSite() { }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double checking: No pixel and not implemented yet?


func advancedInfoPresented() {
// Fire Pixel
}
func advancedInfoPresented() { }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking: No pixel to send?


}

Expand Down
Loading