Skip to content

Commit

Permalink
Fix sharing via the Share & Action extensions on iOS 18 (#3745)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/414709148257752/1208991975879543/f
Tech Design URL:
CC:

**Description**:
Fixes sharing to the DDG app from the share + action extensions on iOS
18
  • Loading branch information
amddg44 authored Dec 19, 2024
1 parent 8a8f641 commit df948c9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 10 additions & 3 deletions OpenAction/ActionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,16 @@ class ActionViewController: UIViewController {
var responder = self as UIResponder?
let selectorOpenURL = sel_registerName("openURL:")
while let current = responder {
if current.responds(to: selectorOpenURL) {
current.perform(selectorOpenURL, with: url, afterDelay: 0)
break
if #available(iOS 18.0, *) {
if let application = current as? UIApplication {
application.open(url, options: [:], completionHandler: nil)
break
}
} else {
if current.responds(to: selectorOpenURL) {
current.perform(selectorOpenURL, with: url, afterDelay: 0)
break
}
}
responder = current.next
}
Expand Down
13 changes: 10 additions & 3 deletions ShareExtension/ShareViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,16 @@ class ShareViewController: SLComposeServiceViewController {
let deepLink = URL(string: AppDeepLinkSchemes.quickLink.appending(url.absoluteString))!
var responder = self as UIResponder?
while responder != nil {
if responder!.responds(to: selector) {
_ = responder?.perform(selector, with: deepLink, with: {})
break
if #available(iOS 18.0, *) {
if let application = responder as? UIApplication {
application.open(deepLink, options: [:], completionHandler: nil)
break
}
} else {
if responder!.responds(to: selector) {
_ = responder?.perform(selector, with: deepLink, with: {})
break
}
}
responder = responder!.next
}
Expand Down

0 comments on commit df948c9

Please sign in to comment.