mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
improve note component
This commit is contained in:
parent
dd81505982
commit
c92f67f30b
@ -5,13 +5,17 @@
|
|||||||
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using osu.Framework.IO.Network;
|
using osu.Framework.IO.Network;
|
||||||
|
using osu.Game.Online.MisskeyAPI.Responses.Types;
|
||||||
|
|
||||||
namespace osu.Game.Online.MisskeyAPI.Requests
|
namespace osu.Game.Online.MisskeyAPI.Requests
|
||||||
{
|
{
|
||||||
public class Meta : APIRequest
|
public class Meta : APIRequest<InstanceMetadata>
|
||||||
{
|
{
|
||||||
public Meta()
|
|
||||||
|
private readonly string endpoint;
|
||||||
|
public Meta(string endpoint)
|
||||||
{
|
{
|
||||||
|
this.endpoint = endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override WebRequest CreateWebRequest()
|
protected override WebRequest CreateWebRequest()
|
||||||
@ -21,7 +25,7 @@ namespace osu.Game.Online.MisskeyAPI.Requests
|
|||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string Uri => $@"https://misskey.io/api/meta";
|
protected override string Uri => $@"https://{endpoint}/api/meta";
|
||||||
protected override string Target => @"meta";
|
protected override string Target => @"";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
60
osu.Game/Online/MisskeyAPI/Requests/Notes/CreateRenote.cs
Normal file
60
osu.Game/Online/MisskeyAPI/Requests/Notes/CreateRenote.cs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
// Copyright (c) sim1222 <kokt@sim1222.com>. 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<MisskeyAPI.Responses.Types.Note>
|
||||||
|
{
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
@ -53,6 +53,6 @@ namespace osu.Game.Online.MisskeyAPI.Requests.Notes
|
|||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string Target => @"notes/hybrid-timeline";
|
protected override string Target => @"notes/local-timeline";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
// Copyright (c) sim1222 <kokt@sim1222.com>. 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<NullResponse>
|
||||||
|
{
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
13
osu.Game/Online/MisskeyAPI/Responses/NullResponse.cs
Normal file
13
osu.Game/Online/MisskeyAPI/Responses/NullResponse.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// 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 Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.MisskeyAPI.Requests.Responses
|
||||||
|
{
|
||||||
|
public class NullResponse
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
81
osu.Game/Screens/Misskey/Components/FilePickerPopover.cs
Normal file
81
osu.Game/Screens/Misskey/Components/FilePickerPopover.cs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
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<FileInfo?> currentFile;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Bindable<RulesetInfo> ruleset { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private RealmAccess realm { get; set; } = null!;
|
||||||
|
|
||||||
|
public FilePickerPopover(string choosePath, string[] allowedExtensions, Bindable<FileInfo?> 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<Visibility> state)
|
||||||
|
{
|
||||||
|
base.UpdateState(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,14 +5,20 @@ using System.Collections.Generic;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps.Drawables.Cards;
|
using osu.Game.Beatmaps.Drawables.Cards;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.MisskeyAPI;
|
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;
|
||||||
using osu.Game.Overlays.BeatmapSet;
|
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.Resources.Localisation.Web;
|
||||||
using osu.Game.Screens.Misskey.Components.Note.Cards.Statistics;
|
using osu.Game.Screens.Misskey.Components.Note.Cards.Statistics;
|
||||||
using osu.Game.Skinning.Components;
|
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 IdleContent => idleBottomContent;
|
||||||
protected override Drawable DownloadInProgressContent => downloadProgressBar;
|
protected override Drawable DownloadInProgressContent => downloadProgressBar;
|
||||||
|
|
||||||
private const float height = 100;
|
private const float height = 120;
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private readonly NoteCardContent content;
|
private readonly NoteCardContent content;
|
||||||
@ -39,9 +45,17 @@ namespace osu.Game.Screens.Misskey.Components.Note.Cards
|
|||||||
private FillFlowContainer idleBottomContent = null!;
|
private FillFlowContainer idleBottomContent = null!;
|
||||||
private BeatmapCardDownloadProgressBar downloadProgressBar = null!;
|
private BeatmapCardDownloadProgressBar downloadProgressBar = null!;
|
||||||
|
|
||||||
|
private IconButton replyButton = null!;
|
||||||
|
private IconButton renoteButton = null!;
|
||||||
|
private IconButton reactButton = null!;
|
||||||
|
private IconButton menuButton = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private INotificationOverlay? notifications { get; set; }
|
||||||
|
|
||||||
// [Resolved]
|
// [Resolved]
|
||||||
// private OverlayColourProvider colourProvider { get; set; } = null!;
|
// private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||||
|
|
||||||
@ -74,7 +88,7 @@ namespace osu.Game.Screens.Misskey.Components.Note.Cards
|
|||||||
thumbnail = new NoteCardAvatar(Note)
|
thumbnail = new NoteCardAvatar(Note)
|
||||||
{
|
{
|
||||||
Name = @"Left (icon) area",
|
Name = @"Left (icon) area",
|
||||||
Size = new Vector2(height - 10),
|
Size = new Vector2(Width * 0.2f),
|
||||||
// Padding = new MarginPadding { Right = CORNER_RADIUS },
|
// Padding = new MarginPadding { Right = CORNER_RADIUS },
|
||||||
Child = leftIconArea = new FillFlowContainer
|
Child = leftIconArea = new FillFlowContainer
|
||||||
{
|
{
|
||||||
@ -93,124 +107,178 @@ namespace osu.Game.Screens.Misskey.Components.Note.Cards
|
|||||||
// ButtonsExpandedWidth = 30,
|
// ButtonsExpandedWidth = 30,
|
||||||
// Children = new Drawable[]
|
// 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,
|
RelativeSizeAxes = Axes.X,
|
||||||
X = height,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.Both,
|
ColumnDimensions = new[]
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new GridContainer
|
new Dimension(),
|
||||||
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
|
},
|
||||||
|
RowDimensions = new[]
|
||||||
|
{
|
||||||
|
new Dimension(GridSizeMode.AutoSize)
|
||||||
|
},
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
new OsuSpriteText()
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
ColumnDimensions = new[]
|
|
||||||
{
|
{
|
||||||
new Dimension(),
|
Text = new RomanisableString(Note.User.Name, Note.User.Username),
|
||||||
new Dimension(GridSizeMode.AutoSize),
|
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)
|
Anchor = Anchor.BottomRight,
|
||||||
},
|
Origin = Anchor.BottomRight,
|
||||||
Content = new[]
|
AutoSizeAxes = Axes.Both,
|
||||||
{
|
Direction = FillDirection.Horizontal,
|
||||||
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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
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",
|
Name = @"Bottom content",
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Anchor = Anchor.BottomLeft,
|
// Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
// Origin = Anchor.BottomLeft,
|
||||||
Children = new Drawable[]
|
// 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,
|
replyButton = new IconButton()
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Spacing = new Vector2(0, 3),
|
|
||||||
AlwaysPresent = true,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
// statisticsContainer = new FillFlowContainer<BeatmapCardStatistic>
|
Icon = FontAwesome.Solid.Reply,
|
||||||
// {
|
},
|
||||||
// RelativeSizeAxes = Axes.X,
|
renoteButton = new IconButton()
|
||||||
// AutoSizeAxes = Axes.Y,
|
{
|
||||||
// Direction = FillDirection.Horizontal,
|
Icon = FontAwesome.Solid.Retweet,
|
||||||
// Spacing = new Vector2(10, 0),
|
Action = () =>
|
||||||
// Alpha = 0,
|
{
|
||||||
// AlwaysPresent = true,
|
var req = new CreateRenote(api.AccessToken, Note.Id);
|
||||||
// ChildrenEnumerable = createStatistics()
|
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,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,14 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.LocalisationExtensions;
|
using osu.Framework.Extensions.LocalisationExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
@ -13,6 +17,7 @@ using osu.Game.Configuration;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
using osu.Game.Online.MisskeyAPI;
|
using osu.Game.Online.MisskeyAPI;
|
||||||
using osu.Game.Misskey.Overlays.Settings;
|
using osu.Game.Misskey.Overlays.Settings;
|
||||||
using osu.Game.Online.MisskeyAPI.Requests.Notes;
|
using osu.Game.Online.MisskeyAPI.Requests.Notes;
|
||||||
@ -25,11 +30,13 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Misskey.Components
|
namespace osu.Game.Screens.Misskey.Components
|
||||||
{
|
{
|
||||||
public partial class PostForm : FillFlowContainer
|
public partial class PostForm : FillFlowContainer, IHasPopover
|
||||||
{
|
{
|
||||||
private OnScreenDisplay? onScreenDisplay { get; set; }
|
private OnScreenDisplay? onScreenDisplay { get; set; }
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private INotificationOverlay? notifications { get; set; }
|
private INotificationOverlay? notifications { get; set; }
|
||||||
|
|
||||||
private partial class ResToast : Toast
|
private partial class ResToast : Toast
|
||||||
{
|
{
|
||||||
public ResToast(string value, string desc)
|
public ResToast(string value, string desc)
|
||||||
@ -41,6 +48,10 @@ namespace osu.Game.Screens.Misskey.Components
|
|||||||
private TextBox cwBox = null!;
|
private TextBox cwBox = null!;
|
||||||
private TextBox textBox = null!;
|
private TextBox textBox = null!;
|
||||||
private ShakeContainer shakeSignIn = null!;
|
private ShakeContainer shakeSignIn = null!;
|
||||||
|
private bool toggleCw = false;
|
||||||
|
private Bindable<FileInfo?> file = null!;
|
||||||
|
private string[] fileTypes = new string[] { ".jpg", ".jpeg", ".png" };
|
||||||
|
private string choosePath = "";
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
@ -74,7 +85,6 @@ namespace osu.Game.Screens.Misskey.Components
|
|||||||
Text = "送信しています",
|
Text = "送信しています",
|
||||||
Icon = FontAwesome.Solid.PaperPlane,
|
Icon = FontAwesome.Solid.PaperPlane,
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
@ -94,7 +104,7 @@ namespace osu.Game.Screens.Misskey.Components
|
|||||||
{
|
{
|
||||||
PlaceholderText = "CW",
|
PlaceholderText = "CW",
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
TabbableContentContainer = this
|
TabbableContentContainer = this,
|
||||||
},
|
},
|
||||||
textBox = new OsuTextBox
|
textBox = new OsuTextBox
|
||||||
{
|
{
|
||||||
@ -148,12 +158,60 @@ namespace osu.Game.Screens.Misskey.Components
|
|||||||
{
|
{
|
||||||
onScreenDisplay?.Display(new ResToast("送信しています", ""));
|
onScreenDisplay?.Display(new ResToast("送信しています", ""));
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
new FillFlowContainer<IconButton>
|
||||||
|
{
|
||||||
|
// 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");
|
// forgottenPaswordLink.AddLink(LayoutStrings.PopupLoginLoginForgot, $"https://simkey.net/about");
|
||||||
|
|
||||||
textBox.OnCommit += (_, _) => post();
|
textBox.OnCommit += (_, _) => post();
|
||||||
|
cwBox.Hide();
|
||||||
|
|
||||||
if (api.LastLoginError?.Message is string error)
|
if (api.LastLoginError?.Message is string error)
|
||||||
errorText.AddErrors(new[] { error });
|
errorText.AddErrors(new[] { error });
|
||||||
@ -161,11 +219,15 @@ namespace osu.Game.Screens.Misskey.Components
|
|||||||
|
|
||||||
public override bool AcceptsFocus => true;
|
public override bool AcceptsFocus => true;
|
||||||
|
|
||||||
|
|
||||||
|
public Popover GetPopover() => new FilePickerPopover(choosePath, fileTypes, file);
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e) => true;
|
protected override bool OnClick(ClickEvent e) => true;
|
||||||
|
|
||||||
// protected override void OnFocus(FocusEvent e)
|
protected override void OnFocus(FocusEvent e)
|
||||||
// {
|
{
|
||||||
// Schedule(() => { GetContainingInputManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); });
|
Schedule(() => { GetContainingInputManager().ChangeFocus(textBox); });
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,15 +29,17 @@ namespace osu.Game.Screens.Misskey
|
|||||||
{
|
{
|
||||||
private Container contentContainer;
|
private Container contentContainer;
|
||||||
|
|
||||||
private SeekLimitedSearchTextBox searchTextBox;
|
private SearchTextBox searchTextBox;
|
||||||
// private OsuButton submitButton;
|
// private OsuButton submitButton;
|
||||||
|
|
||||||
// private string instanceName = String.Empty;
|
// private string instanceName = String.Empty;
|
||||||
|
|
||||||
// [Resolved]
|
private OsuSpriteText instanceNameText;
|
||||||
private IAPIProvider api { get; set; }
|
private OsuSpriteText instanceVersionText;
|
||||||
|
private OsuSpriteText instanceDescriptionText;
|
||||||
|
|
||||||
private Online.MisskeyAPI.Requests.Meta request;
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private INotificationOverlay notificationOverlay { get; set; }
|
private INotificationOverlay notificationOverlay { get; set; }
|
||||||
@ -49,7 +51,7 @@ namespace osu.Game.Screens.Misskey
|
|||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(IAPIProvider api, INotificationOverlay notifications)
|
private void load(IAPIProvider api, INotificationOverlay notifications)
|
||||||
{
|
{
|
||||||
InternalChild = contentContainer = new Container
|
InternalChild = contentContainer = new Container()
|
||||||
{
|
{
|
||||||
Masking = true,
|
Masking = true,
|
||||||
CornerRadius = 10,
|
CornerRadius = 10,
|
||||||
@ -82,7 +84,7 @@ namespace osu.Game.Screens.Misskey
|
|||||||
Colour = colours.Yellow,
|
Colour = colours.Yellow,
|
||||||
Alpha = 1,
|
Alpha = 1,
|
||||||
},
|
},
|
||||||
searchTextBox = new SeekLimitedSearchTextBox()
|
searchTextBox = new SearchTextBox()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Origin = Anchor.TopCentre,
|
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();
|
// insetanceFetch();
|
||||||
//
|
// //
|
||||||
// searchTextBox.Current.ValueChanged += _ => insetanceFetch();
|
// searchTextBox.Current.BindValueChanged(_ => insetanceFetch(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insetanceFetch()
|
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 =>
|
request.Failure += e =>
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Screens.Misskey
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(0.5f, 0.4f),
|
Size = new Vector2(0.5f, 0.5f),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Misskey.Overlays.Login;
|
using osu.Game.Misskey.Overlays.Login;
|
||||||
@ -55,7 +57,7 @@ namespace osu.Game.Screens.Misskey
|
|||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
Alpha = 0.6f,
|
Alpha = 0.6f,
|
||||||
},
|
},
|
||||||
new Container
|
new PopoverContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
@ -83,5 +85,9 @@ namespace osu.Game.Screens.Misskey
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
protected override void OnFocus(FocusEvent e)
|
||||||
|
{
|
||||||
|
Schedule(() => { GetContainingInputManager().ChangeFocus(form); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user