Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

remove return user pixel #2146

Merged
merged 2 commits into from
Nov 14, 2023
Merged
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
4 changes: 0 additions & 4 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,6 @@ extension Pixel {
case remoteMessageSecondaryActionClicked
case remoteMessageSheet

// MARK: Return user measurement
case returnUser

// MARK: debug pixels
case dbCrashDetected

Expand Down Expand Up @@ -998,7 +995,6 @@ extension Pixel.Event {

case .compilationFailed: return "m_d_compilation_failed"
// MARK: - Return user measurement
case .returnUser: return "m_return_user"
case .debugReturnUserAddATB: return "m_debug_return_user_add_atb"
case .debugReturnUserReadATB: return "m_debug_return_user_read_atb"
case .debugReturnUserUpdateATB: return "m_debug_return_user_update_atb"
Expand Down
31 changes: 0 additions & 31 deletions Core/ReturnUserMeasurement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ class KeychainReturnUserMeasurement: ReturnUserMeasurement {
}

func installCompletedWithATB(_ atb: Atb) {
if let oldATB = readSecureATB() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should readSecureATB also be removed? I'm not seeing it called from anywhere anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I'll get rid

sendReturnUserMeasurement(oldATB, atb.version)
}
writeSecureATB(atb.version)
}

Expand Down Expand Up @@ -88,34 +85,6 @@ class KeychainReturnUserMeasurement: ReturnUserMeasurement {

}

private func readSecureATB() -> String? {
let query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrAccount as String: Self.SecureATBKeychainName,
kSecReturnData as String: kCFBooleanTrue!,
kSecMatchLimit as String: kSecMatchLimitOne
]

var dataTypeRef: AnyObject?
let status: OSStatus = SecItemCopyMatching(query as CFDictionary, &dataTypeRef)
if ![errSecSuccess, errSecItemNotFound].contains(status) {
fireDebugPixel(.debugReturnUserReadATB, errorCode: status)
}

if let data = dataTypeRef as? Data {
return String(data: data, encoding: .utf8)
}

return nil
}

private func sendReturnUserMeasurement(_ oldATB: String, _ newATB: String) {
Pixel.fire(pixel: .returnUser, withAdditionalParameters: [
PixelParameters.returnUserOldATB: oldATB,
PixelParameters.returnUserNewATB: newATB
])
}

private func fireDebugPixel(_ event: Pixel.Event, errorCode: OSStatus) {
Pixel.fire(pixel: event, withAdditionalParameters: [
PixelParameters.returnUserErrorCode: "\(errorCode)"
Expand Down