Skip to content

Switcher revamp - #210

Open
Tektonikal wants to merge 3 commits into
mainfrom
switcher-revamp
Open

Tektonikal wants to merge 3 commits into
mainfrom
switcher-revamp

Conversation

@Tektonikal

Copy link
Copy Markdown
Contributor

Changes the drop-down account switcher on the title screen to be its own menu, loosely based on the one in the launcher.

PR's account switcher files were migrated from OneConfig's internal
theme API to the public OneConfigTheme API that main switched to.
Comment on lines +152 to +155
Row(
horizontalArrangement = Arrangement.Center,
modifier = Modifier.fillMaxWidth(),
) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 [P2] Adapt the account layout to smaller windows

At the default 854×480 window size, reproduced on Minecraft 26.3, the fixed-width preview leaves too little room for these side-by-side buttons. The Microsoft button consumes the available width, the offline button disappears, and the resulting row height collapses the weighted account list. Users cannot add offline accounts or manage existing accounts without enlarging the window. Scale the preview and stack or wrap the buttons when space is limited.

) {
SocialText(text = "Accounts", fontSize = 24.sp, fontWeight = FontWeight.SemiBold)
Spacer(Modifier.weight(1f))
SocialIconButton(SOCIAL_ASSETS + "x-close.svg", tooltip = "Close", onClick = onClose)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 [P2] Prevent dismissal while an account switch is still running

During a slow account switch, this close button and the screen's Escape handler bypass the backdrop's idle check. Disposing the composition cancels its coroutine scope, but the synchronous OneLauncherAccounts.switchTo call on Dispatchers.IO continues through its blocking profile lookup and subsequent session mutation. Users can return to the menu and start another switch, only for the earlier operation to finish later and overwrite their selection. Apply the busy guard to every dismissal path, or ensure cancellation prevents the pending session mutation.

Comment on lines +263 to +268
if (account.microsoft) {
RefreshAccountButton(
color = if (account.expired) SocialDangerColor else SocialTextSecondary,
enabled = enabled,
spinning = refreshing,
onClick = onRefresh,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 [P2] Hide refresh for transient launch accounts

When a Microsoft launch account is absent from auth.json, OneLauncherAccounts.list() includes it as a transient account without a refresh token. This condition nevertheless gives it an enabled refresh button, whose call to OneLauncherAccounts.refresh() always fails with “Account not found” because that method only searches persisted accounts. Expose and check refreshability rather than treating every Microsoft account as refreshable.

import org.lwjgl.input.Keyboard
*///?}

class AccountSwitcherScreen(internal val previousScreen: Screen?) : ComposeScreen(RenderMode.CONTINUOUS) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 [P3] Reuse the existing overlay screen implementation

This class duplicates SocialOverlayScreen's Escape restoration, blur animation, panorama rendering, and version-specific rendering branches, changing essentially only the content and close target. Future rendering or lifecycle fixes must now be maintained in both copies. Share the existing overlay implementation and supply the account content and dismissal callback.

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

Labels

None yet

Projects

Status: No status
Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants