Fix iOS importing

This commit is contained in:
DTSDAO 2019-08-05 22:30:35 +08:00
parent fb4f6dd27c
commit 0fe6585975
5 changed files with 18 additions and 18 deletions

View File

@ -54,7 +54,7 @@ namespace osu.Game.Database
public virtual string[] HandledExtensions => new[] { ".zip" }; public virtual string[] HandledExtensions => new[] { ".zip" };
public virtual bool SupportsImportFromStable => RuntimeInfo.IsDesktop; public virtual bool SupportsImportFromStable => (RuntimeInfo.IsDesktop || RuntimeInfo.OS == RuntimeInfo.Platform.iOS);
protected readonly FileStore Files; protected readonly FileStore Files;

View File

@ -91,8 +91,6 @@ namespace osu.Game
private IntroScreen introScreen; private IntroScreen introScreen;
private bool loaded;
private Bindable<int> configRuleset; private Bindable<int> configRuleset;
private Bindable<int> configSkin; private Bindable<int> configSkin;
@ -201,18 +199,15 @@ namespace osu.Game
{ {
Logger.Log($"Request to handle url: {url}"); Logger.Log($"Request to handle url: {url}");
if (loaded) Action showNotImplementedError = () => notifications?.Post(new SimpleNotification
{ {
Action showNotImplementedError = () => notifications?.Post(new SimpleNotification Text = @"This link type is not yet supported!",
{ Icon = FontAwesome.Solid.LifeRing,
Text = @"This link type is not yet supported!", });
Icon = FontAwesome.Solid.LifeRing,
}); LinkDetails linkDetails = GetLinkDetails(url);
LinkDetails linkDetails = GetLinkDetails(url);
Schedule(() => LinkUtils.HandleLink(url, linkDetails.Action, linkDetails.Argument, this, channelManager, showNotImplementedError)); Schedule(() => LinkUtils.HandleLink(url, linkDetails.Action, linkDetails.Argument, this, channelManager, showNotImplementedError));
}
else
Scheduler.AddDelayed(() => HandleUrl(url), 1000);
} }
public void OpenUrlExternally(string url) public void OpenUrlExternally(string url)
@ -403,8 +398,6 @@ namespace osu.Game
protected override void LoadComplete() protected override void LoadComplete()
{ {
loaded = false;
base.LoadComplete(); base.LoadComplete();
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results // The next time this is updated is in UpdateAfterChildren, which occurs too late and results
@ -600,7 +593,6 @@ namespace osu.Game
settings.State.ValueChanged += _ => updateScreenOffset(); settings.State.ValueChanged += _ => updateScreenOffset();
notifications.State.ValueChanged += _ => updateScreenOffset(); notifications.State.ValueChanged += _ => updateScreenOffset();
loaded = true;
} }
public class GameIdleTracker : IdleTracker public class GameIdleTracker : IdleTracker

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Threading.Tasks;
using Foundation; using Foundation;
using osu.Framework.iOS; using osu.Framework.iOS;
using osu.Framework.Threading; using osu.Framework.Threading;
@ -17,7 +18,10 @@ namespace osu.iOS
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{ {
game.HandleUrl(url.AbsoluteString); if (url.IsFileUrl)
Task.Run(() => game.Import(url.Path));
else
Task.Run(() => game.HandleUrl(url.AbsoluteString));
return true; return true;
} }
} }

View File

@ -14,6 +14,8 @@
<string>0.1.0</string> <string>0.1.0</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>
<string>10.0</string> <string>10.0</string>
<key>UIDeviceFamily</key> <key>UIDeviceFamily</key>

View File

@ -3,12 +3,14 @@
using System; using System;
using Foundation; using Foundation;
using osu.Framework.Platform;
using osu.Game; using osu.Game;
namespace osu.iOS namespace osu.iOS
{ {
public class OsuGameIOS : OsuGame public class OsuGameIOS : OsuGame
{ {
public override Storage GetStorageForStableInstall() => Storage;
public override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString()); public override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString());
} }
} }