Skip to content

Commit 676d28f

Browse files
Ryanmello07claude
andcommitted
p5: make the account menu reachable, and stop it calling the API signed out
Two defects, both found by running the thing rather than reading it. The avatar was invisible in --preview-ui and I could not see why from the code. A temporary log said it plainly: signedIn=true, then signedIn=false a millisecond later. EnterPreviewUi revealed the avatar and the very next auth push hid it again, so the ONE surface that is signed-in-only was the one surface preview could not show — which is exactly what preview exists for. ApplyAuthState already pins the home view with `showHome = loggedIn || previewUi_` and then passed raw `loggedIn` here; it now passes `showHome`, and EnterPreviewUi stops poking at it. The identity itself still comes from the jwt and is empty in preview, so nothing is fabricated: the menu shows "Guest", Share and Sign out, and NOT "Create account", because preview genuinely has no guest session. The referral share guarded on apiReady(). That is api_.has_value(), set at SDK INIT and true with no session at all — so the moment preview could reach this menu, opening Share would have fired an unauthenticated getNetworkReferralCode at the production API from whatever machine this is. It guards on IsLoggedIn() now, which reads the stored client jwt. Verified at the socket, not in the source: invoked Account then Share URnetwork in --preview-ui and watched Get-NetTCPConnection for the pid. Zero remote connections before or after, against 59 established connections visible elsewhere on the box in the same instant — so the measurement can see traffic, and there was none. Also: the avatar button had no accessible name. Its content is an image, so like the two terms checkboxes it did not appear in the UIA tree at all — nothing announced the control that opens the account menu. It is named for the destination it opens. UIA confirms the open menu: MenuItem "Guest", MenuItem "Share URnetwork", MenuItem "Sign out". The share's clipboard write and its snackbar need a real session and are unverified. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PT7KcWCPKfFwQUc7SM3oZY
1 parent 63efd2b commit 676d28f

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

app/src/App/AuthSheets.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,12 @@ void ShowAccountMenu(FrameworkElement const& anchor, SdkHost& sdk,
611611
auto onShared = actions.onShared;
612612
auto queue = anchor.DispatcherQueue();
613613
share.Click([&sdk, onShared, queue](auto const&, auto const&) {
614-
if (!sdk.apiReady()) return;
614+
// IsLoggedIn(), NOT apiReady(). apiReady() is api_.has_value(), set at SDK
615+
// INIT and true with no session at all, so guarding on it here would fire
616+
// an unauthenticated getNetworkReferralCode at the production API from
617+
// whatever machine this is — which is exactly what --preview-ui, now that
618+
// it can reach this menu, would have done on every open.
619+
if (!sdk.IsLoggedIn()) return;
615620
sdk.api().getNetworkReferralCode(
616621
[onShared, queue](std::optional<urnet::GetNetworkReferralCodeResult> result,
617622
std::optional<std::string>) {

app/src/App/LoginPage.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <chrono>
77

8+
#include <winrt/Microsoft.UI.Xaml.Automation.h>
89
#include <winrt/Windows.System.h>
910

1011
#include "MainWindow.xaml.h"
@@ -1137,6 +1138,10 @@ void LoginPage::ApplyAccountIdentity(std::string const& networkName, bool guest,
11371138
// show and no action in the menu that would make sense.
11381139
w_.AccountMenuButton().Visibility(signedIn ? Visibility::Visible : Visibility::Collapsed);
11391140
if (!signedIn) return;
1141+
// The button's content is an avatar with no text, so like the terms
1142+
// checkboxes it had NO accessible name and did not appear in the UIA tree at
1143+
// all — it named the destination it opens, and nothing announced it.
1144+
Automation::AutomationProperties::SetName(w_.AccountMenuButton(), Loc("account"));
11401145
// PersonPicture derives its initials from DisplayName; a guest has no
11411146
// network name to derive from and gets the store's word for it.
11421147
w_.AccountAvatar().DisplayName(networkName.empty() ? Loc("guest") : H(networkName));

app/src/App/MainWindow.xaml.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,13 @@ void MainWindow::ApplyAuthState(urnw::AuthState state, std::string const& error)
393393
}
394394
}
395395
connect_->SetNetworkIdentity(networkName, guestMode); // re-renders the status
396-
// the title-bar avatar + its menu (iOS AccountMenu): same jwt, one more reader
397-
login_->ApplyAccountIdentity(networkName, guestMode, pro, loggedIn);
396+
// The title-bar avatar + its menu (iOS AccountMenu): same jwt, one more
397+
// reader. `showHome`, NOT `loggedIn` — EnterPreviewUi used to reveal the
398+
// avatar itself and the very next auth push hid it again, so the one surface
399+
// that is signed-in-only was the one surface preview could not show. The
400+
// identity stays whatever the jwt says (empty in preview); only the
401+
// visibility follows the pinned view.
402+
login_->ApplyAccountIdentity(networkName, guestMode, pro, showHome);
398403
if (loggedIn && !wasVisible) {
399404
// the drawer just appeared: refresh its state and play the entrance
400405
connect_->ResyncDrawer();

0 commit comments

Comments
 (0)