Skip to content

fix: clear persona state and hide status picker on sign out#1312

Merged
utkarshdalal merged 2 commits into
utkarshdalal:masterfrom
ben-pearson:fix/sign-out-persona-state
May 17, 2026
Merged

fix: clear persona state and hide status picker on sign out#1312
utkarshdalal merged 2 commits into
utkarshdalal:masterfrom
ben-pearson:fix/sign-out-persona-state

Conversation

@ben-pearson
Copy link
Copy Markdown
Contributor

@ben-pearson ben-pearson commented Apr 27, 2026

Description

When signing out of Steam via the system menu, the games list cleared correctly but the profile picture, account name, online status, and status picker dropdown remained visible with the previous user's data.

Screenshot_20260513-001933

(This is the view after I've signed out)

Root cause: SystemMenu seeds persona state once on composition from SteamService.localPersona and updates it via PersonaStateReceived events, but had no handler for SteamEvent.LoggedOut to clear it. Additionally, _localPersona in SteamService is an in-memory StateFlow not reset on logout, so if SystemMenu re-enters composition (e.g. after a game session), LaunchedEffect(Unit) would re-read the stale persona.

Changes:

  • SteamService.kt - reset _localPersona to SteamFriend() in performLogOffDuties, so the in-memory state matches the cleared preferences
  • SystemMenu.kt - add SteamEvent.LoggedOut handler to set persona = SteamFriend() (blank name, offline state, no avatar), matching the appearance when skipping login
  • SystemMenu.kt - gate the status picker click handler and dropdown arrow on SteamService.isLoggedIn, consistent with the existing pattern at line 613

Recording

trim.991ABAA0-2532-479B-9B6B-D62CC33BFA09.MOV

Type of Change

  • Bug fix

Checklist

  • If I have access to #code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.
  • This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
  • I have attached a recording of the change.
  • I have read and agree to the contribution guidelines in CONTRIBUTING.md.

Summary by cubic

Clear persona UI and close/hide the status picker on sign out so the System Menu doesn’t show the previous user’s avatar, name, or status. The menu now reflects the logged-out state immediately and after recomposition.

  • Bug Fixes
    • Reset _localPersona to SteamFriend() on logout in SteamService.
    • Handle SteamEvent.LoggedOut in SystemMenu to set persona = SteamFriend() and showStatusPicker = false.
    • Gate status picker click and chevron by SteamService.isLoggedIn so they’re hidden when logged out.

Written for commit 5330ac1. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Logout now fully clears cached profile/persona state to prevent stale info after signing out.
    • Profile controls (status picker and online indicator) are disabled and hidden appropriately when not signed in.
    • UI now listens for logout events so visible profile and status UI stay synchronized with authentication state.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

📝 Walkthrough

Walkthrough

The changes add logout-related persona state cleanup across the Steam service and UI layers. SteamService now resets its cached _localPersona during logout, and SystemMenu listens for SteamEvent.LoggedOut to clear displayed persona and hide the status picker, plus gating profile interactions by online + login state.

Changes

Cohort / File(s) Summary
SteamService logout cleanup
app/src/main/java/app/gamenative/service/SteamService.kt
Clears cached _localPersona by assigning a fresh SteamFriend() in performLogOffDuties during logout.
SystemMenu UI logout handling
app/src/main/java/app/gamenative/ui/screen/library/components/SystemMenu.kt
Subscribes to SteamEvent.LoggedOut to reset persona and close showStatusPicker; restricts profile click-to-toggle and dropdown indicator to !isOffline && SteamService.isLoggedIn.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • phobos665

Poem

🐰
A hop, a puff, the session's through,
I tidy up the friend I knew.
Fresh SteamFriend hops into place,
The menu closes—quiet space.
Rebooted paws, I skip with grace. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the primary changes: clearing persona state and hiding the status picker on sign out, directly matching the main objectives of this bug fix.
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.
Description check ✅ Passed Pull request description comprehensively addresses the template requirements with clear problem statement, root cause analysis, specific changes made, a video recording, bug fix classification, and all checklist items completed.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/src/main/java/app/gamenative/ui/screen/library/components/SystemMenu.kt`:
- Around line 286-288: onLoggedOut currently clears persona but doesn't close
the status picker, so update the onLoggedOut handler (the lambda assigned to
onLoggedOut) to also set showStatusPicker = false when clearing persona; this
ensures the DropdownMenu (which uses expanded = showStatusPicker) is collapsed
on logout and the status controls are fully hidden.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7b150687-08a3-463a-9523-05897a9a1395

📥 Commits

Reviewing files that changed from the base of the PR and between 2a236ef and e94f754.

📒 Files selected for processing (2)
  • app/src/main/java/app/gamenative/service/SteamService.kt
  • app/src/main/java/app/gamenative/ui/screen/library/components/SystemMenu.kt

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/main/java/app/gamenative/ui/screen/library/components/SystemMenu.kt">

<violation number="1" location="app/src/main/java/app/gamenative/ui/screen/library/components/SystemMenu.kt:287">
P2: Logout handler does not clear `showStatusPicker`, so the status dropdown can remain open after sign-out.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@utkarshdalal utkarshdalal merged commit 22d2299 into utkarshdalal:master May 17, 2026
3 checks passed
@utkarshdalal
Copy link
Copy Markdown
Owner

nice fix, thanks

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