Repository navigation
Release 1.4.1 #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release 1.4.1 #53
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -348,7 +348,7 @@ extension AnalyticsPublisher: AnalyticsPublishing { | |
| * | ||
| * Routing order: | ||
| * 1. Drop while the app is not active. | ||
| * 2. Ignore unchanged identifies and cache pending user updates. | ||
| * 2. Cache identify events as the pending user. | ||
| * 3. Hold in `initialQueue` until network readiness is known (NWPathMonitor is async). | ||
| * 4. Persist to local storage when the network is known unavailable. | ||
| * 5. Drop during socket shutdown. | ||
|
|
@@ -373,8 +373,8 @@ extension AnalyticsPublisher: AnalyticsPublishing { | |
| // Handle app state - drop events when app is not in active state | ||
| guard sessionMonitorer?.isAppActive ?? false else { return } | ||
|
|
||
| // Drop identify events that carry nothing new. Non-identify events skip this. | ||
| if event.isIdentifyEvent, didHandleIdentifyEvent(event) { return } | ||
| // Cache the pending user until the backend acknowledges the identify | ||
| if event.isIdentifyEvent { storage.temporaryUser = event.toUser().toJson() } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an app calls identify again with unchanged data, its ACK can queue a fake screen reload if a screen is active and the event queue is empty. Backend de-duplication cannot stop this extra client-side request. It sends another screen event and makes later events wait for its ACK. Avoid the reload when nothing about the user changed. |
||
|
|
||
| // Hold events while network monitor is still resolving initial state | ||
| if !networkMonitor.isReady { | ||
|
|
@@ -482,26 +482,6 @@ extension AnalyticsPublisher: AnalyticsPublishing { | |
| ) | ||
| } | ||
|
|
||
| /** | ||
| * Drops identify events that carry nothing new, and caches the pending user for the rest. | ||
| * | ||
| * - Parameter event: The identify event to handle | ||
| * - Returns: true if the event should be ignored, false if processing should continue | ||
| */ | ||
| private func didHandleIdentifyEvent(_ event: Event) -> Bool { | ||
| // A pending identify has not reached the backend yet, so a closed socket means | ||
| // `onSocketClosed` is replaying it, not a fresh host-app call. A replay must go through or | ||
| // the reconnect never re-identifies the user. | ||
| let isPendingReplay = storage.temporaryUser != nil && !socketManager.isSocketOpened | ||
| let carriesNoNewData = storage.user.isNotEmpty | ||
| && User.fromJson(storage.user).isSameIdentifyEvent(event: event) | ||
|
|
||
| let shouldIgnore = carriesNoNewData && !isPendingReplay | ||
| // Update temporary cached user in storage | ||
| if !shouldIgnore { storage.temporaryUser = event.toUser().toJson() } | ||
| return shouldIgnore | ||
| } | ||
|
|
||
| /** | ||
| * Handles events when socket is closed by attempting to open connection. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an identify with new properties is waiting for an ACK, a later identify with the old properties replaces
temporaryUser. If the app closes before either ACK, startup restores only the old properties and loses the pending update. Keep the newer pending data when saving another identify.