Skip to content

Commit

Permalink
Fix usage of the library in extensions to reflect changes in XCode >= 13
Browse files Browse the repository at this point in the history
  • Loading branch information
jefmathiot committed Sep 10, 2024
1 parent 78efeac commit d0a4d34
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ extension STPAPIClient {
/// - secret: The client secret of the source. Cannot be nil.
/// - timeout: The timeout for the polling operation, in seconds. Timeouts are capped at 5 minutes.
/// - completion: The callback to run with the returned Source object, or an error.
@available(iOSApplicationExtension, unavailable)
@objc(startPollingSourceWithId:clientSecret:timeout:completion:)
public func startPollingSource(
withId identifier: String,
Expand All @@ -350,6 +351,7 @@ extension STPAPIClient {
/// Stops polling the Source object with the given ID. Note that the completion block passed to
/// `startPolling` will not be fired when `stopPolling` is called.
/// - Parameter identifier: The identifier of the source to be retrieved. Cannot be nil.
@available(iOSApplicationExtension, unavailable)
@objc(stopPollingSourceWithId:)
public func stopPollingSource(withId identifier: String) {
sourcePollersQueue?.async(execute: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public typealias STPRedirectContextPaymentIntentCompletionBlock = (String, Error
/// @note You must retain this instance for the duration of the redirect flow.
/// This class dismisses any presented view controller upon deallocation.
/// See https://stripe.com/docs/sources/best-practices

@available(iOSApplicationExtension, unavailable)
public class STPRedirectContext: NSObject,
UIViewControllerTransitioningDelegate, STPSafariViewControllerDismissalDelegate
{
Expand Down Expand Up @@ -515,6 +517,7 @@ public class STPRedirectContext: NSObject,
}

/// :nodoc:
@available(iOSApplicationExtension, unavailable)
@_spi(STP) extension STPRedirectContext: STPURLCallbackListener {
/// :nodoc:
@_spi(STP) public func handleURLCallback(_ url: URL) -> Bool {
Expand Down Expand Up @@ -562,6 +565,7 @@ extension UIApplication: UIApplicationProtocol {
}

#if !canImport(CompositorServices)
@available(iOSApplicationExtension, unavailable)
extension STPRedirectContext: SFSafariViewControllerDelegate {
// MARK: - SFSafariViewControllerDelegate -
/// :nodoc:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import WebKit
/**
hCaptcha SDK facade (entry point)
*/
@available(iOSApplicationExtension, unavailable)
@objc
class HCaptcha: NSObject {
fileprivate struct Constants {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ enum HCaptchaOrientation: Int, RawRepresentable {

/** Internal data model to keep SDK init params
*/
@available(iOSApplicationExtension, unavailable)
struct HCaptchaConfig: CustomDebugStringConvertible {
/// The raw unformated HTML file content
let html: String
Expand Down Expand Up @@ -280,7 +281,7 @@ struct HCaptchaConfig: CustomDebugStringConvertible {
}

// MARK: - Private Methods

@available(iOSApplicationExtension, unavailable)
private extension HCaptchaConfig {
/**
- parameter url: The URL to be fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Foundation

This may contain the validation token on success, or an error that may have occurred.
*/
@available(iOSApplicationExtension, unavailable)
@objc
class HCaptchaResult: NSObject {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ internal protocol HCaptchaURLOpener {
/**
* UIApplication based implementation
*/
@available(iOSApplicationExtension, unavailable)
internal class HCapchaAppURLOpener: HCaptchaURLOpener {
func canOpenURL(_ url: URL) -> Bool {
return UIApplication.shared.canOpenURL(url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import WebKit

@available(iOSApplicationExtension, unavailable)
extension HCaptchaWebViewManager: WKNavigationDelegate {
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy {
if navigationAction.targetFrame == nil, let url = navigationAction.request.url, urlOpener.canOpenURL(url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import WebKit

/** Handles comunications with the webview containing the HCaptcha challenge.
*/
@available(iOSApplicationExtension, unavailable)
internal class HCaptchaWebViewManager: NSObject {
enum JSCommand: String {
case execute = "execute();"
Expand Down Expand Up @@ -219,6 +220,7 @@ internal class HCaptchaWebViewManager: NSObject {

/** Private methods for HCaptchaWebViewManager
*/
@available(iOSApplicationExtension, unavailable)
fileprivate extension HCaptchaWebViewManager {
/**
- returns: An instance of `WKWebViewConfiguration`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import SafariServices
import SwiftUI

@available(iOSApplicationExtension, unavailable)
struct ConfirmPaymentPresenter<ParamsType, CompletionBlockType>: UIViewControllerRepresentable {
@Binding var presented: Bool
let intentParams: ParamsType
Expand Down Expand Up @@ -91,6 +92,7 @@ struct ConfirmPaymentPresenter<ParamsType, CompletionBlockType>: UIViewControlle
}
}

@available(iOSApplicationExtension, unavailable)
extension View {
/// Confirm the payment, presenting a sheet for the user to confirm their payment if needed.
/// - Parameter isConfirmingPayment: A binding to whether the payment is being confirmed. This will present a sheet if needed. It will be updated to `false` after performing the payment confirmation.
Expand Down Expand Up @@ -129,6 +131,7 @@ extension View {
}
}

@available(iOSApplicationExtension, unavailable)
struct ConfirmPaymentPresentationModifier<ParamsType, CompletionBlockType>: ViewModifier {
@Binding var isPresented: Bool
let intentParams: ParamsType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
@_spi(STP) import StripeCore
import UIKit

@available(iOSApplicationExtension, unavailable)
class STPSourcePoller: NSObject {
required init(
apiClient: STPAPIClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extension STPPaymentHandlerActionStatus {
}
}

@available(iOSApplicationExtension, unavailable)
extension STPPaymentHandler {
struct Analytic: StripeCore.Analytic {
let event: StripeCore.STPAnalyticEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ let missingReturnURLErrorMessage = "The payment method requires a return URL and
/// `STPPaymentHandler` is a utility class that confirms PaymentIntents/SetupIntents and handles any authentication required, such as 3DS1/3DS2 for Strong Customer Authentication.
/// It can present authentication UI on top of your app or redirect users out of your app (to e.g. their banking app).
/// - seealso: https://stripe.com/docs/payments/3d-secure
@available(iOSApplicationExtension, unavailable)
public class STPPaymentHandler: NSObject {
/// The error domain for errors in `STPPaymentHandler`.
@objc public static let errorDomain = "STPPaymentHandlerErrorDomain"
Expand Down Expand Up @@ -2180,6 +2181,7 @@ public class STPPaymentHandler: NSObject {

/// STPPaymentHandler errors (i.e. errors that are created by the STPPaymentHandler class and have a corresponding STPPaymentHandlerErrorCode) used to be NSErrors.
/// This struct exists so that these errors can be Swift errors to conform to AnalyticLoggableError, while still looking like the old NSErrors to users (i.e. same domain and code).
@available(iOSApplicationExtension, unavailable)
struct STPPaymentHandlerError: Error, CustomNSError, AnalyticLoggableError {
// AnalyticLoggableError properties
let analyticsErrorType: String = errorDomain
Expand All @@ -2201,6 +2203,7 @@ struct STPPaymentHandlerError: Error, CustomNSError, AnalyticLoggableError {
}

#if !canImport(CompositorServices)
@available(iOSApplicationExtension, unavailable)
extension STPPaymentHandler: SFSafariViewControllerDelegate {
// MARK: - SFSafariViewControllerDelegate
/// :nodoc:
Expand All @@ -2226,6 +2229,7 @@ extension STPPaymentHandler: SFSafariViewControllerDelegate {
#endif

/// :nodoc:
@available(iOSApplicationExtension, unavailable)
@_spi(STP) extension STPPaymentHandler: STPURLCallbackListener {
/// :nodoc:
@_spi(STP) public func handleURLCallback(_ url: URL) -> Bool {
Expand Down Expand Up @@ -2259,6 +2263,7 @@ extension STPPaymentHandler: SFSafariViewControllerDelegate {
}
}

@available(iOSApplicationExtension, unavailable)
extension STPPaymentHandler {
// MARK: - STPChallengeStatusReceiver
/// :nodoc:
Expand Down

0 comments on commit d0a4d34

Please sign in to comment.