Skip to content

Commit 1060cd8

Browse files
author
Anton VIkharev
committed
Merge branch 'dev'
2 parents adec65e + bf2e191 commit 1060cd8

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

Assets/MirageSDK/Plugins/WalletConnect.VersionShared/Utils/WalletDownloadHelper.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace MirageSDK.WalletConnect.VersionShared.Utils
1212
{
1313
public static class WalletDownloadHelper
1414
{
15-
private static Dictionary<string, WalletEntry> _walletEntriesCache = new Dictionary<string, WalletEntry>();
15+
private static Dictionary<string, WalletEntry> _walletEntriesCache;
1616

1717
public static async UniTask<WalletEntry> FindWalletEntryByName(string walletName, bool invalidateCache = false)
1818
{
@@ -84,21 +84,36 @@ public static async UniTask<Dictionary<string, WalletEntry>> FetchWalletList(boo
8484
return supportedWallets;
8585
}
8686

87-
var filteredSupportedWallets = GetAllSupportedWallets(walletconnectSupportedWallets: supportedWallets);
88-
foreach (var wallet in filteredSupportedWallets.Values)
87+
var filteredSupportedWallets = GetAllSupportedWallets(walletConnectSupportedWallets: supportedWallets);
88+
89+
if (filteredSupportedWallets != null)
8990
{
90-
await wallet.DownloadImages();
91+
var listOfTasks = new List<UniTask>();
92+
foreach (var wallet in filteredSupportedWallets.Values)
93+
{
94+
var downloadTask = wallet.DownloadImages();
95+
listOfTasks.Add(downloadTask);
96+
}
97+
98+
await UniTask.WhenAll(listOfTasks);
9199
}
92100

101+
_walletEntriesCache = filteredSupportedWallets;
102+
93103
return filteredSupportedWallets;
94104
}
95105
}
96106

97107
private static Dictionary<string, WalletEntry> GetAllSupportedWallets(
98-
Dictionary<string, WalletEntry> walletconnectSupportedWallets)
108+
Dictionary<string, WalletEntry> walletConnectSupportedWallets)
99109
{
110+
if (walletConnectSupportedWallets == null)
111+
{
112+
return null;
113+
}
114+
100115
var walletsSupportedBySDK = WalletNameHelper.GetSupportedWalletNames();
101-
return walletconnectSupportedWallets
116+
return walletConnectSupportedWallets
102117
.Where(predicate: w => walletsSupportedBySDK.Contains(value: w.Value.name))
103118
.ToDictionary(keySelector: i => i.Key, elementSelector: i => i.Value);
104119
}

0 commit comments

Comments
 (0)