Skip to content

Commit

Permalink
🔊 Add link action logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaatttt committed Mar 7, 2024
1 parent 675d605 commit 307de07
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ internal class AppcuesLinkAction: AppcuesExperienceAction {

func execute(completion: @escaping ActionRegistry.Completion) {
guard let appcues = appcues else { return completion() }
let logger = appcues.config.logger

// If a delegate is provided from the host application, preference is to use it for
// handling navigation and invoking the completion handler.
if let delegate = appcues.navigationDelegate {
logger.info("@appcues/link: AppcuesNavigationDelegate opening %{private}@", url.absoluteString)
delegate.navigate(to: url, openExternally: openExternally) { _ in completion() }
return
}
Expand All @@ -66,16 +68,20 @@ internal class AppcuesLinkAction: AppcuesExperienceAction {
&& urlOpener.open(potentialUniversalLink: url)

if successfullyHandledUniversalLink {
logger.info("@appcues/link: universal link opened %{private}@", url.absoluteString)
completion()
} else {
if openExternally {
logger.info("@appcues/link: external link opening %{private}@", url.absoluteString)
urlOpener.open(url, options: [:]) { _ in completion() }
} else {
logger.info("@appcues/link: in-app link opening %{private}@", url.absoluteString)
urlOpener.topViewController()?.present(SFSafariViewController(url: url), animated: true, completion: completion)
}
}
} else {
// Scheme link
logger.info("@appcues/link: scheme link opening %{private}@", url.absoluteString)
urlOpener.open(url, options: [:]) { _ in completion() }
}
}
Expand Down

0 comments on commit 307de07

Please sign in to comment.