From 03d560ed4127f97a153c7ef30edfdd2b27f5f2de Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 18 Jun 2019 19:13:21 +0300 Subject: [PATCH 1/3] Initial implementation --- osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs | 7 ++++++- osu.Game/Users/User.cs | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs index ffbb9ad218..7da7293c6c 100644 --- a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs @@ -87,7 +87,12 @@ namespace osu.Game.Overlays.Profile.Header addSpacer(topLinkContainer); - if (user.LastVisit.HasValue) + if (user.IsOnline) + { + topLinkContainer.AddText("Currently online"); + addSpacer(topLinkContainer); + } + else if(user.LastVisit.HasValue) { topLinkContainer.AddText("Last seen "); topLinkContainer.AddText(new DrawableDate(user.LastVisit.Value), embolden); diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index c3ecd62e10..df41e194b0 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -78,6 +78,9 @@ namespace osu.Game.Users [JsonProperty(@"is_active")] public bool Active; + [JsonProperty(@"is_online")] + public bool IsOnline; + [JsonProperty(@"pm_friends_only")] public bool PMFriendsOnly; From 2fb1052a1ef2fbd7ff4d0a8a3359abc68bc6f29d Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 18 Jun 2019 21:04:36 +0300 Subject: [PATCH 2/3] Add missing space --- osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs index 7da7293c6c..e7f7c2f490 100644 --- a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs @@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Profile.Header topLinkContainer.AddText("Currently online"); addSpacer(topLinkContainer); } - else if(user.LastVisit.HasValue) + else if (user.LastVisit.HasValue) { topLinkContainer.AddText("Last seen "); topLinkContainer.AddText(new DrawableDate(user.LastVisit.Value), embolden); From e16de58450ce1b1eb3d289576bba76092d54301d Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Wed, 19 Jun 2019 12:34:01 +0300 Subject: [PATCH 3/3] Add a testcase --- .../Visual/Online/TestSceneUserProfileHeader.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs index d9230090fc..2285c9b799 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs @@ -39,13 +39,27 @@ namespace osu.Game.Tests.Visual.Online header = new ProfileHeader(); Add(header); - AddStep("Show offline dummy", () => header.User.Value = TestSceneUserProfileOverlay.TEST_USER); + AddStep("Show test dummy", () => header.User.Value = TestSceneUserProfileOverlay.TEST_USER); AddStep("Show null dummy", () => header.User.Value = new User { Username = "Null" }); + AddStep("Show online dummy", () => header.User.Value = new User + { + Username = "IAmOnline", + LastVisit = DateTimeOffset.Now, + IsOnline = true, + }); + + AddStep("Show offline dummy", () => header.User.Value = new User + { + Username = "IAmOffline", + LastVisit = DateTimeOffset.Now, + IsOnline = false, + }); + addOnlineStep("Show ppy", new User { Username = @"peppy",