1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 12:33:01 +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>(); protected readonly IBindable<APIUser> User = new Bindable<APIUser>();
[Resolved] [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 protected bool ShowLoadingSpinner
{ {
@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Comments
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
PlaceholderText = placeholderText, PlaceholderText = placeholderText,
Current = Current, Current = Current,
ReadOnly = !api.IsLoggedIn ReadOnly = !API.IsLoggedIn
}, },
new Container new Container
{ {
@ -147,7 +147,7 @@ namespace osu.Game.Overlays.Comments
}); });
TextBox.OnCommit += (_, _) => commitButton.TriggerClick(); TextBox.OnCommit += (_, _) => commitButton.TriggerClick();
User.BindTo(api.LocalUser); User.BindTo(API.LocalUser);
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -165,7 +165,7 @@ namespace osu.Game.Overlays.Comments
private void updateTextBoxState() private void updateTextBoxState()
{ {
TextBox.PlaceholderText = placeholderText; TextBox.PlaceholderText = placeholderText;
TextBox.ReadOnly = !api.IsLoggedIn; TextBox.ReadOnly = !API.IsLoggedIn;
} }
private partial class EditorTextBox : OsuTextBox private partial class EditorTextBox : OsuTextBox

View File

@ -405,9 +405,6 @@ namespace osu.Game.Overlays.Comments
[Resolved] [Resolved]
private CommentsContainer commentsContainer { get; set; } private CommentsContainer commentsContainer { get; set; }
[Resolved]
private IAPIProvider api { get; set; }
public Action<CommentBundle> OnPost; public Action<CommentBundle> OnPost;
//TODO should match web, left empty due to no multiline support //TODO should match web, left empty due to no multiline support
@ -432,7 +429,7 @@ namespace osu.Game.Overlays.Comments
Current.Value = string.Empty; Current.Value = string.Empty;
OnPost?.Invoke(cb); 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.Allocation;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
@ -18,9 +17,6 @@ namespace osu.Game.Overlays.Comments
[Resolved] [Resolved]
private CommentsContainer commentsContainer { get; set; } = null!; private CommentsContainer commentsContainer { get; set; } = null!;
[Resolved]
private IAPIProvider api { get; set; } = null!;
private readonly Comment parentComment; private readonly Comment parentComment;
public Action<DrawableComment[]>? OnPost; public Action<DrawableComment[]>? OnPost;
@ -52,7 +48,7 @@ namespace osu.Game.Overlays.Comments
Logger.Error(e, "Posting reply comment failed."); Logger.Error(e, "Posting reply comment failed.");
}); });
req.Success += cb => Schedule(processPostedComments, cb); req.Success += cb => Schedule(processPostedComments, cb);
api.Queue(req); API.Queue(req);
} }
private void processPostedComments(CommentBundle cb) private void processPostedComments(CommentBundle cb)