Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions addons/ofxiOS/src/app/ofAppiOSWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
#endif
#include "ofxiOSGLKView.h"
#include "ofxiOSEAGLView.h"
#include "ofxiOSAlerts.h"

// iOS 13+ / 26+: Info.plist UIApplicationSceneManifest names this class.
// UIKit delivers opened URLs to scene:openURLContexts:.
@interface ofxiOSSceneDelegate : UIResponder <UIWindowSceneDelegate>
@property (strong, nonatomic) UIWindow * window;
@end
Expand Down Expand Up @@ -84,17 +87,18 @@ - (void)sceneDidEnterBackground:(UIScene *)scene {
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
for (UIOpenURLContext * context in URLContexts) {
if ([appDelegate respondsToSelector:@selector(application:openURL:options:)]) {
[appDelegate application:[UIApplication sharedApplication] openURL:context.URL options:@{}];
NSURL * url = context.URL;
if (!url) {
continue;
}
#if !TARGET_OS_TV
else if ([appDelegate respondsToSelector:@selector(application:handleOpenURL:)]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[appDelegate application:[UIApplication sharedApplication] handleOpenURL:context.URL];
#pragma clang diagnostic pop
if ([appDelegate respondsToSelector:@selector(application:openURL:options:)]) {
[appDelegate application:[UIApplication sharedApplication] openURL:url options:@{}];
} else {
NSString * urlData = [url absoluteString];
if (urlData) {
ofxiOSAlerts.launchedWithURL([urlData UTF8String]);
}
}
#endif
}
}

Expand Down
4 changes: 4 additions & 0 deletions addons/ofxiOS/src/core/ofxiOSAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
@property (nonatomic, strong) UIViewController * uiViewController;
@property (readonly) NSInteger currentScreenIndex;

- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options;

- (BOOL)application:(UIApplication*)application
handleOpenURL:(NSURL*)url;

Expand Down
8 changes: 7 additions & 1 deletion addons/ofxiOS/src/core/ofxiOSAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,19 @@ - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
ofxiOSAlerts.gotMemoryWarning();
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
NSString *urlData = [url absoluteString];
const char * response = [urlData UTF8String];
ofxiOSAlerts.launchedWithURL(response);
return YES;
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [self application:application openURL:url options:@{}];
}

//-------------------------------------------------------------------------------------------
#ifdef __IPHONE_6_0
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
Expand Down
Loading