Skip to content

Commit

Permalink
support marketplace kit (#2833)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/0/1207266309510426/f
Tech Design URL:
CC:

Description:
Adds marketplace kit support. Installing alternative app stores doesn't appear to work with an adhoc build so need to test in the wild. Internal users only.

The final version should use our current link handling logic, this direct approach is just to validate it works.

Steps to test this PR:

With an iOS 17.4 device or simulator with internal user flag enabled access https://chrisbrind.rocks/testing/ and click on the marketplace URL and you should get a toast. Check that tapping COPY copies the URL into the pasteboard.
Try the above where any of the conditions are false (e.g. older version of iOS, internal user flag off, etc). Nothing should happen when clicking on the link.
  • Loading branch information
brindy authored May 8, 2024
1 parent b9febde commit 5eda30c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions DuckDuckGo/DuckDuckGo.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
</array>
<key>com.apple.developer.web-browser</key>
<true/>
<key>com.apple.developer.browser.app-installation</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>$(GROUP_ID_PREFIX).bookmarks</string>
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/DuckDuckGoAlpha.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
</array>
<key>com.apple.developer.web-browser</key>
<true/>
<key>com.apple.developer.browser.app-installation</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.duckduckgo.alpha.bookmarks</string>
Expand Down
16 changes: 15 additions & 1 deletion DuckDuckGo/TabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,21 @@ extension TabViewController: WKNavigationDelegate {
func webView(_ webView: WKWebView,
decidePolicyFor navigationAction: WKNavigationAction,
decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {


if #available(iOS 17.4, *),
navigationAction.request.url?.scheme == "marketplace-kit",
internalUserDecider.isInternalUser {

decisionHandler(.allow)
let urlString = navigationAction.request.url?.absoluteString ?? "<no url>"
ActionMessageView.present(message: "Marketplace Kit URL detected",
actionTitle: "COPY",
presentationLocation: .withoutBottomBar, onAction: {
UIPasteboard.general.string = urlString
})
return
}

if let url = navigationAction.request.url {
if !tabURLInterceptor.allowsNavigatingTo(url: url) {
decisionHandler(.cancel)
Expand Down
1 change: 0 additions & 1 deletion fastlane/Matchfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ platform "ios"
type "appstore"
app_identifier ["com.duckduckgo.mobile.ios", "com.duckduckgo.mobile.ios.ShareExtension", "com.duckduckgo.mobile.ios.OpenAction2", "com.duckduckgo.mobile.ios.Widgets", "com.duckduckgo.mobile.ios.NetworkExtension"]
generate_apple_certs false
template_name "Default Web Browser iOS (Dist)"

for_lane :sync_signing_adhoc do
type "adhoc"
Expand Down

0 comments on commit 5eda30c

Please sign in to comment.