Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
507A25F72C355DAA00A7106E /* GiniMerchantSDKPinningExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiniMerchantSDKPinningExampleTests.swift; sourceTree = "<group>"; };
507A26102C35700F00A7106E /* GiniMerchantSDKPinning */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = GiniMerchantSDKPinning; path = ../GiniMerchantSDKPinning; sourceTree = "<group>"; };
507A26112C35B5C200A7106E /* GiniMerchantSDKPinningExampleWrongCertificatesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiniMerchantSDKPinningExampleWrongCertificatesTests.swift; sourceTree = "<group>"; };
5087AF392C46E27D008B3403 /* GiniMerchantSDKExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GiniMerchantSDKExample.entitlements; sourceTree = "<group>"; };
50D80D542C245A8900B446A8 /* GiniMerchantSDKExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GiniMerchantSDKExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
50D80D572C245A8900B446A8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
50D80D592C245A8900B446A8 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -201,6 +202,7 @@
50D80D562C245A8900B446A8 /* GiniMerchantSDKExample */ = {
isa = PBXGroup;
children = (
5087AF392C46E27D008B3403 /* GiniMerchantSDKExample.entitlements */,
50D80DC82C24788F00B446A8 /* Sources */,
50D80DC72C24786500B446A8 /* Resources */,
50D80D652C245A8A00B446A8 /* Info.plist */,
Expand Down Expand Up @@ -798,7 +800,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_ENTITLEMENTS = GiniMerchantSDKExample/GiniMerchantSDKExample.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = JA825X8F7Z;
Expand Down Expand Up @@ -832,7 +834,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_ENTITLEMENTS = GiniMerchantSDKExample/GiniMerchantSDKExample.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = JA825X8F7Z;
Expand Down
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
Expand Up @@ -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")
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.
return false
}

// Validate URL components
guard components.host == "beaver-d97a1.web.app",
path == "/payment-requester",
Comment on lines +49 to +50
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.
params.first(where: { $0.name == "paymentRequestId" }) != nil else {
print("❌ unsupported URL")
return false
}

// Process URL
coordinator.processBankUrl()
Comment on lines +51 to +57
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.
print("✅ Successfully proceed with URL: \(incomingURL.absoluteString)")
return true
}
}