1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-08 05:50:05 +08:00

Merge pull request #19706 from peppy/api-connected-state-refactor

Fix avatar potentially not loading in `LoginOverlay` due to misordered events
This commit is contained in:
Dan Balasescu 2022-08-11 19:08:25 +09:00 committed by GitHub
commit 77cd279a76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -195,6 +195,8 @@ namespace osu.Game.Online.API
setLocalUser(user);
//we're connected!
state.Value = APIState.Online;
failureCount = 0;
};
@ -208,13 +210,7 @@ namespace osu.Game.Online.API
var friendsReq = new GetFriendsRequest();
friendsReq.Failure += _ => failConnectionProcess();
friendsReq.Success += res =>
{
friends.AddRange(res);
//we're connected!
state.Value = APIState.Online;
};
friendsReq.Success += res => friends.AddRange(res);
if (!handleRequest(friendsReq))
{
@ -338,8 +334,7 @@ namespace osu.Game.Online.API
if (req.CompletionState != APIRequestCompletionState.Completed)
return false;
// we could still be in initialisation, at which point we don't want to say we're Online yet.
if (IsLoggedIn) state.Value = APIState.Online;
// Reset failure count if this request succeeded.
failureCount = 0;
return true;
}