Skip to content

feat(rokt): add setSession/getSession with optional sessionToken - #816

Open
jaissica12 wants to merge 5 commits into
mainfrom
feature/rokt-session-token-handoff
Open

feat(rokt): add setSession/getSession with optional sessionToken#816
jaissica12 wants to merge 5 commits into
mainfrom
feature/rokt-session-token-handoff

Conversation

@jaissica12

@jaissica12 jaissica12 commented Aug 18, 2026

Copy link
Copy Markdown

Background

  • Expose MPRoktSession handoff (id + optional JWT) for native ↔ WebView continuity, matching Web launcherOptions. Kit seeds Rokt.setSession when a token is present and falls back to setSessionId for id-only.

What Has Changed

  • Added MPRoktSession (sessionId, optional sessionToken, optional expiresAt) and public -[MPRokt setSession:] / -[MPRokt getSession], matching Web launcherOptions.
  • Kit forwarding: non-empty id + token → +[Rokt setSession:]; id only → setSessionId; empty id is ignored. Token without id is ignored.
  • Deprecated setSessionId / getSessionId in favor of the new APIs.
  • Bumped the Rokt kit to Rokt-Widget ~> 5.4.0 (Package.swift from: "5.4.0") so native setSession / getSession compile and run.

Screenshots/Video

  • {Include any screenshots or video demonstrating the new feature or fix, if applicable}

Checklist

  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have tested this locally.

Additional Notes

  • {Any additional information or context relevant to this PR}

Reference Issue (For employees only. Ignore if you are an outside contributor)

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

📦 SDK Size Impact Report

Measures how much the SDK adds to an app's size (with-SDK minus without-SDK).

Metric Target Branch This PR Change
App Bundle Impact 1.79 MB 1.81 MB +16 KB
Executable Impact 848 bytes 848 bytes +N/A
XCFramework Size 6.49 MB 6.52 MB +28 KB

➡️ SDK size impact change is minimal.

Raw measurements

Target branch (main):

{"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1920,"with_sdk_executable_size_bytes":76312,"sdk_impact_kb":1836,"sdk_executable_impact_bytes":848,"xcframework_size_kb":6648}

This PR:

{"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1936,"with_sdk_executable_size_bytes":76312,"sdk_impact_kb":1852,"sdk_executable_impact_bytes":848,"xcframework_size_kb":6676}

@jaissica12
jaissica12 marked this pull request as ready for review August 19, 2026 15:10
@jaissica12
jaissica12 requested a review from a team as a code owner August 19, 2026 15:10
@cursor

cursor Bot commented Aug 19, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Public Rokt API plus kit forwarding of session JWTs used as Bearer credentials; ordering of setSession vs selectPlacements is load-bearing. Example-only WebView code is not production-critical.

Overview
Adds native ↔ WebView Rokt session handoff via a new public MPRoktSession (id, optional JWT, optional expiry) and -[MPRokt setSession:] / getSession, matching Web launcherOptions.

The kit seeds +[Rokt setSession:] when id + token are present, falls back to setSessionId for id-only, and ignores empty ids. setSessionId / getSessionId are deprecated. Forwards run on the message queue so setSession stays ordered before selectPlacements. Requires Rokt-Widget ~> 5.4.0.

The example app can inspect the native session and open a WKWebView that injects it into the Web SDK, then post it back to native.

Reviewed by Cursor Bugbot for commit 159df3a. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread Example/mParticleExample/rokt-hybrid.html
@jaissica12
jaissica12 marked this pull request as draft August 20, 2026 19:29
jaissica12 and others added 3 commits August 21, 2026 14:07
Expose MPRoktSession handoff (id + optional JWT) for native ↔ WebView
continuity, matching Web launcherOptions. Kit seeds Rokt.setSession when
a token is present and falls back to setSessionId for id-only.
@BrandonStalnaker
BrandonStalnaker force-pushed the feature/rokt-session-token-handoff branch from fc31e6f to bd05c1a Compare August 21, 2026 18:58
@BrandonStalnaker BrandonStalnaker self-assigned this Aug 21, 2026
@BrandonStalnaker
BrandonStalnaker marked this pull request as ready for review August 21, 2026 18:58

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fea736b. Configure here.

Comment thread mParticle-Apple-SDK/MPRokt.m
Keep native WebView handoff ordered so the session is seeded before the next placement forward.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants