Add iOS URL Scheme support

This commit is contained in:
DTSDAO
2019-08-02 23:34:25 +08:00
parent 7a89476688
commit 1b5a9aecff
5 changed files with 93 additions and 51 deletions

View File

@ -1,10 +1,9 @@
// 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.Threading.Tasks;
using Foundation;
using osu.Framework.iOS;
using osu.Game;
using osu.Framework.Threading;
using UIKit;
namespace osu.iOS
@ -16,9 +15,9 @@ namespace osu.iOS
protected override Framework.Game CreateGame() => game = new OsuGameIOS();
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
Task.Run(() => game.Import(url.Path));
game.HandleUrl(url.AbsoluteString);
return true;
}
}

View File

@ -107,5 +107,19 @@
</array>
</dict>
</array>
<key>UIFileSharingEnabled</key>
<true/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>osu</string>
<string>osump</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
</dict>
</plist>