Apply nullability to login form related classes

This commit is contained in:
Dean Herbert 2023-06-26 13:26:07 +09:00
parent 372cef3c0a
commit 1abce098b4
3 changed files with 12 additions and 17 deletions

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
@ -45,13 +43,13 @@ public partial class DummyAPIAccess : Component, IAPIProvider
public int APIVersion => int.Parse(DateTime.Now.ToString("yyyyMMdd"));
public Exception LastLoginError { get; private set; }
public Exception? LastLoginError { get; private set; }
/// <summary>
/// Provide handling logic for an arbitrary API request.
/// Should return true is a request was handled. If null or false return, the request will be failed with a <see cref="NotSupportedException"/>.
/// </summary>
public Func<APIRequest, bool> HandleRequest;
public Func<APIRequest, bool>? HandleRequest;
private readonly Bindable<APIState> state = new Bindable<APIState>(APIState.Online);
@ -128,11 +126,11 @@ public void Logout()
LocalUser.Value = new GuestUser();
}
public IHubClientConnector GetHubConnector(string clientName, string endpoint, bool preferMessagePack) => null;
public IHubClientConnector? GetHubConnector(string clientName, string endpoint, bool preferMessagePack) => null;
public NotificationsClientConnector GetNotificationsConnector() => new PollingNotificationsClientConnector(this);
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password)
public RegistrationRequest.RegistrationRequestErrors? CreateAccount(string email, string username, string password)
{
Thread.Sleep(200);
return null;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -26,23 +24,24 @@ namespace osu.Game.Overlays.Login
public partial class LoginPanel : Container
{
private bool bounding = true;
private LoginForm form;
private LoginForm? form;
[Resolved]
private OsuColour colours { get; set; }
private OsuColour colours { get; set; } = null!;
private UserGridPanel panel;
private UserDropdown dropdown;
private UserGridPanel panel = null!;
private UserDropdown dropdown = null!;
/// <summary>
/// Called to request a hide of a parent displaying this container.
/// </summary>
public Action RequestHide;
public Action? RequestHide;
private readonly IBindable<APIState> apiState = new Bindable<APIState>();
[Resolved]
private IAPIProvider api { get; set; }
private IAPIProvider api { get; set; } = null!;
public override RectangleF BoundingBox => bounding ? base.BoundingBox : RectangleF.Empty;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -18,7 +16,7 @@ namespace osu.Game.Overlays
{
public partial class LoginOverlay : OsuFocusedOverlayContainer
{
private LoginPanel panel;
private LoginPanel panel = null!;
private const float transition_time = 400;