add AddFriendResponse

This commit is contained in:
cdwcgt 2024-11-05 15:47:25 +08:00
parent 1fcdf67806
commit c576fd8448
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2
4 changed files with 24 additions and 5 deletions

View File

@ -443,7 +443,10 @@ namespace osu.Game.Tests.Visual.Online
{
requestLock.Wait(3000);
dummyAPI.Friends.Add(apiRelation);
req.TriggerSuccess(apiRelation);
req.TriggerSuccess(new AddFriendResponse
{
UserRelation = apiRelation
});
});
return true;
@ -483,7 +486,10 @@ namespace osu.Game.Tests.Visual.Online
{
requestLock.Wait(3000);
dummyAPI.Friends.Add(apiRelation);
req.TriggerSuccess(apiRelation);
req.TriggerSuccess(new AddFriendResponse
{
UserRelation = apiRelation
});
});
return true;

View File

@ -3,11 +3,10 @@
using System.Net.Http;
using osu.Framework.IO.Network;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests
{
public class AddFriendRequest : APIRequest<APIRelation>
public class AddFriendRequest : APIRequest<AddFriendResponse>
{
public readonly int TargetId;

View File

@ -0,0 +1,14 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Newtonsoft.Json;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests
{
public class AddFriendResponse
{
[JsonProperty("user_relation")]
public APIRelation UserRelation = null!;
}
}

View File

@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
if (req is AddFriendRequest addedRequest)
{
SetValue(++followerCount);
status.Value = addedRequest.Response?.Mutual == true ? FriendStatus.Mutual : FriendStatus.NotMutual;
status.Value = addedRequest.Response?.UserRelation.Mutual == true ? FriendStatus.Mutual : FriendStatus.NotMutual;
}
else
{