Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Finding main view controller on iOS #1736

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dluksza
Copy link

@dluksza dluksza commented Sep 20, 2024

In a situation when rootViewController is not set by the application, the main view controller is not found, resulting in error:

Attempt to present <STP_Internal_BottomSheetViewController> on (from ) whose view is not in the window hierarchy.

which then prevents the Stripe bottom sheet from showing. Blocking the payment flow.

To prevent this, a fallback is added to traverse the windows hierarchy and find the first one that has isKeyWindow set to true.

Testing

  • I tested this manually
  • I added automated tests

Documentation

Select one:

  • I have added relevant documentation for my changes.
  • This PR does not result in any developer-facing changes.

In a situation when `rootViewController` is not set by the application,
the main view controller is not found, resulting in error:

  Attempt to present <STP_Internal_BottomSheetViewController> on <UIViewController> (from <UIViewController>) whose view is not in the window hierarchy.

which then prevents the Stripe bottom sheet from showing. Blocking the
payment flow.

To prevent this, a fallback is added to traverse the windows hierarchy
and find the first one that has `isKeyWindow` set to `true`.

Co-authored-by: Bruno Pastre <bruno.pastre@onefootball.com>
@CLAassistant
Copy link

CLAassistant commented Sep 20, 2024

CLA assistant check
All committers have signed the CLA.

@DaveMiller-Stadion
Copy link

Very good catch @dluksza, hopefully we can go back to a release version of stripe before we launch the marketplace for OneFootball and 11TeamSports end of next month.

@pastre
Copy link

pastre commented Oct 2, 2024

hey @charliecruzan-stripe, what are we missing to get this in? Sorry to bother, but we're happy to make any changes requested and go back to use Stripe from trunk :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants