mirror of
https://github.com/ppy/osu.git
synced 2025-01-18 11:52:54 +08:00
Merge pull request #31039 from frenzibyte/ios-temporary-export-storage
Use temporary storage for file exports on iOS
This commit is contained in:
commit
02c52e41bd
@ -9,6 +9,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
|
using osu.Game.IO;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
using Realms;
|
using Realms;
|
||||||
@ -46,7 +47,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
protected LegacyExporter(Storage storage)
|
protected LegacyExporter(Storage storage)
|
||||||
{
|
{
|
||||||
exportStorage = storage.GetStorageForDirectory(@"exports");
|
exportStorage = (storage as OsuStorage)?.GetExportStorage() ?? storage.GetStorageForDirectory(@"exports");
|
||||||
UserFileStorage = storage.GetStorageForDirectory(@"files");
|
UserFileStorage = storage.GetStorageForDirectory(@"files");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,11 @@ namespace osu.Game.IO
|
|||||||
TryChangeToCustomStorage(out Error);
|
TryChangeToCustomStorage(out Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the <see cref="Storage"/> used for storing exported files.
|
||||||
|
/// </summary>
|
||||||
|
public virtual Storage GetExportStorage() => GetStorageForDirectory(@"exports");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resets the custom storage path, changing the target storage to the default location.
|
/// Resets the custom storage path, changing the target storage to the default location.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -5,6 +5,8 @@ using System;
|
|||||||
using Foundation;
|
using Foundation;
|
||||||
using Microsoft.Maui.Devices;
|
using Microsoft.Maui.Devices;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.iOS;
|
||||||
|
using osu.Framework.Platform;
|
||||||
using osu.Game;
|
using osu.Game;
|
||||||
using osu.Game.Updater;
|
using osu.Game.Updater;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
@ -19,6 +21,8 @@ namespace osu.iOS
|
|||||||
|
|
||||||
protected override BatteryInfo CreateBatteryInfo() => new IOSBatteryInfo();
|
protected override BatteryInfo CreateBatteryInfo() => new IOSBatteryInfo();
|
||||||
|
|
||||||
|
protected override Storage CreateStorage(GameHost host, Storage defaultStorage) => new OsuStorageIOS((IOSGameHost)host, defaultStorage);
|
||||||
|
|
||||||
protected override Edges SafeAreaOverrideEdges =>
|
protected override Edges SafeAreaOverrideEdges =>
|
||||||
// iOS shows a home indicator at the bottom, and adds a safe area to account for this.
|
// iOS shows a home indicator at the bottom, and adds a safe area to account for this.
|
||||||
// Because we have the home indicator (mostly) hidden we don't really care about drawing in this region.
|
// Because we have the home indicator (mostly) hidden we don't really care about drawing in this region.
|
||||||
|
23
osu.iOS/OsuStorageIOS.cs
Normal file
23
osu.iOS/OsuStorageIOS.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// 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.IO;
|
||||||
|
using osu.Framework.iOS;
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.IO;
|
||||||
|
|
||||||
|
namespace osu.iOS
|
||||||
|
{
|
||||||
|
public class OsuStorageIOS : OsuStorage
|
||||||
|
{
|
||||||
|
private readonly IOSGameHost host;
|
||||||
|
|
||||||
|
public OsuStorageIOS(IOSGameHost host, Storage defaultStorage)
|
||||||
|
: base(host, defaultStorage)
|
||||||
|
{
|
||||||
|
this.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Storage GetExportStorage() => new IOSStorage(Path.GetTempPath(), host);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user