-
Notifications
You must be signed in to change notification settings - Fork 3
Feat(GiniMerchantSDK): Migrate to universal links #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>com.apple.developer.associated-domains</key> | ||
| <array> | ||
| <string>applinks:beaver-d97a1.web.app</string> | ||
| </array> | ||
| </dict> | ||
| </plist> |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,26 +11,52 @@ import UIKit | |||||||||||||||||||||||||||||
| class AppDelegate: UIResponder, UIApplicationDelegate { | ||||||||||||||||||||||||||||||
| var window: UIWindow? | ||||||||||||||||||||||||||||||
| var coordinator: AppCoordinator! | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| func application(_ application: UIApplication, | ||||||||||||||||||||||||||||||
| didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||||||||||||||||||||||||||||||
| let window = UIWindow(frame: UIScreen.main.bounds) | ||||||||||||||||||||||||||||||
| coordinator = AppCoordinator(window: window) | ||||||||||||||||||||||||||||||
| coordinator.start() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| return true | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| func application(_ app: UIApplication, | ||||||||||||||||||||||||||||||
| open url: URL, | ||||||||||||||||||||||||||||||
| options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if (url.host == "payment-requester") { | ||||||||||||||||||||||||||||||
| coordinator.processBankUrl() | ||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||
| coordinator.processExternalDocument(withUrl: url, sourceApplication: options[.sourceApplication] as? String) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| return true | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| func application(_ application: UIApplication, | ||||||||||||||||||||||||||||||
| continue userActivity: NSUserActivity, | ||||||||||||||||||||||||||||||
| restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool { | ||||||||||||||||||||||||||||||
| // Get URL components from the incoming user activity. | ||||||||||||||||||||||||||||||
| guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, | ||||||||||||||||||||||||||||||
| let incomingURL = userActivity.webpageURL, | ||||||||||||||||||||||||||||||
| let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true), | ||||||||||||||||||||||||||||||
| let path = components.path, | ||||||||||||||||||||||||||||||
| let params = components.queryItems else { | ||||||||||||||||||||||||||||||
| print("❌ can't parse URL") | ||||||||||||||||||||||||||||||
| return false | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // Validate URL components | ||||||||||||||||||||||||||||||
| guard components.host == "beaver-d97a1.web.app", | ||||||||||||||||||||||||||||||
| path == "/payment-requester", | ||||||||||||||||||||||||||||||
|
Comment on lines
+49
to
+50
|
||||||||||||||||||||||||||||||
| guard components.host == "beaver-d97a1.web.app", | |
| path == "/payment-requester", | |
| guard components.host == AppDelegate.HOST, | |
| path == AppDelegate.PAYMENT_REQUESTER_PATH, |
Copilot
AI
Jun 30, 2025
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using
printfor error logging can be unreliable in production. Consider using a structured logging framework likeos_logor a custom logger to capture and categorize these events.