Skip to content

Commit

Permalink
Update Availability settings for SFSafariViewController.
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Dec 8, 2017
1 parent 002d483 commit 87d7516
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions BraintreePaymentFlow/BTPaymentFlowDriver.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,14 @@ - (void)informDelegatePresentingViewControllerRequestPresent:(NSURL *)appSwitchU

- (void)informDelegatePresentingViewControllerNeedsDismissal {
if (self.viewControllerPresentingDelegate != nil && [self.viewControllerPresentingDelegate respondsToSelector:@selector(paymentDriver:requestsDismissalOfViewController:)]) {
[self.viewControllerPresentingDelegate paymentDriver:self requestsDismissalOfViewController:self.safariViewController];
self.safariViewController = nil;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
if (@available(iOS 9.0, *)) {
#endif
[self.viewControllerPresentingDelegate paymentDriver:self requestsDismissalOfViewController:self.safariViewController];
self.safariViewController = nil;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
}
#endif
} else {
[[BTLogger sharedLogger] critical:@"Unable to dismiss View Controller to end payment flow. BTPaymentFlowDriver needs a viewControllerPresentingDelegate<BTViewControllerPresentingDelegate> to be set."];
}
Expand All @@ -140,10 +146,15 @@ + (BOOL)canHandleAppSwitchReturnURL:(NSURL *)url sourceApplication:(NSString *)s

- (void)handleOpenURL:(NSURL *)url {
[self.apiClient sendAnalyticsEvent:[NSString stringWithFormat:@"ios.%@.webswitch.succeeded", [self.paymentFlowRequestDelegate paymentFlowName]]];
if (self.safariViewController) {
[self informDelegatePresentingViewControllerNeedsDismissal];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
if (@available(iOS 9.0, *)) {
#endif
if (self.safariViewController) {
[self informDelegatePresentingViewControllerNeedsDismissal];
}
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
}

#endif
[self.paymentFlowRequestDelegate handleOpenURL:url];
}

Expand Down

0 comments on commit 87d7516

Please sign in to comment.