Skip to content

Commit

Permalink
Merge pull request #31026 from frenzibyte/ios-system-file-import
Browse files Browse the repository at this point in the history
Add special handling for file import button on iOS
  • Loading branch information
peppy authored Jan 21, 2025
2 parents 0a97fb6 + 3f51626 commit 704c2ea
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Game.Localisation;
using osu.Game.Screens;
Expand All @@ -15,22 +19,33 @@ public partial class GeneralSettings : SettingsSubsection
{
protected override LocalisableString Header => CommonStrings.General;

private ISystemFileSelector? selector;

[BackgroundDependencyLoader]
private void load(IPerformFromScreenRunner? performer)
private void load(OsuGameBase game, GameHost host, IPerformFromScreenRunner? performer)
{
Children = new[]
if ((selector = host.CreateSystemFileSelector(game.HandledExtensions.ToArray())) != null)
selector.Selected += f => Task.Run(() => game.Import(f.FullName));

AddRange(new Drawable[]
{
new SettingsButton
{
Text = DebugSettingsStrings.ImportFiles,
Action = () => performer?.PerformFromScreen(menu => menu.Push(new FileImportScreen()))
Action = () =>
{
if (selector != null)
selector.Present();
else
performer?.PerformFromScreen(menu => menu.Push(new FileImportScreen()));
},
},
new SettingsButton
{
Text = DebugSettingsStrings.RunLatencyCertifier,
Action = () => performer?.PerformFromScreen(menu => menu.Push(new LatencyCertifierScreen()))
}
};
});
}
}
}

0 comments on commit 704c2ea

Please sign in to comment.