From 27ac3a625f455ad262b496e598c15ab592bb75d5 Mon Sep 17 00:00:00 2001 From: llbartekll Date: Tue, 8 Oct 2024 14:36:28 +0200 Subject: [PATCH 1/2] savepoint --- Sources/WalletConnectRelay/BundleFinder.swift | 42 ++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/Sources/WalletConnectRelay/BundleFinder.swift b/Sources/WalletConnectRelay/BundleFinder.swift index a0f0d9e5..497876ff 100644 --- a/Sources/WalletConnectRelay/BundleFinder.swift +++ b/Sources/WalletConnectRelay/BundleFinder.swift @@ -1,9 +1,41 @@ - import Foundation -extension Bundle { - // This will provide access to the resources for the WalletConnectRelay module - static var resourceBundle: Bundle { +private class BundleFinder {} + +extension Foundation.Bundle { + /// Returns the resource bundle associated with the current Swift module. + static var resourceBundle: Bundle = { + let bundleName = "reown_WalletConnectRelay" + let candidates = [ + // Bundle should be present here when the package is linked into an App. + Bundle.main.resourceURL, + // Bundle should be present here when the package is linked into a framework. + Bundle(for: BundleFinder.self).resourceURL, + // For command-line tools. + Bundle.main.bundleURL, + // Bundle should be present here when running tests. + Bundle(for: BundleFinder.self).resourceURL? + .deletingLastPathComponent() + .deletingLastPathComponent() + .deletingLastPathComponent(), + // Other possibilities + Bundle(for: BundleFinder.self).resourceURL? + .deletingLastPathComponent() + .deletingLastPathComponent(), + ] + + for candidate in candidates { + let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle") + if let bundle = bundlePath.flatMap(Bundle.init(url:)) { + return bundle + } + } + + // If we can't find the bundle, fall back to the module bundle if available + #if SWIFT_PACKAGE return Bundle.module - } + #else + return Bundle(for: BundleFinder.self) + #endif + }() } From 70cc87d7fbbd823e9f172938c114c9e2613992be Mon Sep 17 00:00:00 2001 From: llbartekll Date: Wed, 9 Oct 2024 09:19:16 +0000 Subject: [PATCH 2/2] Set User Agent --- Sources/WalletConnectRelay/PackageConfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WalletConnectRelay/PackageConfig.json b/Sources/WalletConnectRelay/PackageConfig.json index 97901a72..c2ad4cfc 100644 --- a/Sources/WalletConnectRelay/PackageConfig.json +++ b/Sources/WalletConnectRelay/PackageConfig.json @@ -1 +1 @@ -{"version": "1.0.2"} +{"version": "1.0.3"}