Skip to content

Commit 997ad45

Browse files
committed
fix(walletconnect): fix deep linking in iOS
1 parent ef4504d commit 997ad45

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

Runtime/CareBoo.AlgoSdk.WalletConnect/AppEntry.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using UnityEngine;
3+
using UnityEngine.Networking;
34

45
namespace AlgoSdk.WalletConnect
56
{
@@ -91,6 +92,7 @@ public string FormatUrlForDeepLink(string url)
9192

9293
public string FormatUrlForDeepLinkIos(string url)
9394
{
95+
url = UnityWebRequest.EscapeURL(url);
9496
if (!string.IsNullOrEmpty(Mobile.Universal))
9597
{
9698
return $"{Mobile.Universal}/wc?uri={url}";

Runtime/CareBoo.AlgoSdk.WalletConnect/HandshakeUrl.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ public HandshakeUrl(
2424
Hex key
2525
)
2626
{
27-
var escapedBridgeUrl = UnityWebRequest.EscapeURL(bridgeUrl)
28-
.Replace("%2f", "%2F")
29-
.Replace("%3a", "%3A")
30-
;
31-
url = $"wc:{topic}@{version}?bridge={escapedBridgeUrl}&key={key.ToString().ToLower()}&algorand=true";
27+
var escapedBridgeUrl = UnityWebRequest.EscapeURL(bridgeUrl);
28+
url = $"wc:{topic}@{version}?bridge={escapedBridgeUrl}&key={key}&algorand=true";
3229
}
3330

3431
public Texture2D ToQrCodeTexture()

Tests/Runtime/CareBoo.AlgoSdk.WalletConnect.Tests/AppEntryTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class AppEntryTest
99
[Test]
1010
public void PeraWalletAppUrlShouldBeCorrect()
1111
{
12-
var expected = "algorand-wc://wc?uri=wc:4015f93f-b88d-48fc-8bfe-8b063cc325b6@1?bridge=https%3A%2F%2F9.bridge.walletconnect.org&key=b0576e0880e17f8400bfff92d4caaf2158cccc0f493dcf455ba76d448c9b5655&algorand=true";
12+
var expected = "algorand-wc://wc?uri=wc%3A4015f93f-b88d-48fc-8bfe-8b063cc325b6%401%3Fbridge%3Dhttps%253A%252F%252F9.bridge.walletconnect.org%26key%3Db0576e0880e17f8400bfff92d4caaf2158cccc0f493dcf455ba76d448c9b5655%26algorand%3Dtrue";
1313
var handshake = new HandshakeUrl(
1414
"4015f93f-b88d-48fc-8bfe-8b063cc325b6",
1515
"1",
@@ -18,6 +18,6 @@ public void PeraWalletAppUrlShouldBeCorrect()
1818
);
1919
var app = WalletRegistry.PeraWallet;
2020
var actual = app.FormatUrlForDeepLinkIos(handshake.Url);
21-
Assert.AreEqual(expected, actual);
21+
StringAssert.AreEqualIgnoringCase(expected, actual);
2222
}
2323
}

0 commit comments

Comments
 (0)