Repository navigation
feat: [SDK-5382] enqueue a session create when a new session starts - #2780
fadi-george wants to merge 22 commits into
Conversation
…is missing (#2759) Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: Cursor <cursoragent@cursor.com>
📊 Diff Coverage ReportDiff Coverage Report (Changed Lines Only)Gate: aggregate coverage on changed executable lines must be ≥ 80% (JaCoCo line data for lines touched in the diff). Changed Files Coverage
Overall (aggregate gate)18/18 touched executable lines covered (100.0% — requires ≥ 80%) |
…alidator (#2778) Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: Cursor <cursoragent@cursor.com>
abdulraqeeb33
left a comment
There was a problem hiding this comment.
Requesting changes.
A create is dropped when appId, onesignalId, or subscriptionId is null, and this only runs at session start. The subscription id is copied once there. A first launch usually focuses before the push subscription id exists, so that session is never created and nothing retries when the id arrives.
iOS #1770 enqueues and lets the executor hold until the ids exist. Enqueue here too, or retry when pushSubscriptionId is set. The tests currently assert the drop.
| val appId = config?.appId | ||
| val onesignalId = session.onesignalId | ||
| val subscriptionId = session.subscriptionId | ||
| if (appId == null || onesignalId == null || subscriptionId == null) { |
There was a problem hiding this comment.
This returns without enqueueing. The subscription id is often still null on the first focus, and nothing calls this again when it arrives, so the session never reaches the server. Hold the create until the ids exist, the way iOS #1770 does.
Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…2790) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…2791) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/time/ITime.kt # OneSignalSDK/onesignal/testhelpers/src/main/java/com/onesignal/mocks/MockHelper.kt
…rowing (#2788) Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…ntries (#2796) Co-authored-by: AR Abdul Azeez <abdul@onesignal.com> Co-authored-by: Cursor <cursoragent@cursor.com>
… token API is disabled (#2789) Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Fadi George <fadi-george@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…he SDK (#2795) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ationRepo Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eue rules Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the session uses the sessions API, enqueue a CreateSessionOperation with the start time and pinned IDs. Continuing within the session timeout sends none, and the legacy start path is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28dc94d to
09beba7
Compare
…y on session create Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Replaced by a PR against fadi/SDK-5378-android-persistent-queue-retry, since this one can't be retargeted out of its stack. |
Description
One Line Summary
When the sessions API flag is on, enqueue a
CreateSessionOperationwhen a new session starts.Details
Motivation
Part of the SDK Sessions stack (SDK-5382). New sessions need a
POST /apps/{app_id}/sessions, sent through the persistent queue added in #2794 (base of this one).Scope
SessionServiceenqueues oneCreateSessionOperationon the new-session path when the session's capturedusesSessionsApiis true. It carries the app ID, the session's local ID, the pinned OneSignal and push subscription IDs,start_time, and a new idempotency key.sessionFocusTimeout(30 s) continues the session and sends no create. Cold start still ends a persisted valid session before starting a new one.TrackSessionStartOperationis unchanged in both cases; turning off legacy reporting is SDK-5388.direct_attribution_id(SDK-5399), session end (SDK-5390).Testing
Unit testing
Added
SessionServiceTestscases: create fields when the flag is on, a new create and idempotency key per session, no create on resume within the timeout, cold start with a persisted valid session, no create when the flag is off, and no create without a push subscription ID.spotlessCheck,detekt,testDebugUnitTest, andassembleReleasepass locally.Manual testing
Not tested on device yet; end-to-end verification is planned in the Android Rollout & QA ticket (SDK-5405).
Affected code checklist
Checklist
Overview
Testing
Final pass
🤖 Generated with Claude Code