diff --git a/osu.Game/Online/MisskeyAPI/Requests/Meta.cs b/osu.Game/Online/MisskeyAPI/Requests/Meta.cs index c3081c28e2..2f5519a262 100644 --- a/osu.Game/Online/MisskeyAPI/Requests/Meta.cs +++ b/osu.Game/Online/MisskeyAPI/Requests/Meta.cs @@ -5,13 +5,17 @@ using System.Net.Http; using osu.Framework.IO.Network; +using osu.Game.Online.MisskeyAPI.Responses.Types; namespace osu.Game.Online.MisskeyAPI.Requests { - public class Meta : APIRequest + public class Meta : APIRequest { - public Meta() + + private readonly string endpoint; + public Meta(string endpoint) { + this.endpoint = endpoint; } protected override WebRequest CreateWebRequest() @@ -21,7 +25,7 @@ namespace osu.Game.Online.MisskeyAPI.Requests return req; } - protected override string Uri => $@"https://misskey.io/api/meta"; - protected override string Target => @"meta"; + protected override string Uri => $@"https://{endpoint}/api/meta"; + protected override string Target => @""; } } diff --git a/osu.Game/Online/MisskeyAPI/Requests/Notes/CreateRenote.cs b/osu.Game/Online/MisskeyAPI/Requests/Notes/CreateRenote.cs new file mode 100644 index 0000000000..127bcdfb89 --- /dev/null +++ b/osu.Game/Online/MisskeyAPI/Requests/Notes/CreateRenote.cs @@ -0,0 +1,60 @@ +// Copyright (c) sim1222 . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Net.Http; +using Newtonsoft.Json; +using osu.Framework.IO.Network; +using osu.Framework.Logging; + +namespace osu.Game.Online.MisskeyAPI.Requests.Notes +{ + public class CreateRenote : APIRequest + { + private string? text; + private string i; + private string renoteId; + + public CreateRenote(string i, string renoteId) + { + this.i = i; + this.renoteId = renoteId; + } + + public CreateRenote(string i, string renoteId, string Text) + { + this.i = i; + this.text = Text; + this.renoteId = renoteId; + } + + private class ReqBody + { + public string? Text; + public string? i; + public string? renoteId; + }; + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + req.Method = HttpMethod.Post; + var body = new ReqBody() + { + renoteId = renoteId, + i = i + }; + if (text != null) + { + body.Text = text; + } + var json = JsonConvert.SerializeObject(body); + Logger.Log(json, LoggingTarget.Network, LogLevel.Debug); + req.AddRaw(json); + + return req; + } + + protected override string Target => @"notes/create"; + // protected override string Uri => @"https://apicheck.sim1222.workers.dev/notes/create"; + } +} diff --git a/osu.Game/Online/MisskeyAPI/Requests/Notes/HybridTimeline.cs b/osu.Game/Online/MisskeyAPI/Requests/Notes/HybridTimeline.cs index 054b80b41a..81ca4cd63b 100644 --- a/osu.Game/Online/MisskeyAPI/Requests/Notes/HybridTimeline.cs +++ b/osu.Game/Online/MisskeyAPI/Requests/Notes/HybridTimeline.cs @@ -53,6 +53,6 @@ namespace osu.Game.Online.MisskeyAPI.Requests.Notes return req; } - protected override string Target => @"notes/hybrid-timeline"; + protected override string Target => @"notes/local-timeline"; } } diff --git a/osu.Game/Online/MisskeyAPI/Requests/Reactions/CreateReaction.cs b/osu.Game/Online/MisskeyAPI/Requests/Reactions/CreateReaction.cs new file mode 100644 index 0000000000..6991210a89 --- /dev/null +++ b/osu.Game/Online/MisskeyAPI/Requests/Reactions/CreateReaction.cs @@ -0,0 +1,51 @@ +// Copyright (c) sim1222 . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Net.Http; +using Newtonsoft.Json; +using osu.Framework.IO.Network; +using osu.Framework.Logging; +using osu.Game.Online.MisskeyAPI.Requests.Responses; + +namespace osu.Game.Online.MisskeyAPI.Requests.Reactions +{ + public class CreateReaction : APIRequest + { + private string noteId; + private string i; + private string reaction; + + public CreateReaction(string i, string noteId, string reaction) + { + this.i = i; + this.noteId = noteId; + this.reaction = reaction; + } + private class ReqBody + { + public string? noteId; + public string? i; + public string? reaction; + }; + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + req.Method = HttpMethod.Post; + var body = new ReqBody() + { + noteId = noteId, + i = i, + reaction = reaction + }; + var json = JsonConvert.SerializeObject(body); + Logger.Log(json, LoggingTarget.Network, LogLevel.Debug); + req.AddRaw(json); + + return req; + } + + protected override string Target => @"notes/reactions/create"; + // protected override string Uri => @"https://apicheck.sim1222.workers.dev/notes/create"; + } +} diff --git a/osu.Game/Online/MisskeyAPI/Responses/NullResponse.cs b/osu.Game/Online/MisskeyAPI/Responses/NullResponse.cs new file mode 100644 index 0000000000..201c6e4bd9 --- /dev/null +++ b/osu.Game/Online/MisskeyAPI/Responses/NullResponse.cs @@ -0,0 +1,13 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using Newtonsoft.Json; + +namespace osu.Game.Online.MisskeyAPI.Requests.Responses +{ + public class NullResponse + { + } +} diff --git a/osu.Game/Screens/Misskey/Components/FilePickerPopover.cs b/osu.Game/Screens/Misskey/Components/FilePickerPopover.cs new file mode 100644 index 0000000000..3518da5d41 --- /dev/null +++ b/osu.Game/Screens/Misskey/Components/FilePickerPopover.cs @@ -0,0 +1,81 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.IO; +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Database; +using osu.Game.Extensions; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Localisation; +using osu.Game.Overlays; +using osu.Game.Overlays.Mods; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; +using osuTK; + +namespace osu.Game.Screens.Misskey.Components +{ + internal partial class FilePickerPopover : OsuPopover + { + private OsuFileSelector? fileSelector; + private readonly string choosePath; + private readonly string[] allowedExtensions; + private readonly Bindable currentFile; + + [Resolved] + private Bindable ruleset { get; set; } = null!; + + [Resolved] + private Bindable> selectedMods { get; set; } = null!; + + [Resolved] + private RealmAccess realm { get; set; } = null!; + + public FilePickerPopover(string choosePath, string[] allowedExtensions, Bindable file) + { + this.choosePath = choosePath; + this.allowedExtensions = allowedExtensions; + this.currentFile = file; + + Child = new Container + { + Size = new Vector2(600, 400), + Children = new Drawable[] + { + fileSelector = new OsuFileSelector(choosePath, allowedExtensions) + { + RelativeSizeAxes = Axes.Both, + CurrentFile = { BindTarget = currentFile } + }, + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Body.BorderThickness = 3; + Body.BorderColour = colours.Orange1; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + } + + + protected override void UpdateState(ValueChangedEvent state) + { + base.UpdateState(state); + } + } +} diff --git a/osu.Game/Screens/Misskey/Components/Note/Cards/NoteCardNormal.cs b/osu.Game/Screens/Misskey/Components/Note/Cards/NoteCardNormal.cs index 76b6ab8ac6..7bb39c0b7a 100644 --- a/osu.Game/Screens/Misskey/Components/Note/Cards/NoteCardNormal.cs +++ b/osu.Game/Screens/Misskey/Components/Note/Cards/NoteCardNormal.cs @@ -5,14 +5,20 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Beatmaps.Drawables.Cards; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.MisskeyAPI; +using osu.Game.Online.MisskeyAPI.Requests.Notes; +using osu.Game.Online.MisskeyAPI.Requests.Reactions; using osu.Game.Overlays; using osu.Game.Overlays.BeatmapSet; +using osu.Game.Overlays.Notifications; +using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Resources.Localisation.Web; using osu.Game.Screens.Misskey.Components.Note.Cards.Statistics; using osu.Game.Skinning.Components; @@ -25,7 +31,7 @@ namespace osu.Game.Screens.Misskey.Components.Note.Cards protected override Drawable IdleContent => idleBottomContent; protected override Drawable DownloadInProgressContent => downloadProgressBar; - private const float height = 100; + private const float height = 120; [Cached] private readonly NoteCardContent content; @@ -39,9 +45,17 @@ namespace osu.Game.Screens.Misskey.Components.Note.Cards private FillFlowContainer idleBottomContent = null!; private BeatmapCardDownloadProgressBar downloadProgressBar = null!; + private IconButton replyButton = null!; + private IconButton renoteButton = null!; + private IconButton reactButton = null!; + private IconButton menuButton = null!; + [Resolved] private IAPIProvider api { get; set; } = null!; + [Resolved(CanBeNull = true)] + private INotificationOverlay? notifications { get; set; } + // [Resolved] // private OverlayColourProvider colourProvider { get; set; } = null!; @@ -74,7 +88,7 @@ namespace osu.Game.Screens.Misskey.Components.Note.Cards thumbnail = new NoteCardAvatar(Note) { Name = @"Left (icon) area", - Size = new Vector2(height - 10), + Size = new Vector2(Width * 0.2f), // Padding = new MarginPadding { Right = CORNER_RADIUS }, Child = leftIconArea = new FillFlowContainer { @@ -93,124 +107,178 @@ namespace osu.Game.Screens.Misskey.Components.Note.Cards // ButtonsExpandedWidth = 30, // Children = new Drawable[] // { - new FillFlowContainer + new FillFlowContainer + { + // X = height - CORNER_RADIUS, + X = height - 30, + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new GridContainer { - // X = height - CORNER_RADIUS, - X = height, - RelativeSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Children = new Drawable[] + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + ColumnDimensions = new[] { - new GridContainer + new Dimension(), + new Dimension(GridSizeMode.AutoSize), + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize) + }, + Content = new[] + { + new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - ColumnDimensions = new[] + new OsuSpriteText() { - new Dimension(), - new Dimension(GridSizeMode.AutoSize), + Text = new RomanisableString(Note.User.Name, Note.User.Username), + Font = OsuFont.Default.With(size: 22.5f, weight: FontWeight.SemiBold), + RelativeSizeAxes = Axes.X, + Truncate = true + // Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + // AutoSizeAxes = Axes.Y, }, - RowDimensions = new[] + titleBadgeArea = new FillFlowContainer { - new Dimension(GridSizeMode.AutoSize) - }, - Content = new[] - { - new Drawable[] - { - new OsuSpriteText() - { - Text = new RomanisableString(Note.User.Name, Note.User.Username), - Font = OsuFont.Default.With(size: 22.5f, weight: FontWeight.SemiBold), - RelativeSizeAxes = Axes.X, - Truncate = true - // Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - // AutoSizeAxes = Axes.Y, - }, - titleBadgeArea = new FillFlowContainer - { - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - } - } + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, } - }, - artistContainer = new GridContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - ColumnDimensions = new[] - { - new Dimension(), - new Dimension(GridSizeMode.AutoSize) - }, - RowDimensions = new[] - { - new Dimension(GridSizeMode.AutoSize) - }, - Content = new[] - { - new[] - { - artistText = new LinkFlowContainer() - { - // Text = createArtistText(), - // Font = OsuFont.Default.With(size: 17.5f, weight: FontWeight.SemiBold), - RelativeSizeAxes = Axes.X, - // Truncate = true - AutoSizeAxes = Axes.Y, - }, - Empty() - }, - } - }, - noteText = new TextFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Alpha = 1, - AlwaysPresent = true, - }.With(flow => - { - flow.AddText(Note.Text, t => t.Font = OsuFont.Default.With(size: 15)); - }) + } } }, - new Container + artistContainer = new GridContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + ColumnDimensions = new[] + { + new Dimension(), + new Dimension(GridSizeMode.AutoSize) + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize) + }, + Content = new[] + { + new[] + { + artistText = new LinkFlowContainer() + { + // Text = createArtistText(), + // Font = OsuFont.Default.With(size: 17.5f, weight: FontWeight.SemiBold), + RelativeSizeAxes = Axes.X, + // Truncate = true + AutoSizeAxes = Axes.Y, + }, + Empty() + }, + } + }, + noteText = new TextFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Alpha = 1, + AlwaysPresent = true, + }.With(flow => + { + flow.AddText(Note.Text, t => t.Font = OsuFont.Default.With(size: 15)); + }), + new GridContainer() { Name = @"Bottom content", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Children = new Drawable[] + // Anchor = Anchor.BottomLeft, + // Origin = Anchor.BottomLeft, + // Margin = new MarginPadding { Top = 10, Left = 90 }, + // Y = Y + 10f, + ColumnDimensions = new[] { - idleBottomContent = new FillFlowContainer + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.AutoSize), + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize) + }, + Content = new[] + { + new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 3), - AlwaysPresent = true, - Children = new Drawable[] + replyButton = new IconButton() { - // statisticsContainer = new FillFlowContainer - // { - // RelativeSizeAxes = Axes.X, - // AutoSizeAxes = Axes.Y, - // Direction = FillDirection.Horizontal, - // Spacing = new Vector2(10, 0), - // Alpha = 0, - // AlwaysPresent = true, - // ChildrenEnumerable = createStatistics() - // }, - - } + Icon = FontAwesome.Solid.Reply, + }, + renoteButton = new IconButton() + { + Icon = FontAwesome.Solid.Retweet, + Action = () => + { + var req = new CreateRenote(api.AccessToken, Note.Id); + req.Success += _ => + { + notifications?.Post(new SimpleNotification + { + Text = "Renoteしました", + Icon = FontAwesome.Solid.PaperPlane, + }); + }; + req.Failure += _ => + { + notifications?.Post(new SimpleNotification + { + Text = "Renoteに失敗しました", + Icon = FontAwesome.Solid.ExclamationTriangle, + }); + }; + api.Queue(req); + }, + }, + reactButton = new IconButton() + { + Icon = FontAwesome.Solid.Plus, + Action = () => + { + var req = new CreateReaction(api.AccessToken, Note.Id, "👍"); + req.Success += _ => + { + notifications?.Post(new SimpleNotification + { + Text = "リアクションしました", + Icon = FontAwesome.Solid.PaperPlane, + }); + }; + req.Failure += _ => + { + notifications?.Post(new SimpleNotification + { + Text = "リアクションに失敗しました", + Icon = FontAwesome.Solid.ExclamationTriangle, + }); + }; + api.Queue(req); + }, + }, + menuButton = new IconButton() + { + Icon = FontAwesome.Solid.EllipsisH, + }, } } + // } } + } + }, + // } // } } diff --git a/osu.Game/Screens/Misskey/Components/PostForm.cs b/osu.Game/Screens/Misskey/Components/PostForm.cs index 8bdb64aa0b..968a4a0137 100644 --- a/osu.Game/Screens/Misskey/Components/PostForm.cs +++ b/osu.Game/Screens/Misskey/Components/PostForm.cs @@ -2,10 +2,14 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.IO; using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Extensions; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; @@ -13,6 +17,7 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Online.MisskeyAPI; using osu.Game.Misskey.Overlays.Settings; using osu.Game.Online.MisskeyAPI.Requests.Notes; @@ -25,11 +30,13 @@ using osuTK; namespace osu.Game.Screens.Misskey.Components { - public partial class PostForm : FillFlowContainer + public partial class PostForm : FillFlowContainer, IHasPopover { private OnScreenDisplay? onScreenDisplay { get; set; } + [Resolved(CanBeNull = true)] private INotificationOverlay? notifications { get; set; } + private partial class ResToast : Toast { public ResToast(string value, string desc) @@ -41,6 +48,10 @@ namespace osu.Game.Screens.Misskey.Components private TextBox cwBox = null!; private TextBox textBox = null!; private ShakeContainer shakeSignIn = null!; + private bool toggleCw = false; + private Bindable file = null!; + private string[] fileTypes = new string[] { ".jpg", ".jpeg", ".png" }; + private string choosePath = ""; [Resolved] private IAPIProvider api { get; set; } = null!; @@ -74,7 +85,6 @@ namespace osu.Game.Screens.Misskey.Components Text = "送信しています", Icon = FontAwesome.Solid.PaperPlane, }); - } [BackgroundDependencyLoader(permitNulls: true)] @@ -94,7 +104,7 @@ namespace osu.Game.Screens.Misskey.Components { PlaceholderText = "CW", RelativeSizeAxes = Axes.X, - TabbableContentContainer = this + TabbableContentContainer = this, }, textBox = new OsuTextBox { @@ -148,12 +158,60 @@ namespace osu.Game.Screens.Misskey.Components { onScreenDisplay?.Display(new ResToast("送信しています", "")); } + }, + new FillFlowContainer + { + // Direction = FillDirection.Horizontal, + Spacing = new Vector2(20), + // Origin = Anchor.Centre, + // Anchor = Anchor.Centre, + Size = new Vector2(500, 200), + Children = new[] + { + new IconButton + { + Icon = FontAwesome.Solid.Image, + Size = new Vector2(30), + Action = () => this.ShowPopover() + }, + new IconButton + { + Icon = FontAwesome.Solid.PollH, + Size = new Vector2(30), + Action = () => toggleCw = !toggleCw + }, + new IconButton + { + Icon = FontAwesome.Solid.EyeSlash, + Size = new Vector2(30), + Action = () => toggleCw = !toggleCw + }, + new IconButton + { + Icon = FontAwesome.Solid.At, + Size = new Vector2(30), + Action = () => toggleCw = !toggleCw + }, + new IconButton + { + Icon = FontAwesome.Solid.Hashtag, + Size = new Vector2(30), + Action = () => toggleCw = !toggleCw + }, + new IconButton + { + Icon = FontAwesome.Solid.LaughSquint, + Size = new Vector2(30), + Action = () => cwBox.Show() + }, + } } }; // forgottenPaswordLink.AddLink(LayoutStrings.PopupLoginLoginForgot, $"https://simkey.net/about"); textBox.OnCommit += (_, _) => post(); + cwBox.Hide(); if (api.LastLoginError?.Message is string error) errorText.AddErrors(new[] { error }); @@ -161,11 +219,15 @@ namespace osu.Game.Screens.Misskey.Components public override bool AcceptsFocus => true; + + public Popover GetPopover() => new FilePickerPopover(choosePath, fileTypes, file); + protected override bool OnClick(ClickEvent e) => true; - // protected override void OnFocus(FocusEvent e) - // { - // Schedule(() => { GetContainingInputManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); }); - // } + protected override void OnFocus(FocusEvent e) + { + Schedule(() => { GetContainingInputManager().ChangeFocus(textBox); }); + } } + } diff --git a/osu.Game/Screens/Misskey/MisskeyInstanceSelect.cs b/osu.Game/Screens/Misskey/MisskeyInstanceSelect.cs index fb9fce5f70..d6802a458e 100644 --- a/osu.Game/Screens/Misskey/MisskeyInstanceSelect.cs +++ b/osu.Game/Screens/Misskey/MisskeyInstanceSelect.cs @@ -29,15 +29,17 @@ namespace osu.Game.Screens.Misskey { private Container contentContainer; - private SeekLimitedSearchTextBox searchTextBox; + private SearchTextBox searchTextBox; // private OsuButton submitButton; // private string instanceName = String.Empty; - // [Resolved] - private IAPIProvider api { get; set; } + private OsuSpriteText instanceNameText; + private OsuSpriteText instanceVersionText; + private OsuSpriteText instanceDescriptionText; - private Online.MisskeyAPI.Requests.Meta request; + [Resolved] + private IAPIProvider api { get; set; } [Resolved] private INotificationOverlay notificationOverlay { get; set; } @@ -49,7 +51,7 @@ namespace osu.Game.Screens.Misskey [BackgroundDependencyLoader(true)] private void load(IAPIProvider api, INotificationOverlay notifications) { - InternalChild = contentContainer = new Container + InternalChild = contentContainer = new Container() { Masking = true, CornerRadius = 10, @@ -82,7 +84,7 @@ namespace osu.Game.Screens.Misskey Colour = colours.Yellow, Alpha = 1, }, - searchTextBox = new SeekLimitedSearchTextBox() + searchTextBox = new SearchTextBox() { RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, @@ -101,20 +103,38 @@ namespace osu.Game.Screens.Misskey } } }, + new FillFlowContainer() + { + X = 10, + Children = new Drawable[] + { + instanceNameText = new OsuSpriteText(), + instanceVersionText = new OsuSpriteText(), + instanceDescriptionText = new OsuSpriteText() + } + } } }; // insetanceFetch(); - // - // searchTextBox.Current.ValueChanged += _ => insetanceFetch(); + // // + // searchTextBox.Current.BindValueChanged(_ => insetanceFetch(), true); } private void insetanceFetch() { - request = new Meta(); + var request = new Meta(searchTextBox.Text); - request.Success += () => + request.Success += e => { + notificationOverlay?.Post(new SimpleNotification + { + Text = e.Name, + Icon = FontAwesome.Solid.Check, + }); + instanceNameText.Text = e.Name; + instanceVersionText.Text = e.Version; + instanceDescriptionText.Text = e.Description; }; request.Failure += e => diff --git a/osu.Game/Screens/Misskey/MisskeyLogin.cs b/osu.Game/Screens/Misskey/MisskeyLogin.cs index 40e64db4d4..3d040677c2 100644 --- a/osu.Game/Screens/Misskey/MisskeyLogin.cs +++ b/osu.Game/Screens/Misskey/MisskeyLogin.cs @@ -45,7 +45,7 @@ namespace osu.Game.Screens.Misskey RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(0.5f, 0.4f), + Size = new Vector2(0.5f, 0.5f), Children = new Drawable[] { new Box diff --git a/osu.Game/Screens/Misskey/MisskeyPost.cs b/osu.Game/Screens/Misskey/MisskeyPost.cs index 2e68700068..50ee6465c8 100644 --- a/osu.Game/Screens/Misskey/MisskeyPost.cs +++ b/osu.Game/Screens/Misskey/MisskeyPost.cs @@ -6,9 +6,11 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Game.Graphics; using osuTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; using osu.Game.Misskey.Overlays.Login; @@ -55,7 +57,7 @@ namespace osu.Game.Screens.Misskey Colour = Color4.Black, Alpha = 0.6f, }, - new Container + new PopoverContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -83,5 +85,9 @@ namespace osu.Game.Screens.Misskey } }; } + protected override void OnFocus(FocusEvent e) + { + Schedule(() => { GetContainingInputManager().ChangeFocus(form); }); + } } }