Skip to content

Commit

Permalink
not logging when an idenfier is nil during set profile
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaysubra committed Apr 3, 2024
1 parent e323a92 commit 9b688f3
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions Sources/KlaviyoSwift/KlaviyoState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,28 @@ struct KlaviyoState: Equatable, Codable {
}

mutating func updateStateWithProfile(profile: Profile) {
if let profileEmail = profile.email, !profileEmail.isEmpty, profileEmail != email {
email = profileEmail
} else {
logDevWarning(for: "email")
if let profileEmail = profile.email {
if !profileEmail.isEmpty, profileEmail != email {
email = profileEmail
} else {
logDevWarning(for: "email")
}
}

if let profilePhoneNumber = profile.phoneNumber, !profilePhoneNumber.isEmpty, profilePhoneNumber != phoneNumber {
phoneNumber = profilePhoneNumber
} else {
logDevWarning(for: "phone number")
if let profilePhoneNumber = profile.phoneNumber {
if !profilePhoneNumber.isEmpty, profilePhoneNumber != phoneNumber {
phoneNumber = profilePhoneNumber
} else {
logDevWarning(for: "phone number")
}
}

if let profileExternalId = profile.externalId, !profileExternalId.isEmpty, profileExternalId != externalId {
externalId = profileExternalId
} else {
logDevWarning(for: "external id")
if let profileExternalId = profile.externalId {
if !profileExternalId.isEmpty, profileExternalId != externalId {
externalId = profileExternalId
} else {
logDevWarning(for: "external id")
}
}
}

Expand Down

0 comments on commit 9b688f3

Please sign in to comment.