Chat: show the active Claude account in the send tooltip, menu and limit banner
usage.account now carries the email and organization of the account Claude Code is signed in to (from its initialize account, or the saved account just switched to), sent at process start and after a switch. The app shows it as the send tooltip's usage prefix, the Claude account menu subtitle, the usage-limit banner's status line and the info sheet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,8 +31,15 @@ class ChatAccountUsage {
|
||||
required this.unsupported,
|
||||
this.switchedAt = 0,
|
||||
this.extraUsage,
|
||||
this.email = '',
|
||||
this.organization = '',
|
||||
});
|
||||
|
||||
/// The account the harness is signed in to now ("sam@example.com"); empty
|
||||
/// when it did not say (an API key, or a harness without accounts).
|
||||
final String email;
|
||||
final String organization;
|
||||
|
||||
/// Display name of the harness ("Claude Code", "Codex", "OpenCode").
|
||||
final String harness;
|
||||
final String plan;
|
||||
@@ -131,9 +138,10 @@ ChatAccountUsage? chatAccountUsage(Object? value) {
|
||||
}
|
||||
}
|
||||
final switchedAt = _millis(value['switched_at']);
|
||||
// A switched account replaces the previous report even with no windows
|
||||
// yet; otherwise an empty report keeps the last one.
|
||||
if (windows.isEmpty && switchedAt == 0) return null;
|
||||
final email = '${value['email'] ?? ''}'.trim();
|
||||
// A switched or newly named account replaces the previous report even with
|
||||
// no windows yet; otherwise an empty report keeps the last one.
|
||||
if (windows.isEmpty && switchedAt == 0 && email.isEmpty) return null;
|
||||
return ChatAccountUsage(
|
||||
harness: harness,
|
||||
plan: '${value['plan'] ?? ''}'.trim(),
|
||||
@@ -142,6 +150,8 @@ ChatAccountUsage? chatAccountUsage(Object? value) {
|
||||
unsupported: false,
|
||||
switchedAt: switchedAt,
|
||||
extraUsage: _extraUsage(value['extra_usage']),
|
||||
email: email,
|
||||
organization: '${value['organization'] ?? ''}'.trim(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user