Skip to content

Commit b7ecbd5

Browse files
committed
Fix compile errors on platforms other than WebGL
1 parent c6776dc commit b7ecbd5

4 files changed

Lines changed: 18 additions & 2 deletions

File tree

Packages/com.walletconnect.web3modal/Runtime/Connectors/WebGl/WebGlConnector.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ namespace WalletConnect.Web3Modal
1414
{
1515
public class WebGlConnector : Connector
1616
{
17+
18+
#if UNITY_WEBGL
1719
[DllImport("__Internal")]
20+
#endif
1821
private static extern void Initialize(string parameters, Action callback);
1922

2023
private static TaskCompletionSource<bool> _initializationTaskCompletionSource;

Packages/com.walletconnect.web3modal/Runtime/Controllers/ModalController/ModalControllerWebGl.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public override Task InitializeAsyncCore()
2020

2121
private void StateChangedHandler(ModalState modalState)
2222
{
23+
#if UNITY_WEBGL && !UNITY_EDITOR
2324
WebGLInput.captureAllKeyboardInput = !modalState.open;
25+
#endif
2426
OnOpenStateChanged(new ModalOpenStateChangedEventArgs(modalState.open));
2527
}
2628

Packages/com.walletconnect.web3modal/Runtime/WebGL/Modal/ModalInterop.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ namespace WalletConnect.Web3Modal.WebGl.Modal
1010
{
1111
public static class ModalInterop
1212
{
13-
[DllImport("__Internal")]
13+
#if UNITY_WEBGL
14+
[DllImport("__Internal")]
15+
#endif
1416
private static extern void ModalCall(int id, string methodName, string payload, InteropService.ExternalMethodCallback callback);
1517

16-
[DllImport("__Internal")]
18+
#if UNITY_WEBGL
19+
[DllImport("__Internal")]
20+
#endif
1721
private static extern void ModalSubscribeState(Action<string> callback);
1822

1923
public static event Action<ModalState> StateChanged;

Packages/com.walletconnect.web3modal/Runtime/WebGL/Wagmi/WagmiInterop.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@ namespace WalletConnect.Web3Modal.WebGl.Wagmi
1111
{
1212
public static class WagmiInterop
1313
{
14+
#if UNITY_WEBGL
1415
[DllImport("__Internal")]
16+
#endif
1517
private static extern void WagmiCall(int id, string methodName, string payload, InteropService.ExternalMethodCallback callback);
1618

19+
#if UNITY_WEBGL
1720
[DllImport("__Internal")]
21+
#endif
1822
private static extern void WagmiWatchAccount(Action<string> callback);
1923

24+
#if UNITY_WEBGL
2025
[DllImport("__Internal")]
26+
#endif
2127
private static extern void WagmiWatchChainId(Action<int> callback);
28+
2229
public static event Action<GetAccountReturnType> WatchAccountTriggered;
2330
public static event Action<int> WatchChainIdTriggered;
2431

0 commit comments

Comments
 (0)