This commit is contained in:
@@ -98,6 +98,10 @@ public sealed class WindowsAgentBackend(AccountBindingStore bindings, ServiceOpt
|
||||
if (refreshUiIdentity)
|
||||
await AutoBindMatchesAsync(accounts, targets, cancellationToken);
|
||||
var current = bindings.ReadAll();
|
||||
var databaseIdentities = accounts
|
||||
.Where(account => account.Identity is not null)
|
||||
.Select(account => account.Identity!)
|
||||
.ToArray();
|
||||
var singleBoundTarget = !refreshUiIdentity && current.Count == 1 && targets.Count == 1;
|
||||
var live = current.Where(binding => targets.Any(target =>
|
||||
(target.ProcessId == binding.ProcessId && target.WindowHandle == binding.WindowHandle &&
|
||||
@@ -110,8 +114,17 @@ public sealed class WindowsAgentBackend(AccountBindingStore bindings, ServiceOpt
|
||||
{
|
||||
var binding = bindings.Get(account.AccountId);
|
||||
var isLive = binding is not null && live.Contains(binding.AccountId);
|
||||
var isVerifiedForReadOnlySync = binding is not null &&
|
||||
string.Equals(binding.AccountId, account.AccountId, StringComparison.OrdinalIgnoreCase) &&
|
||||
AccountBindingMatcher.IsUniquelyMatchedToAccount(
|
||||
account.AccountId,
|
||||
new UiAccountIdentity(binding.WechatId, binding.Nickname),
|
||||
databaseIdentities);
|
||||
return new AccountInfo(account.AccountId, account.Identity?.Nickname, account.Identity?.WechatId, null,
|
||||
account.AccountId, isLive, binding, binding is null ? "Unbound" : isLive ? "Bound" : "Stale");
|
||||
account.AccountId, isLive, binding, binding is null ? "Unbound" : isLive ? "Bound" : "Stale")
|
||||
{
|
||||
IsVerifiedForReadOnlySync = isVerifiedForReadOnlySync
|
||||
};
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user