1
0
mirror of https://github.com/ppy/osu synced 2024-12-15 03:16:17 +00:00

Rename UserProfile{ -> Data}

This commit is contained in:
Bartłomiej Dach 2023-01-09 17:37:28 +01:00
parent 4dd7727f71
commit fdf0d4bd62
No known key found for this signature in database
30 changed files with 52 additions and 52 deletions

View File

@ -38,8 +38,8 @@ namespace osu.Game.Tests.Visual.Online
Child = section = new HistoricalSection(),
});
AddStep("Show peppy", () => section.UserProfile.Value = new UserProfile(new APIUser { Id = 2 }));
AddStep("Show WubWoofWolf", () => section.UserProfile.Value = new UserProfile(new APIUser { Id = 39828 }));
AddStep("Show peppy", () => section.UserProfile.Value = new UserProfileData(new APIUser { Id = 2 }));
AddStep("Show WubWoofWolf", () => section.UserProfile.Value = new UserProfileData(new APIUser { Id = 39828 }));
}
}
}

View File

@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Online
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Red);
private readonly Bindable<UserProfile?> user = new Bindable<UserProfile?>();
private readonly Bindable<UserProfileData?> user = new Bindable<UserProfileData?>();
private readonly PlayHistorySubsection section;
public TestScenePlayHistorySubsection()
@ -44,49 +44,49 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void TestNullValues()
{
AddStep("Load user", () => user.Value = new UserProfile(user_with_null_values));
AddStep("Load user", () => user.Value = new UserProfileData(user_with_null_values));
AddAssert("Section is hidden", () => section.Alpha == 0);
}
[Test]
public void TestEmptyValues()
{
AddStep("Load user", () => user.Value = new UserProfile(user_with_empty_values));
AddStep("Load user", () => user.Value = new UserProfileData(user_with_empty_values));
AddAssert("Section is hidden", () => section.Alpha == 0);
}
[Test]
public void TestOneValue()
{
AddStep("Load user", () => user.Value = new UserProfile(user_with_one_value));
AddStep("Load user", () => user.Value = new UserProfileData(user_with_one_value));
AddAssert("Section is hidden", () => section.Alpha == 0);
}
[Test]
public void TestTwoValues()
{
AddStep("Load user", () => user.Value = new UserProfile(user_with_two_values));
AddStep("Load user", () => user.Value = new UserProfileData(user_with_two_values));
AddAssert("Section is visible", () => section.Alpha == 1);
}
[Test]
public void TestConstantValues()
{
AddStep("Load user", () => user.Value = new UserProfile(user_with_constant_values));
AddStep("Load user", () => user.Value = new UserProfileData(user_with_constant_values));
AddAssert("Section is visible", () => section.Alpha == 1);
}
[Test]
public void TestConstantZeroValues()
{
AddStep("Load user", () => user.Value = new UserProfile(user_with_zero_values));
AddStep("Load user", () => user.Value = new UserProfileData(user_with_zero_values));
AddAssert("Section is visible", () => section.Alpha == 1);
}
[Test]
public void TestFilledValues()
{
AddStep("Load user", () => user.Value = new UserProfile(user_with_filled_values));
AddStep("Load user", () => user.Value = new UserProfileData(user_with_filled_values));
AddAssert("Section is visible", () => section.Alpha == 1);
AddAssert("Array length is the same", () => user_with_filled_values.MonthlyPlayCounts.Length == getChartValuesLength());
}
@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void TestMissingValues()
{
AddStep("Load user", () => user.Value = new UserProfile(user_with_missing_values));
AddStep("Load user", () => user.Value = new UserProfileData(user_with_missing_values));
AddAssert("Section is visible", () => section.Alpha == 1);
AddAssert("Array length is 7", () => getChartValuesLength() == 7);
}

View File

