Skip to content

Conversation

motokotomax
Copy link
Contributor

EC-89 migrate from URL Scheme to Universal Links

Highlights:

  • can be used across platforms
  • not deprecated

Copy link

@razvancapra
Copy link
Contributor

Nice job 👍 We only need the deployment of AASA file

@motokotomax
Copy link
Contributor Author

motokotomax commented Jul 25, 2024

AASA file should be named apple-app-site-association (without extension) and deployed to path ".well-known"

content of file

{ "applinks": { "apps": [], "details": [ { "appID": "JA825X8F7Z.net.gini.merchantsdk.example", "paths": [ "/payment-requester*", "/another/path/*"] } ] } }

apple-app-site-association.json

@zladzeyka zladzeyka assigned zladzeyka and unassigned motokotomax Aug 1, 2024
@zladzeyka zladzeyka requested a review from Copilot June 30, 2025 13:10
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the example app’s deep link handling from a custom URL scheme to Universal Links.

  • Adds a continue userActivity handler to process incoming universal link URLs.
  • Introduces an entitlements file with the associated domain for universal links.
  • Updates the Xcode project to reference the new entitlements file.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
AppDelegate.swift Implements application(_:continue:restorationHandler:) to handle universal links alongside the existing URL scheme handler.
GiniMerchantSDKExample.entitlements Defines the applinks:beaver-d97a1.web.app associated domain.
project.pbxproj Configures CODE_SIGN_ENTITLEMENTS to include the new entitlements file.
Comments suppressed due to low confidence (1)

MerchantSDK/GiniMerchantSDKExample/GiniMerchantSDKExample/Sources/AppDelegate.swift:35

  • The new universal link handling logic isn’t currently covered by tests. Add unit tests or UI tests to verify both successful and failed URL parses and ensure the correct coordinator methods are invoked.
    func application(_ application: UIApplication,

Comment on lines +51 to +57
params.first(where: { $0.name == "paymentRequestId" }) != nil else {
print("❌ unsupported URL")
return false
}

// Process URL
coordinator.processBankUrl()
Copy link

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code checks that paymentRequestId exists but never retrieves its value or passes it to the coordinator. Extract the paymentRequestId from params and pass it into coordinator.processBankUrl(paymentRequestId:) (or a similar API) so the correct request is handled.

Suggested change
params.first(where: { $0.name == "paymentRequestId" }) != nil else {
print("❌ unsupported URL")
return false
}
// Process URL
coordinator.processBankUrl()
let paymentRequestId = params.first(where: { $0.name == "paymentRequestId" })?.value else {
print("❌ unsupported URL")
return false
}
// Process URL
coordinator.processBankUrl(paymentRequestId: paymentRequestId)

Copilot uses AI. Check for mistakes.

Comment on lines +49 to +50
guard components.host == "beaver-d97a1.web.app",
path == "/payment-requester",
Copy link

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Hardcoding the host and path makes maintenance harder if the domain or path changes. Consider extracting these values into named constants or a configuration object.

Suggested change
guard components.host == "beaver-d97a1.web.app",
path == "/payment-requester",
guard components.host == AppDelegate.HOST,
path == AppDelegate.PAYMENT_REQUESTER_PATH,

Copilot uses AI. Check for mistakes.

let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true),
let path = components.path,
let params = components.queryItems else {
print("❌ can't parse URL")
Copy link

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using print for error logging can be unreliable in production. Consider using a structured logging framework like os_log or a custom logger to capture and categorize these events.

Suggested change
print("❌ can't parse URL")
os_log("❌ can't parse URL", log: OSLog.default, type: .error)

Copilot uses AI. Check for mistakes.

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.

3 participants