1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:23:00 +08:00

resolve protected API in comments superclass

This commit is contained in:
Liam DeVoe 2023-06-19 17:36:40 -04:00
parent 4a9543092a
commit d5d494f07b
3 changed files with 7 additions and 14 deletions

View File

@ -45,9 +45,9 @@ namespace osu.Game.Overlays.Comments
protected readonly IBindable<APIUser> User = new Bindable<APIUser>();
[Resolved]
private IAPIProvider api { get; set; } = null!;
protected IAPIProvider API { get; private set; } = null!;
private LocalisableString placeholderText => api.IsLoggedIn ? TextBoxPlaceholder : textBoxPlaceholderLoggedOut;
private LocalisableString placeholderText => API.IsLoggedIn ? TextBoxPlaceholder : textBoxPlaceholderLoggedOut;
protected bool ShowLoadingSpinner
{
@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Comments
RelativeSizeAxes = Axes.X,
PlaceholderText = placeholderText,
Current = Current,
ReadOnly = !api.IsLoggedIn
ReadOnly = !API.IsLoggedIn
},
new Container
{
@ -147,7 +147,7 @@ namespace osu.Game.Overlays.Comments
});
TextBox.OnCommit += (_, _) => commitButton.TriggerClick();
User.BindTo(api.LocalUser);
User.BindTo(API.LocalUser);
}
protected override void LoadComplete()
@ -165,7 +165,7 @@ namespace osu.Game.Overlays.Comments
private void updateTextBoxState()
{
TextBox.PlaceholderText = placeholderText;
TextBox.ReadOnly = !api.IsLoggedIn;
TextBox.ReadOnly = !API.IsLoggedIn;
}
private partial class EditorTextBox : OsuTextBox

View File

@ -405,9 +405,6 @@ namespace osu.Game.Overlays.Comments
[Resolved]
private CommentsContainer commentsContainer { get; set; }
[Resolved]
private IAPIProvider api { get; set; }
public Action<CommentBundle> OnPost;
//TODO should match web, left empty due to no multiline support
@ -432,7 +429,7 @@ namespace osu.Game.Overlays.Comments
Current.Value = string.Empty;
OnPost?.Invoke(cb);
});
api.Queue(req);
API.Queue(req);
}
}
}

View File

@ -6,7 +6,6 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Localisation;
using osu.Framework.Logging;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Resources.Localisation.Web;
@ -18,9 +17,6 @@ namespace osu.Game.Overlays.Comments
[Resolved]
private CommentsContainer commentsContainer { get; set; } = null!;
[Resolved]
private IAPIProvider api { get; set; } = null!;
private readonly Comment parentComment;
public Action<DrawableComment[]>? OnPost;
@ -52,7 +48,7 @@ namespace osu.Game.Overlays.Comments
Logger.Error(e, "Posting reply comment failed.");
});
req.Success += cb => Schedule(processPostedComments, cb);
api.Queue(req);
API.Queue(req);
}
private void processPostedComments(CommentBundle cb)