@ -29,13 +29,13 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void TestBasic()
{
AddStep("Show example user", () => header.UserProfile.Value = new UserProfile(TestSceneUserProfileOverlay.TEST_USER));
AddStep("Show example user", () => header.UserProfile.Value = new UserProfileData(TestSceneUserProfileOverlay.TEST_USER));
}
[Test]
public void TestOnlineState()
{
AddStep("Show online user", () => header.UserProfile.Value = new UserProfile(new APIUser
AddStep("Show online user", () => header.UserProfile.Value = new UserProfileData(new APIUser
{
Id = 1001,
Username = "IAmOnline",
@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.Online
IsOnline = true,
}));
AddStep("Show offline user", () => header.UserProfile.Value = new UserProfile(new APIUser
AddStep("Show offline user", () => header.UserProfile.Value = new UserProfileData(new APIUser
{
Id = 1002,
Username = "IAmOffline",
@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void TestRankedState()
{
AddStep("Show ranked user", () => header.UserProfile.Value = new UserProfile(new APIUser
AddStep("Show ranked user", () => header.UserProfile.Value = new UserProfileData(new APIUser
{
Id = 2001,
Username = "RankedUser",
@ -72,7 +72,7 @@ namespace osu.Game.Tests.Visual.Online
}
}));
AddStep("Show unranked user", () => header.UserProfile.Value = new UserProfile(new APIUser
AddStep("Show unranked user", () => header.UserProfile.Value = new UserProfileData(new APIUser
{
Id = 2002,
Username = "UnrankedUser",

View File

@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.Online
}
});
AddStep("Show cookiezi", () => ranks.UserProfile.Value = new UserProfile(new APIUser { Id = 124493 }));
AddStep("Show cookiezi", () => ranks.UserProfile.Value = new UserProfileData(new APIUser { Id = 124493 }));
}
}
}

View File

@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Profile.Header
{
public partial class BottomHeaderContainer : CompositeDrawable
{
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
private LinkFlowContainer topLinkContainer = null!;
private LinkFlowContainer bottomLinkContainer = null!;

View File

@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Profile.Header
public partial class CentreHeaderContainer : CompositeDrawable
{
public readonly BindableBool DetailsVisible = new BindableBool(true);
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
private OverlinedInfoContainer hiddenDetailGlobal = null!;
private OverlinedInfoContainer hiddenDetailCountry = null!;

View File

@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class FollowersButton : ProfileHeaderStatisticsButton
{
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
public override LocalisableString TooltipText => FriendsStrings.ButtonsDisabled;

View File

@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class LevelBadge : CompositeDrawable, IHasTooltip
{
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
public LocalisableString TooltipText { get; private set; }

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class LevelProgressBar : CompositeDrawable, IHasTooltip
{
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
public LocalisableString TooltipText { get; }

View File

@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class MappingSubscribersButton : ProfileHeaderStatisticsButton
{
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
public override LocalisableString TooltipText => FollowsStrings.MappingFollowers;

View File

@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class MessageUserButton : ProfileHeaderButton
{
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
public override LocalisableString TooltipText => UsersStrings.CardSendMessage;

View File

@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class OverlinedTotalPlayTime : CompositeDrawable, IHasTooltip
{
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
public LocalisableString TooltipText { get; set; }
@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
UserProfile.BindValueChanged(updateTime, true);
}
private void updateTime(ValueChangedEvent<UserProfile?> userProfile)
private void updateTime(ValueChangedEvent<UserProfileData?> userProfile)
{
int? playTime = userProfile.NewValue?.User.Statistics?.PlayTime;
TooltipText = (playTime ?? 0) / 3600 + " hours";

View File

@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Profile.Header
private FillFlowContainer? fillFlow;
private RankGraph rankGraph = null!;
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
private bool expanded = true;
@ -170,7 +170,7 @@ namespace osu.Game.Overlays.Profile.Header
};
}
private void updateDisplay(UserProfile? userProfile)
private void updateDisplay(UserProfileData? userProfile)
{
var user = userProfile?.User;

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Header
{
private FillFlowContainer badgeFlowContainer = null!;
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)

View File

@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Profile.Header
{
private const float avatar_size = 110;
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
[Resolved]
private IAPIProvider api { get; set; } = null!;
@ -173,7 +173,7 @@ namespace osu.Game.Overlays.Profile.Header
UserProfile.BindValueChanged(user => updateUser(user.NewValue));
}
private void updateUser(UserProfile? userProfile)
private void updateUser(UserProfileData? userProfile)
{
var user = userProfile?.User;

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile
{
private UserCoverBackground coverContainer = null!;
public Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
private CentreHeaderContainer centreHeaderContainer;
private DetailHeaderContainer detailHeaderContainer;
@ -99,7 +99,7 @@ namespace osu.Game.Overlays.Profile
protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle();
private void updateDisplay(UserProfile? userProfile) => coverContainer.User = userProfile?.User;
private void updateDisplay(UserProfileData? userProfile) => coverContainer.User = userProfile?.User;
private partial class ProfileHeaderTitle : OverlayTitle
{

View File

@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Profile
protected override Container<Drawable> Content => content;
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
public readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
protected ProfileSection()
{

View File

@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
protected override int InitialItemsCount => type == BeatmapSetType.Graveyard ? 2 : 6;
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<UserProfile?> user, LocalisableString headerText)
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<UserProfileData?> user, LocalisableString headerText)
: base(user, headerText)
{
this.type = type;

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
/// </summary>
protected abstract LocalisableString GraphCounterName { get; }
protected ChartProfileSubsection(Bindable<UserProfile?> userProfile, LocalisableString headerText)
protected ChartProfileSubsection(Bindable<UserProfileData?> userProfile, LocalisableString headerText)
: base(userProfile, headerText)
{
}
@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
UserProfile.BindValueChanged(onUserChanged, true);
}
private void onUserChanged(ValueChangedEvent<UserProfile?> e)
private void onUserChanged(ValueChangedEvent<UserProfileData?> e)
{
var values = GetValues(e.NewValue?.User);

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
{
public partial class PaginatedMostPlayedBeatmapContainer : PaginatedProfileSubsection<APIUserMostPlayedBeatmap>
{
public PaginatedMostPlayedBeatmapContainer(Bindable<UserProfile?> userProfile)
public PaginatedMostPlayedBeatmapContainer(Bindable<UserProfileData?> userProfile)
: base(userProfile, UsersStrings.ShowExtraHistoricalMostPlayedTitle)
{
}

View File

@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
{
protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalMonthlyPlaycountsCountLabel;
public PlayHistorySubsection(Bindable<UserProfile?> userProfile)
public PlayHistorySubsection(Bindable<UserProfileData?> userProfile)
: base(userProfile, UsersStrings.ShowExtraHistoricalMonthlyPlaycountsTitle)
{
}

View File

@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
{
protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalReplaysWatchedCountsCountLabel;
public ReplaysSubsection(Bindable<UserProfile?> userProfile)
public ReplaysSubsection(Bindable<UserProfileData?> userProfile)
: base(userProfile, UsersStrings.ShowExtraHistoricalReplaysWatchedCountsTitle)
{
}

View File

@ -19,9 +19,9 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
{
public partial class KudosuInfo : Container
{
private readonly Bindable<UserProfile?> userProfile = new Bindable<UserProfile?>();
private readonly Bindable<UserProfileData?> userProfile = new Bindable<UserProfileData?>();
public KudosuInfo(Bindable<UserProfile?> userProfile)
public KudosuInfo(Bindable<UserProfileData?> userProfile)
{
this.userProfile.BindTo(userProfile);
CountSection total;

View File

@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
{
public partial class PaginatedKudosuHistoryContainer : PaginatedProfileSubsection<APIKudosuHistory>
{
public PaginatedKudosuHistoryContainer(Bindable<UserProfile?> userProfile)
public PaginatedKudosuHistoryContainer(Bindable<UserProfileData?> userProfile)
: base(userProfile, missingText: UsersStrings.ShowExtraKudosuEntryEmpty)
{
}

View File

@ -46,7 +46,7 @@ namespace osu.Game.Overlays.Profile.Sections
private OsuSpriteText missing = null!;
private readonly LocalisableString? missingText;
protected PaginatedProfileSubsection(Bindable<UserProfile?> userProfile, LocalisableString? headerText = null, LocalisableString? missingText = null)
protected PaginatedProfileSubsection(Bindable<UserProfileData?> userProfile, LocalisableString? headerText = null, LocalisableString? missingText = null)
: base(userProfile, headerText, CounterVisibilityState.AlwaysVisible)
{
this.missingText = missingText;
@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Profile.Sections
UserProfile.BindValueChanged(onUserChanged, true);
}
private void onUserChanged(ValueChangedEvent<UserProfile?> e)
private void onUserChanged(ValueChangedEvent<UserProfileData?> e)
{
loadCancellation?.Cancel();
retrievalRequest?.Cancel();

View File

@ -11,14 +11,14 @@ namespace osu.Game.Overlays.Profile.Sections
{
public abstract partial class ProfileSubsection : FillFlowContainer
{
protected readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
protected readonly Bindable<UserProfileData?> UserProfile = new Bindable<UserProfileData?>();
private readonly LocalisableString headerText;
private readonly CounterVisibilityState counterVisibilityState;
private ProfileSubsectionHeader header = null!;
protected ProfileSubsection(Bindable<UserProfile?> userProfile, LocalisableString? headerText = null, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
protected ProfileSubsection(Bindable<UserProfileData?> userProfile, LocalisableString? headerText = null, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
{
this.headerText = headerText ?? string.Empty;
this.counterVisibilityState = counterVisibilityState;

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
private readonly ScoreType type;
public PaginatedScoreContainer(ScoreType type, Bindable<UserProfile?> userProfile, LocalisableString headerText)
public PaginatedScoreContainer(ScoreType type, Bindable<UserProfileData?> userProfile, LocalisableString headerText)
: base(userProfile, headerText)
{
this.type = type;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
{
public partial class PaginatedRecentActivityContainer : PaginatedProfileSubsection<APIRecentActivity>
{
public PaginatedRecentActivityContainer(Bindable<UserProfile?> userProfile)
public PaginatedRecentActivityContainer(Bindable<UserProfileData?> userProfile)
: base(userProfile, missingText: EventsStrings.Empty)
{
}

View File

@ -8,7 +8,7 @@ namespace osu.Game.Overlays.Profile
/// <summary>
/// Contains data about a profile presented on the <see cref="UserProfileOverlay"/>.
/// </summary>
public class UserProfile
public class UserProfileData
{
/// <summary>
/// The user whose profile is being presented.
@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Profile
// TODO: add ruleset
public UserProfile(APIUser user)
public UserProfileData(APIUser user)
{
User = user;
}

View File

@ -125,7 +125,7 @@ namespace osu.Game.Overlays
{
Debug.Assert(sections != null && sectionsContainer != null && tabs != null);
var userProfile = new UserProfile(user);
var userProfile = new UserProfileData(user);
Header.UserProfile.Value = userProfile;
if (user.ProfileOrder != null)