44using Newtonsoft . Json ;
55using UnityEngine ;
66using WalletConnect . Web3Modal . Http ;
7+ using WalletConnectSharp . Common . Logging ;
78
89namespace WalletConnect . Web3Modal
910{
@@ -12,9 +13,8 @@ public class EventsController
1213 private const string BasePath = "https://pulse.walletconnect.org/" ;
1314 private const int TimoutSeconds = 5 ;
1415
15- private readonly UnityHttpClient _httpClient = new ( new Uri ( BasePath ) , TimeSpan . FromSeconds ( TimoutSeconds ) , new Web3ModalApiHeaderDecorator ( ) ) ;
16+ private readonly UnityHttpClient _httpClient = new ( new Uri ( BasePath ) , TimeSpan . FromSeconds ( TimoutSeconds ) , new PulseApiHeaderDecorator ( ) ) ;
1617
17- // private Queue<Event> _eventsQueue = new();
1818 private AnalyticsState _state = AnalyticsState . Loading ;
1919
2020 public async Task InitializeAsync ( Web3ModalConfig config , ApiController apiController )
@@ -53,10 +53,6 @@ private async Task LoadRemoteAnalyticsConfig(ApiController apiController)
5353
5454 public async void SendEvent ( Event @event )
5555 {
56- #if ! UNITY_IOS && ! UNITY_ANDROID
57- // Temporary disable analytics for non-mobile platforms
58- return ;
59- #endif
6056 try
6157 {
6258 if ( _state == AnalyticsState . Disabled )
@@ -66,13 +62,15 @@ public async void SendEvent(Event @event)
6662 {
6763 eventId = Guid . NewGuid ( ) . ToString ( ) ,
6864 timestamp = DateTimeOffset . UtcNow . ToUnixTimeMilliseconds ( ) ,
65+ #if UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS
6966 bundleId = Application . identifier ,
67+ #endif
7068 props = @event
7169 } ;
7270
7371 var requestJson = JsonConvert . SerializeObject ( request ) ;
7472
75- Debug . Log ( $ "[EventsController] Sending event: { @event . name } .\n \n Request payload:\n { requestJson } ") ;
73+ WCLogger . Log ( $ "[EventsController] Sending event: { @event . name } .\n \n Request payload:\n { requestJson } ") ;
7674
7775 await _httpClient . PostAsync ( "e" , requestJson ) ;
7876 }
0 commit comments