Handle response to get accurate mutual state immediately

This commit is contained in:
Dean Herbert 2024-11-05 16:20:55 +09:00
parent 0087270b7e
commit 1fcdf67806
No known key found for this signature in database
1 changed files with 10 additions and 4 deletions

View File

@ -95,10 +95,16 @@ private void load(IAPIProvider api, INotificationOverlay? notifications)
req.Success += () =>
{
bool becameFriend = status.Value == FriendStatus.None;
SetValue(followerCount += becameFriend ? 1 : -1);
status.Value = becameFriend ? FriendStatus.NotMutual : FriendStatus.None;
if (req is AddFriendRequest addedRequest)
{
SetValue(++followerCount);
status.Value = addedRequest.Response?.Mutual == true ? FriendStatus.Mutual : FriendStatus.NotMutual;
}
else
{
SetValue(--followerCount);
status.Value = FriendStatus.None;
}
api.UpdateLocalFriends();
HideLoadingLayer();