Fix some web requests retrieving the user too early

This commit is contained in:
Dean Herbert
2020-07-14 13:07:17 +09:00
parent 8411a36a0f
commit 7fe69bb199
8 changed files with 22 additions and 28 deletions

View File

@ -5,6 +5,7 @@ using System;
using Newtonsoft.Json;
using osu.Framework.IO.Network;
using osu.Framework.Logging;
using osu.Game.Users;
namespace osu.Game.Online.API
{
@ -61,6 +62,11 @@ namespace osu.Game.Online.API
protected APIAccess API;
protected WebRequest WebRequest;
/// <summary>
/// The currently logged in user. Note that this will only be populated during <see cref="Perform"/>.
/// </summary>
protected User User { get; private set; }
/// <summary>
/// Invoked on successful completion of an API request.
/// This will be scheduled to the API's internal scheduler (run on update thread automatically).
@ -86,6 +92,7 @@ namespace osu.Game.Online.API
}
API = apiAccess;
User = apiAccess.LocalUser.Value;
if (checkAndScheduleFailure())
return;