Skip to content

Commit

Permalink
Merge pull request #175 from stripe-ios/davidme/safari-overfullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
davidme-stripe committed Apr 6, 2021
2 parents ae096a4 + e4cd210 commit 929d18e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
## 21.4.0 2021-03-26
* Fixes a layout issue when confirming payments in SwiftUI. [#1761](https://github.com/stripe/stripe-ios/issues/1761) (Thanks [mvarie](https://github.com/mvarie)!)

## 21.3.1 2021-03-25
* Adds support for Maestro in Apple Pay on iOS 12 or later.

Expand Down
3 changes: 3 additions & 0 deletions MIGRATING.md
@@ -1,5 +1,8 @@
## Migration Guides

### Migrating from versions < X.X.X
* STPPaymentHandler now presents its SFSafariViewController using the `.overFullScreen` presentation style by default. To select a different style, implement the `STPAuthenticationContext.configureSafariViewController(_:)` function in your `STPAuthenticationContext`.

### Migrating from versions < 21.2.0
* Stripe3DS2 is now a separate component for Carthage users. You must embed both Stripe.xcframework and Stripe3DS2.xcframework in your app.

Expand Down
7 changes: 6 additions & 1 deletion Stripe/STPPaymentConfirmation+SwiftUI.swift
Expand Up @@ -7,6 +7,7 @@
//

import SwiftUI
import SafariServices

@available(iOS 13.0, *)
@available(iOSApplicationExtension, unavailable)
Expand Down Expand Up @@ -81,7 +82,11 @@ struct ConfirmPaymentPresenter<ParamsType, CompletionBlockType>: UIViewControlle
}

private func forciblyDismissConfirmationSheet() {
self.authenticationPresentingViewController().dismiss(animated: true)
if let sfvc = self.authenticationPresentingViewController().presentedViewController as? SFSafariViewController,
!sfvc.isBeingDismissed
{
self.authenticationPresentingViewController().dismiss(animated: true)
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Stripe/STPPaymentHandler.swift
Expand Up @@ -1194,6 +1194,7 @@ public class STPPaymentHandler: NSObject, SFSafariViewControllerDelegate, STPURL
}

let safariViewController = SFSafariViewController(url: fallbackURL)
safariViewController.modalPresentationStyle = .overFullScreen
safariViewController.dismissButtonStyle = .close
if context.responds(
to: #selector(STPAuthenticationContext.configureSafariViewController(_:)))
Expand Down

0 comments on commit 929d18e

Please sign in to comment.