Skip to content

Commit

Permalink
Merge pull request #129 from afterpay/open-external-links
Browse files Browse the repository at this point in the history
Ensure all links requesting to be opened in a new window are opened externally
  • Loading branch information
adamjcampbell authored Jan 14, 2021
2 parents b8f636b + cfbab75 commit ac3cd48
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Configurations/Afterpay-Shared.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ TARGETED_DEVICE_FAMILY = 1,2
// This setting defines the user-visible version of the project. The value corresponds to
// the `CFBundleShortVersionString` key in your app's Info.plist.

MARKETING_VERSION = 1.4.1
MARKETING_VERSION = 1.4.2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Add the Afterpay SDK as a [git submodule][git-submodule] by navigating to the ro
```
git submodule add https://github.com/afterpay/sdk-ios.git Afterpay
cd Afterpay
git checkout 1.4.1
git checkout 1.4.2
```

#### Project / Workspace Integration
Expand Down
4 changes: 1 addition & 3 deletions Sources/Afterpay/Checkout/CheckoutWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ final class CheckoutWebViewController:
}
}

private let externalLinkPathComponents = ["privacy-policy", "terms-of-service"]

func webView(
_ webView: WKWebView,
decidePolicyFor navigationAction: WKNavigationAction,
Expand All @@ -152,7 +150,7 @@ final class CheckoutWebViewController:
return decisionHandler(.allow)
}

let shouldOpenExternally = externalLinkPathComponents.contains(url.lastPathComponent)
let shouldOpenExternally = navigationAction.targetFrame == nil

switch (shouldOpenExternally, Completion(url: url)) {
case (true, _):
Expand Down

0 comments on commit ac3cd48

Please sign in to comment.