mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-13 01:45:45 +00:00
iOS: Fix SDL_EVENT_DROP_FILE lost on cold start from URL open
(cherry picked from commit 290f0c831f)
This commit is contained in:
parent
386be0070b
commit
efe6062cf4
1 changed files with 14 additions and 3 deletions
|
|
@ -343,6 +343,7 @@ API_AVAILABLE(ios(13.0))
|
|||
@implementation SDLUIKitSceneDelegate
|
||||
{
|
||||
UIWindow *launchWindow;
|
||||
NSMutableArray<NSURL *> *launchURLs;
|
||||
}
|
||||
|
||||
+ (NSString *)getSceneDelegateClassName
|
||||
|
|
@ -402,15 +403,16 @@ API_AVAILABLE(ios(13.0))
|
|||
// Set working directory to resource path
|
||||
[[NSFileManager defaultManager] changeCurrentDirectoryPath:[bundle resourcePath]];
|
||||
|
||||
// Handle any connection options (like opening URLs)
|
||||
launchURLs = [[NSMutableArray alloc] init];
|
||||
|
||||
for (NSUserActivity *activity in connectionOptions.userActivities) {
|
||||
if (activity.webpageURL) {
|
||||
[self handleURL:activity.webpageURL];
|
||||
[launchURLs addObject:activity.webpageURL];
|
||||
}
|
||||
}
|
||||
|
||||
for (UIOpenURLContext *urlContext in connectionOptions.URLContexts) {
|
||||
[self handleURL:urlContext.URL];
|
||||
[launchURLs addObject:urlContext.URL];
|
||||
}
|
||||
|
||||
SDL_SetMainReady();
|
||||
|
|
@ -479,6 +481,7 @@ API_AVAILABLE(ios(13.0))
|
|||
- (void)postFinishLaunch
|
||||
{
|
||||
[self performSelector:@selector(hideLaunchScreen) withObject:nil afterDelay:0.0];
|
||||
[self performSelector:@selector(processLaunchURLs) withObject:nil afterDelay:0.0];
|
||||
|
||||
SDL_SetiOSEventPump(true);
|
||||
exit_status = SDL_CallMainFunction(forward_argc, forward_argv, forward_main);
|
||||
|
|
@ -490,6 +493,14 @@ API_AVAILABLE(ios(13.0))
|
|||
}
|
||||
}
|
||||
|
||||
- (void)processLaunchURLs
|
||||
{
|
||||
for (NSURL *url in launchURLs) {
|
||||
[self handleURL:url];
|
||||
}
|
||||
launchURLs = nil;
|
||||
}
|
||||
|
||||
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options API_AVAILABLE(ios(13.0))
|
||||
{
|
||||
// This doesn't appear to be called, but it needs to be implemented to signal that we support the UIScene life cycle
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue