mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 00:42:55 +08:00
Merge pull request #24183 from Susko3/framework-clipboard
Resolve `Clipboard` via DI
This commit is contained in:
commit
34e3276d23
@ -11,7 +11,7 @@
|
|||||||
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
|
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.710.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.714.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" />
|
<AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" />
|
||||||
|
@ -43,6 +43,9 @@ namespace osu.Game.Graphics
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; }
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Clipboard clipboard { get; set; }
|
||||||
|
|
||||||
private Storage storage;
|
private Storage storage;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
@ -116,7 +119,7 @@ namespace osu.Game.Graphics
|
|||||||
|
|
||||||
using (var image = await host.TakeScreenshotAsync().ConfigureAwait(false))
|
using (var image = await host.TakeScreenshotAsync().ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
host.GetClipboard()?.SetImage(image);
|
clipboard.SetImage(image);
|
||||||
|
|
||||||
(string filename, var stream) = getWritableStream();
|
(string filename, var stream) = getWritableStream();
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; } = null!;
|
private GameHost host { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Clipboard clipboard { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OnScreenDisplay? onScreenDisplay { get; set; }
|
private OnScreenDisplay? onScreenDisplay { get; set; }
|
||||||
|
|
||||||
@ -92,8 +95,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private void copyUrl()
|
private void copyUrl()
|
||||||
{
|
{
|
||||||
host.GetClipboard()?.SetText(Link);
|
if (Link != null)
|
||||||
|
{
|
||||||
|
clipboard.SetText(Link);
|
||||||
onScreenDisplay?.Display(new CopyUrlToast());
|
onScreenDisplay?.Display(new CopyUrlToast());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,9 @@ namespace osu.Game.Online.Chat
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; } = null!;
|
private GameHost host { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Clipboard clipboard { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private IDialogOverlay? dialogOverlay { get; set; }
|
private IDialogOverlay? dialogOverlay { get; set; }
|
||||||
|
|
||||||
@ -32,7 +35,7 @@ namespace osu.Game.Online.Chat
|
|||||||
public void OpenUrlExternally(string url, bool bypassWarning = false)
|
public void OpenUrlExternally(string url, bool bypassWarning = false)
|
||||||
{
|
{
|
||||||
if (!bypassWarning && externalLinkWarning.Value && dialogOverlay != null)
|
if (!bypassWarning && externalLinkWarning.Value && dialogOverlay != null)
|
||||||
dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url), () => host.GetClipboard()?.SetText(url)));
|
dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url), () => clipboard.SetText(url)));
|
||||||
else
|
else
|
||||||
host.OpenUrlExternally(url);
|
host.OpenUrlExternally(url);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; } = null!;
|
private Clipboard clipboard { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OnScreenDisplay? onScreenDisplay { get; set; }
|
private OnScreenDisplay? onScreenDisplay { get; set; }
|
||||||
@ -444,7 +444,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
|
|
||||||
private void copyUrl()
|
private void copyUrl()
|
||||||
{
|
{
|
||||||
host.GetClipboard()?.SetText($@"{api.APIEndpointUrl}/comments/{Comment.Id}");
|
clipboard.SetText($@"{api.APIEndpointUrl}/comments/{Comment.Id}");
|
||||||
onScreenDisplay?.Display(new CopyUrlToast());
|
onScreenDisplay?.Display(new CopyUrlToast());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Edit.Compose
|
|||||||
public partial class ComposeScreen : EditorScreenWithTimeline, IGameplaySettings
|
public partial class ComposeScreen : EditorScreenWithTimeline, IGameplaySettings
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; }
|
private Clipboard hostClipboard { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorClock clock { get; set; }
|
private EditorClock clock { get; set; }
|
||||||
@ -116,7 +116,7 @@ namespace osu.Game.Screens.Edit.Compose
|
|||||||
// regardless of whether anything was even selected at all.
|
// regardless of whether anything was even selected at all.
|
||||||
// UX-wise this is generally strange and unexpected, but make it work anyways to preserve muscle memory.
|
// UX-wise this is generally strange and unexpected, but make it work anyways to preserve muscle memory.
|
||||||
// note that this means that `getTimestamp()` must handle no-selection case, too.
|
// note that this means that `getTimestamp()` must handle no-selection case, too.
|
||||||
host.GetClipboard()?.SetText(getTimestamp());
|
hostClipboard.SetText(getTimestamp());
|
||||||
|
|
||||||
if (CanCopy.Value)
|
if (CanCopy.Value)
|
||||||
clipboard.Value = new ClipboardContent(EditorBeatmap).Serialize();
|
clipboard.Value = new ClipboardContent(EditorBeatmap).Serialize();
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="11.1.2" />
|
<PackageReference Include="Realm" Version="11.1.2" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2023.710.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2023.714.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.707.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.707.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.28.1" />
|
<PackageReference Include="Sentry" Version="3.28.1" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
||||||
|
@ -16,6 +16,6 @@
|
|||||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.710.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.714.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user