From 87d7516a9ad05d058672ccccc812f0c4544f0571 Mon Sep 17 00:00:00 2001 From: brluk and dmerino Date: Fri, 8 Dec 2017 15:29:08 -0800 Subject: [PATCH] Update Availability settings for SFSafariViewController. --- BraintreePaymentFlow/BTPaymentFlowDriver.m | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/BraintreePaymentFlow/BTPaymentFlowDriver.m b/BraintreePaymentFlow/BTPaymentFlowDriver.m index 3a922eed29..ee6fca5bdc 100644 --- a/BraintreePaymentFlow/BTPaymentFlowDriver.m +++ b/BraintreePaymentFlow/BTPaymentFlowDriver.m @@ -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 to be set."]; } @@ -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]; }