Skip to content

Commit 213e25f

Browse files
author
Ovidiu Arion
committed
Unity version updated
1 parent f68489f commit 213e25f

File tree

5 files changed

+21
-95
lines changed

5 files changed

+21
-95
lines changed

Assets/ElrondUnityTools/Example/DemoScript.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ private void SigningStatusListener(ElrondUnityTools.OperationStatus operationSta
171171
if (operationStatus == ElrondUnityTools.OperationStatus.Complete)
172172
{
173173
txHash = message;
174+
Debug.Log("Tx Hash: " + txHash);
174175
ElrondUnityTools.Manager.CheckTransactionStatus(txHash, BlockchainTransactionListener, 1);
175176
}
176177
if (operationStatus == ElrondUnityTools.OperationStatus.Error)

Assets/ElrondUnityTools/Scripts/ConnectionManager.cs

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ConnectionManager : WalletConnectActions
2828
private UnityAction<OperationStatus, string> OnBlockchainTransactionStatusChanged;
2929
private UnityAction<AccountDto> OnWalletConnected;
3030
private UnityAction OnWalletDisconnected;
31-
31+
private WalletConnect walletConnect;
3232
private bool walletConnected;
3333
private bool walletConnectInitialized;
3434

@@ -53,7 +53,7 @@ internal async void Connect(UnityAction<AccountDto> OnWalletConnected, UnityActi
5353
{
5454
this.OnWalletConnected = OnWalletConnected;
5555
this.OnWalletDisconnected = OnWalletDisconnected;
56-
WalletConnect walletConnect = gameObject.AddComponent<WalletConnect>();
56+
walletConnect = gameObject.AddComponent<WalletConnect>();
5757
ClientMeta appData = new ClientMeta();
5858
appData.Description = Constants.appDescription;
5959
appData.Icons = new string[1];
@@ -82,7 +82,7 @@ internal async void Connect(UnityAction<AccountDto> OnWalletConnected, UnityActi
8282

8383
internal void DeepLinkLogin()
8484
{
85-
OpenDeepLink();
85+
walletConnect.OpenDeepLink();
8686
}
8787

8888

@@ -263,50 +263,5 @@ private void ActiveSessionOnDisconnect(object sender, EventArgs e)
263263
walletConnected = false;
264264
OnWalletDisconnected();
265265
}
266-
267-
268-
private void OpenDeepLink()
269-
{
270-
if (!WalletConnect.ActiveSession.ReadyForUserPrompt)
271-
{
272-
Debug.LogError("WalletConnectUnity.ActiveSession not ready for a user prompt" +
273-
"\nWait for ActiveSession.ReadyForUserPrompt to be true");
274-
275-
return;
276-
}
277-
278-
#if UNITY_ANDROID && !UNITY_EDITOR
279-
280-
string maiarUrl = "https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/?wallet-connect=" + UnityWebRequest.EscapeURL(WalletConnect.Instance.ConnectURL);
281-
282-
Debug.Log("[WalletConnect] Opening URL: " + maiarUrl);
283-
Application.OpenURL(maiarUrl);
284-
285-
#elif UNITY_IOS
286-
287-
string url;
288-
string encodedConnect = WebUtility.UrlEncode(WalletConnect.Instance.ConnectURL);
289-
Debug.Log(encodedConnect);
290-
Debug.Log(UnityWebRequest.EscapeURL(WalletConnect.Instance.ConnectURL));
291-
//if (!string.IsNullOrWhiteSpace(SelectedWallet.mobile.universal))
292-
//{
293-
// url = SelectedWallet.mobile.universal + "/wc?uri=" + encodedConnect;
294-
//}
295-
//else
296-
//{
297-
// url = SelectedWallet.mobile.native + (SelectedWallet.mobile.native.EndsWith(":") ? "//" : "/") +
298-
// "wc?uri=" + encodedConnect;
299-
//}
300-
301-
string maiarUrl = "https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/?wallet-connect=" + UnityWebRequest.EscapeURL(WalletConnect.Instance.ConnectURL);
302-
303-
304-
//Debug.Log("Opening: " + url);
305-
//Application.OpenURL(url);
306-
#else
307-
Debug.Log("Platform does not support deep linking");
308-
return;
309-
#endif
310-
}
311266
}
312267
}

Assets/ExternalTools/WalletConnectUnity/Scripts/WalletConnectSharp.Unity/WalletConnect.cs renamed to Assets/ElrondUnityTools/Scripts/ModifiedScripts/WalletConnect.cs

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -491,38 +491,24 @@ public void OpenDeepLink(AppEntry selectedWallet)
491491
OpenDeepLink();
492492
}
493493

