mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Remove APIFriend
This commit is contained in:
parent
bf9c6f8a3b
commit
4ac740b12b
@ -10,7 +10,6 @@ using osu.Game.Users;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Framework.Allocation;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using System.Linq;
|
||||
using osu.Game.Online.API;
|
||||
|
||||
@ -58,9 +57,9 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddStep("Populate", () => layout.Users = getUsers());
|
||||
}
|
||||
|
||||
private List<APIFriend> getUsers() => new List<APIFriend>
|
||||
private List<User> getUsers() => new List<User>
|
||||
{
|
||||
new APIFriend
|
||||
new User
|
||||
{
|
||||
Username = "flyte",
|
||||
Id = 3103765,
|
||||
@ -69,7 +68,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Country = new Country { FlagName = "JP" },
|
||||
CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
|
||||
},
|
||||
new APIFriend
|
||||
new User
|
||||
{
|
||||
Username = "peppy",
|
||||
Id = 2,
|
||||
@ -80,7 +79,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
IsSupporter = true,
|
||||
SupportLevel = 3,
|
||||
},
|
||||
new APIFriend
|
||||
new User
|
||||
{
|
||||
Username = "Evast",
|
||||
Id = 8195163,
|
||||
|
@ -7,9 +7,9 @@ using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Dashboard.Friends;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
@ -39,17 +39,17 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
[Test]
|
||||
public void Populate()
|
||||
{
|
||||
AddStep("Populate", () => control.Populate(new List<APIFriend>
|
||||
AddStep("Populate", () => control.Populate(new List<User>
|
||||
{
|
||||
new APIFriend
|
||||
new User
|
||||
{
|
||||
IsOnline = true
|
||||
},
|
||||
new APIFriend
|
||||
new User
|
||||
{
|
||||
IsOnline = false
|
||||
},
|
||||
new APIFriend
|
||||
new User
|
||||
{
|
||||
IsOnline = false
|
||||
}
|
||||
|
@ -2,11 +2,11 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetFriendsRequest : APIRequest<List<APIFriend>>
|
||||
public class GetFriendsRequest : APIRequest<List<User>>
|
||||
{
|
||||
protected override string Target => @"friends";
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
// 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.Users;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
public class APIFriend : User
|
||||
{
|
||||
[JsonProperty(@"current_mode_rank")]
|
||||
public int? CurrentModeRank;
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
@ -12,9 +12,9 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
|
||||
public int Count => Users.Count;
|
||||
|
||||
public List<APIFriend> Users { get; }
|
||||
public List<User> Users { get; }
|
||||
|
||||
public FriendsBundle(FriendsOnlineStatus status, List<APIFriend> users)
|
||||
public FriendsBundle(FriendsOnlineStatus status, List<User> users)
|
||||
{
|
||||
Status = status;
|
||||
Users = users;
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
|
||||
@ -19,9 +18,9 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
public class FriendsLayout : CompositeDrawable
|
||||
{
|
||||
private List<APIFriend> users = new List<APIFriend>();
|
||||
private List<User> users = new List<User>();
|
||||
|
||||
public List<APIFriend> Users
|
||||
public List<User> Users
|
||||
{
|
||||
get => users;
|
||||
set
|
||||
@ -172,7 +171,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
if (itemsPlaceholder.Any())
|
||||
loading.Show();
|
||||
|
||||
var groupedUsers = OnlineStatusControl.Current.Value?.Users ?? new List<APIFriend>();
|
||||
var groupedUsers = OnlineStatusControl.Current.Value?.Users ?? new List<User>();
|
||||
|
||||
var sortedUsers = sortUsers(groupedUsers);
|
||||
|
||||
@ -195,7 +194,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
currentContent.FadeIn(200, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private FillFlowContainer createTable(List<APIFriend> users)
|
||||
private FillFlowContainer createTable(List<User> users)
|
||||
{
|
||||
var style = userListToolbar.DisplayStyle.Value;
|
||||
|
||||
@ -226,7 +225,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
}
|
||||
}
|
||||
|
||||
private List<APIFriend> sortUsers(List<APIFriend> unsorted)
|
||||
private List<User> sortUsers(List<User> unsorted)
|
||||
{
|
||||
switch (userListToolbar.SortCriteria.Value)
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
protected override OverlayStreamItem<FriendsBundle> CreateStreamItem(FriendsBundle value) => new FriendsOnlineStatusItem(value);
|
||||
|
||||
public void Populate(List<APIFriend> users)
|
||||
public void Populate(List<User> users)
|
||||
{
|
||||
Clear();
|
||||
|
||||
|
@ -120,7 +120,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
case SocialTab.Friends:
|
||||
var friendRequest = new GetFriendsRequest(); // TODO filter arguments?
|
||||
friendRequest.Success += users => Users = users.Cast<User>().ToArray();
|
||||
friendRequest.Success += users => Users = users.ToArray();
|
||||
API.Queue(getUsersRequest = friendRequest);
|
||||
break;
|
||||
|
||||
|
@ -69,6 +69,9 @@ namespace osu.Game.Users
|
||||
[JsonProperty(@"support_level")]
|
||||
public int SupportLevel;
|
||||
|
||||
[JsonProperty(@"current_mode_rank")]
|
||||
public int? CurrentModeRank;
|
||||
|
||||
[JsonProperty(@"is_gmt")]
|
||||
public bool IsGMT;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user