Skip to content

Commit

Permalink
fix: checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannisj committed Nov 12, 2024
1 parent 5579034 commit d3378de
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions PostHog/PostHogSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,7 @@ let maxRetryDelay = 30.0

let isIdentified = storageManager.isIdentified()

let hasDistinctIdChanges = distinctId != oldDistinctId && !isIdentified
let hasUserPropertyChanges = !(userProperties?.isEmpty ?? true) || !(userPropertiesSetOnce?.isEmpty ?? true)

if hasDistinctIdChanges {
if distinctId != oldDistinctId && !isIdentified {
// We keep the AnonymousId to be used by decide calls and identify to link the previousId
storageManager.setAnonymousId(oldDistinctId)
storageManager.setDistinctId(distinctId)
Expand All @@ -493,7 +490,7 @@ let maxRetryDelay = 30.0
if shouldReloadFlagsForTesting {
reloadFeatureFlags()
}
} else if hasUserPropertyChanges {
} else if !(userProperties?.isEmpty ?? true) || !(userPropertiesSetOnce?.isEmpty ?? true) {
capture("$set",
distinctId: distinctId,
userProperties: userProperties,
Expand Down

0 comments on commit d3378de

Please sign in to comment.