494-
public void OpenMobileWallet()
494+
public virtual void OpenMobileWallet()
495495
{
496-
#if UNITY_ANDROID
496+
#if UNITY_ANDROID && !UNITY_EDITOR
497497
var signingURL = ConnectURL.Split('@')[0];
498-
499-
Debug.Log("signing url " + signingURL);
500498
string maiarUrl = "https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/?wallet-connect=" + UnityWebRequest.EscapeURL(signingURL);
501-
502499
Debug.Log("[WalletConnect] Opening URL: " + maiarUrl);
503500
Application.OpenURL(maiarUrl);
504-
505-
//Application.OpenURL(signingURL);
506-
#elif UNITY_IOS
507-
508-
string url;
509-
string encodedConnect = WebUtility.UrlEncode(ConnectURL);
510-
511-
url = "https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com" + "/wc?uri=" + encodedConnect;
512-
513-
514-
var signingUrl = url.Split('?')[0];
515-
516-
Debug.Log("Opening: " + signingUrl);
517-
Application.OpenURL(signingUrl);
518-
501+
#elif UNITY_IOS && !UNITY_EDITOR
502+
string maiarUrl = "https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com" + "/wc";
503+
Debug.Log("[WalletConnect] Opening URL: " + maiarUrl);
504+
Application.OpenURL(maiarUrl);
519505
#else
520506
Debug.Log("Platform does not support deep linking");
521507
return;
522508
#endif
523509
}
524510

525-
public void OpenDeepLink()
511+
public virtual void OpenDeepLink()
526512
{
527513
if (!ActiveSession.ReadyForUserPrompt)
528514
{
@@ -533,31 +519,15 @@ public void OpenDeepLink()
533519
}
534520

535521
#if UNITY_ANDROID
536-
Debug.Log("[WalletConnect] Opening URL: " + ConnectURL);
537-
Application.OpenURL(ConnectURL);
538-
#elif UNITY_IOS
539-
if (SelectedWallet == null)
540-
{
541-
throw new NotImplementedException(
542-
"You must use OpenDeepLink(AppEntry) or set SelectedWallet on iOS!");
543-
}
544-
else
545-
{
546-
string url;
547-
string encodedConnect = WebUtility.UrlEncode(ConnectURL);
548-
if (!string.IsNullOrWhiteSpace(SelectedWallet.mobile.universal))
549-
{
550-
url = SelectedWallet.mobile.universal + "/wc?uri=" + encodedConnect;
551-
}
552-
else
553-
{
554-
url = SelectedWallet.mobile.native + (SelectedWallet.mobile.native.EndsWith(":") ? "//" : "/") +
555-
"wc?uri=" + encodedConnect;
556-
}
522+
string maiarUrl = "https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/?wallet-connect=" + UnityWebRequest.EscapeURL(ConnectURL);
523+
Debug.Log("[WalletConnect] Opening URL: " + maiarUrl);
524+
Application.OpenURL(maiarUrl);
557525

558-
Debug.Log("Opening: " + url);
559-
Application.OpenURL(url);
560-
}
526+
#elif UNITY_IOS
527+
string encodedConnect = WebUtility.UrlEncode(ConnectURL);
528+
string maiarUrl = "https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/?wallet-connect=" + encodedConnect;
529+
Debug.Log("[WalletConnect] Opening URL: " + maiarUrl);
530+
Application.OpenURL(maiarUrl);
561531
#else
562532
Debug.Log("Platform does not support deep linking");
563533
return;

Assets/ExternalTools/WalletConnectUnity/Scripts/WalletConnectSharp.Unity/WalletConnect.cs.meta renamed to Assets/ElrondUnityTools/Scripts/ModifiedScripts/WalletConnect.cs.meta

File renamed without changes.

ProjectSettings/ProjectVersion.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2021.3.7f1
2-
m_EditorVersionWithRevision: 2021.3.7f1 (24e8595d6d43)
1+
m_EditorVersion: 2021.3.8f1
2+
m_EditorVersionWithRevision: 2021.3.8f1 (b30333d56e81)

0 commit comments

Comments
 (0)