File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#pragma once
22
3+ #include < bdn/String.h>
34#include < memory>
45
56namespace bdn
@@ -17,5 +18,6 @@ namespace bdn
1718 virtual void onSuspend () {}
1819 virtual void onResume () {}
1920 virtual void onTerminate () {}
21+ virtual void onOpenURL (const String &url) {}
2022 };
2123}
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ namespace bdn::ui::ios
3030 void _applicationDidEnterBackground ();
3131 void _applicationWillEnterForeground ();
3232 void _applicationWillTerminate ();
33+ bool _applicationOpenURL (NSURL *url);
3334
3435 private:
3536 void buildCommandlineArguments (int argCount, char *args[]);
Original file line number Diff line number Diff line change @@ -78,6 +78,16 @@ - (void)applicationWillTerminate:(UIApplication *)application
7878 }
7979}
8080
81+ - (BOOL )application : (UIApplication *)app
82+ openURL : (NSURL *)url
83+ options : (NSDictionary <UIApplicationOpenURLOptionsKey, id> *)options
84+ {
85+ if (auto app = self.bdnApplication .lock ()) {
86+ return app->_applicationOpenURL (url) ? YES : NO ;
87+ }
88+ return NO ;
89+ }
90+
8191@end
8292
8393namespace bdn ::ui::ios
@@ -188,6 +198,16 @@ - (void)applicationWillTerminate:(UIApplication *)application
188198 bdn::platformEntryWrapper ([&]() { applicationController ()->onTerminate (); }, false );
189199 }
190200
201+ bool UIApplication::_applicationOpenURL (NSURL *url)
202+ {
203+ if (!url) {
204+ return false ;
205+ }
206+ bdn::String bdnUrl = [url absoluteString ].UTF8String ;
207+ bdn::platformEntryWrapper ([&]() { applicationController ()->onOpenURL (bdnUrl); }, false );
208+ return true ;
209+ }
210+
191211 void UIApplication::initiateExitIfPossible (int exitCode) {}
192212
193213 void UIApplication::disposeMainDispatcher ()
You can’t perform that action at this time.
0 commit comments