File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -38,12 +38,17 @@ open class Manager {
3838 // keep request for callback
3939 var requests : [ RequestID : Request ] = [ : ]
4040
41+ #if CALLBACK_IN_APP_EXTENSIONS
42+ // extension context to open url (only if compiled with CALLBACK_IN_APP_EXTENSIONS)
43+ open static var extensionContext : NSExtensionContext ?
44+ #endif
45+
4146 // Specify an URL scheme for callback
4247 open var callbackURLScheme : String ?
43-
48+
4449 init ( ) {
4550 }
46-
51+
4752 // Add an action handler ie. url path and block
4853 open subscript( action: Action ) -> ActionHandler ? {
4954 get {
@@ -232,9 +237,13 @@ open class Manager {
232237 return result
233238 }
234239
235- static func open( url: Foundation . URL ) {
240+ public static func open( url: Foundation . URL ) {
236241 #if os(iOS) || os(tvOS)
237- UIApplication . shared. openURL ( url)
242+ #if !CALLBACK_IN_APP_EXTENSIONS
243+ UIApplication . shared. openURL ( url)
244+ #else
245+ extensionContext? . open ( url, completionHandler: nil )
246+ #endif
238247 #elseif os(OSX)
239248 NSWorkspace . shared ( ) . open ( url)
240249 #endif
You can’t perform that action at this time.
0 commit comments