Skip to content

Commit

Permalink
add note
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Nov 12, 2024
1 parent a5e6feb commit 0a6ad6b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions posthog/src/main/java/com/posthog/PostHog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,6 @@ public class PostHog private constructor(
config?.logger?.log("identify called with invalid anonymousId: $anonymousId.")
}

var shouldReloadFlags = false

if (previousDistinctId != distinctId && !isIdentified) {
// this has to be set before capture since this flag will be read during the event
// capture
Expand All @@ -580,24 +578,22 @@ public class PostHog private constructor(
config?.logger?.log("identify called with invalid former distinctId: $previousDistinctId.")
}
this.distinctId = distinctId
shouldReloadFlags = true

// only because of testing in isolation, this flag is always enabled
if (reloadFeatureFlags) {
reloadFeatureFlags()
}
} else if (userProperties?.isNotEmpty() == true || userPropertiesSetOnce?.isNotEmpty() == true) {
capture(
"\$set",
distinctId = distinctId,
userProperties = userProperties,
userPropertiesSetOnce = userPropertiesSetOnce,
)

shouldReloadFlags = true
// Note we don't reload flags on property changes as these get processed async
} else {
config?.logger?.log("already identified with id: $distinctId.")
}

// only because of testing in isolation, this flag(reloadFeatureFlags) is always enabled
if (shouldReloadFlags && reloadFeatureFlags) {
reloadFeatureFlags()
}
}

private fun hasPersonProcessing(): Boolean {
Expand Down

0 comments on commit 0a6ad6b

Please sign in to comment.