Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ final class NativeAlternativePaymentDefaultInteractor:
let didOpenUrl: Bool
switch currentState.redirect.type {
case .deepLink:
didOpenUrl = await UIApplication.shared.open(currentState.redirect.url)
didOpenUrl = await openDeepLink(url: currentState.redirect.url)
case .web:
let authenticationRequest = POAlternativePaymentAuthenticationRequest(
url: currentState.redirect.url,
Expand Down Expand Up @@ -236,7 +236,7 @@ final class NativeAlternativePaymentDefaultInteractor:
let didOpenUrl: Bool
switch redirect.type {
case .deepLink:
didOpenUrl = await UIApplication.shared.open(redirect.url)
didOpenUrl = await openDeepLink(url: redirect.url)
case .web:
let authenticationRequest = POAlternativePaymentAuthenticationRequest(
url: redirect.url,
Expand Down Expand Up @@ -902,6 +902,18 @@ final class NativeAlternativePaymentDefaultInteractor:
)
return nil
}

// MARK: - Redirect Utils

private func openDeepLink(url: URL) async -> Bool {
let options: [UIApplication.OpenExternalURLOptionsKey: Any]
if url.scheme == "https" || url.scheme == "http" { // Determines whether link could be universal
options = [.universalLinksOnly: true]
} else {
options = [:]
}
return await UIApplication.shared.open(url, options: options)
}
}

// swiftlint:enable file_length type_body_length