Skip to content

Auto-connect and register push device for guest users#1707

Open
aleksandar-apostolov wants to merge 1 commit into
aleksandarapostolov/and-1202-adopt-response-userfrom
aleksandarapostolov/and-1202-auto-connect-guest-builder
Open

Auto-connect and register push device for guest users#1707
aleksandar-apostolov wants to merge 1 commit into
aleksandarapostolov/and-1202-adopt-response-userfrom
aleksandarapostolov/and-1202-auto-connect-guest-builder

Conversation

@aleksandar-apostolov
Copy link
Copy Markdown
Contributor

@aleksandar-apostolov aleksandar-apostolov commented Jun 4, 2026

Stacked on #1704. Merge after parent.

Goal

Refs AND-1202StreamVideoBuilder previously ran auto-register-push and auto-connect only for UserType.Authenticated. Guest integrators had to write the same boilerplate (manual registerPushDevice + connect() after build) — boilerplate iOS and JS SDKs don't require.

Third behavior gap in the guest-mode series, stacked above #1703 (race fix) and #1704 (response.user adoption). Both are functional prerequisites: registerPushDevice() and connectAsync() await guestUserJob, which only works correctly with #1703.

Implementation

  • StreamVideoBuilder.build(): widen the gate at the auto-register/auto-connect block to UserType.Authenticated || UserType.Guest. Anonymous still excluded (no identity to register against).
  • Both inner branches (autoRegisterPushDevice and connectOnInit) remain integrator-opt-out — Guest users can still set either flag to false to keep manual control of either path.

Testing

  • No dedicated unit test added. The change is a one-line widening of an existing condition; the methods it now invokes for Guest (StreamVideoClient.connectAsync(), StreamNotificationManager.registerPushDevice()) already have regression coverage in StreamVideoClientTest (added by Wait for guest user setup before firing authenticated API calls #1703) and the existing notification-manager tests. StreamVideoBuilderTest is @Ignored at class level for full builds (run via isolatedTest), so a direct gate test would duplicate the existing isolated coverage without unique signal.
  • End-to-end functional verification on device pending — smoke test on a Guest build with default config recommended before lifting from Draft.

Summary by CodeRabbit

  • New Features
    • Guest users now automatically receive push notifications and WebSocket connection support, matching the capabilities previously available only to authenticated users.

StreamVideoBuilder previously only ran the auto-register-push and
auto-connect block for UserType.Authenticated. Guest users fell through,
forcing every Guest integrator to write the same boilerplate (manual
registerPushDevice + connect after build) — boilerplate the iOS and JS
SDKs don't require.

Widen the gate to include UserType.Guest. registerPushDevice() and
connectAsync() inside StreamVideoClient already await guestUserJob, so
both are safe to fire from the builder block before /video/guest
completes. Anonymous users still don't have an identity to register a
device against, so they remain excluded.

AND-1202
@aleksandar-apostolov aleksandar-apostolov added the pr:improvement Enhances an existing feature or code label Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@aleksandar-apostolov aleksandar-apostolov marked this pull request as ready for review June 4, 2026 09:13
@aleksandar-apostolov aleksandar-apostolov requested a review from a team as a code owner June 4, 2026 09:13
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.21 MB 12.21 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.68 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.28 MB 6.28 MB 0.00 MB 🟢

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 26cda442-c376-4e9c-80ec-80c5b54a1802

📥 Commits

Reviewing files that changed from the base of the PR and between 63ccca2 and 0dac4e4.

📒 Files selected for processing (1)
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoBuilder.kt

Walkthrough

StreamVideoBuilder.build() now triggers push device registration and WebSocket coordinator connection for both Authenticated and Guest users. Previously, these operations only executed for Authenticated users. Documentation clarifies that Guest user setup occurs asynchronously within StreamVideoClient, and both downstream methods already handle the necessary wait.

Changes

Guest User Initialization Flow

Layer / File(s) Summary
Guest user push and connection initialization
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoBuilder.kt
Push registration and WebSocket connection setup gates are broadened from authenticated-only to authenticated-or-guest, enabling both user types to initialize these services; comment updates document the asynchronous Guest flow and existing wait guarantees in downstream methods.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A rabbit hops through guest halls bright,
No longer left to shadow's night,
With push and sockets, side by side,
Both auth and guest may now confide. 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: auto-connecting and push device registration now applies to guest users, which is the primary focus of this PR.
Description check ✅ Passed The description includes Goal (with issue reference), Implementation details, and Testing rationale. While UI Changes and some checklist items are omitted (not applicable to this backend/core change), the core required sections are complete and well-documented.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aleksandarapostolov/and-1202-auto-connect-guest-builder

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 4, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Enhances an existing feature or code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant