Skip to content

Commit

Permalink
remove return user pixel (#2146)
Browse files Browse the repository at this point in the history
  • Loading branch information
brindy authored Nov 14, 2023
1 parent 84406b0 commit ba86fce
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
4 changes: 0 additions & 4 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,6 @@ extension Pixel {
case remoteMessageSecondaryActionClicked
case remoteMessageSheet

// MARK: Return user measurement
case returnUser

// MARK: debug pixels
case dbCrashDetected

Expand Down Expand Up @@ -1003,7 +1000,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() {
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

0 comments on commit ba86fce

Please sign in to comment.