diff --git a/Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/ChainSafe.Gaming.HyperPlay.dll b/Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/ChainSafe.Gaming.HyperPlay.dll index 948ce93a8..ff13ed1b3 100644 Binary files a/Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/ChainSafe.Gaming.HyperPlay.dll and b/Packages/io.chainsafe.web3-unity.hyperplay/Runtime/Libraries/ChainSafe.Gaming.HyperPlay.dll differ diff --git a/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/ChainSafe.Gaming.Lootboxes.Chainlink.dll b/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/ChainSafe.Gaming.Lootboxes.Chainlink.dll index 341936d0b..3e8c1fd1c 100644 Binary files a/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/ChainSafe.Gaming.Lootboxes.Chainlink.dll and b/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/ChainSafe.Gaming.Lootboxes.Chainlink.dll differ diff --git a/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/Chainsafe.Gaming.Chainlink.dll b/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/Chainsafe.Gaming.Chainlink.dll index 8e2859aae..aad51e024 100644 Binary files a/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/Chainsafe.Gaming.Chainlink.dll and b/Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries/Chainsafe.Gaming.Chainlink.dll differ diff --git a/Packages/io.chainsafe.web3-unity.mud/Runtime/Libraries/ChainSafe.Gaming.Mud.dll b/Packages/io.chainsafe.web3-unity.mud/Runtime/Libraries/ChainSafe.Gaming.Mud.dll index e5aaf3414..8dceddda1 100644 Binary files a/Packages/io.chainsafe.web3-unity.mud/Runtime/Libraries/ChainSafe.Gaming.Mud.dll and b/Packages/io.chainsafe.web3-unity.mud/Runtime/Libraries/ChainSafe.Gaming.Mud.dll differ diff --git a/Packages/io.chainsafe.web3-unity.ramp/Runtime/Scripts/RampExchangerUniversal.cs b/Packages/io.chainsafe.web3-unity.ramp/Runtime/Scripts/RampExchangerUniversal.cs index 851157f6e..83595fd7f 100644 --- a/Packages/io.chainsafe.web3-unity.ramp/Runtime/Scripts/RampExchangerUniversal.cs +++ b/Packages/io.chainsafe.web3-unity.ramp/Runtime/Scripts/RampExchangerUniversal.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; using ChainSafe.Gaming.Evm.Signers; -using ChainSafe.Gaming.Web3.Analytics; + using ChainSafe.Gaming.Web3.Core; namespace ChainSafe.Gaming.Exchangers.Ramp @@ -10,7 +10,6 @@ public class RampExchangerUniversal : IRampExchanger, ILifecycleParticipant { private readonly IRampExchangerConfig config; private readonly ISigner signer; - private readonly IAnalyticsClient analyticsClient; public event Action OnRampPurchaseCreated; public event Action OffRampSaleCreated; @@ -18,20 +17,14 @@ public class RampExchangerUniversal : IRampExchanger, ILifecycleParticipant private IRampExchanger platformImplementation; - public RampExchangerUniversal(IRampExchangerConfig config, ISigner signer, IAnalyticsClient analyticsClient) + public RampExchangerUniversal(IRampExchangerConfig config, ISigner signer) { this.signer = signer; this.config = config; - this.analyticsClient = analyticsClient; } public ValueTask WillStartAsync() { - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = "Ramp Initialized", - PackageName = "io.chainsafe.web3-unity.exchangers.ramp" - }); platformImplementation = RampExchangerFactory.CreateRampExchanger(config, signer); platformImplementation.OnRampPurchaseCreated += InvokeOnRampPurchaseCreated; platformImplementation.OffRampSaleCreated += InvokeOffRampSaleCreated; @@ -57,21 +50,11 @@ public Task BuyOrSellCrypto(RampBuyOrSellWidgetSettings set private void InvokeOnRampPurchaseCreated(OnRampPurchaseData obj) { - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = "Ramp Purchased Happened", - PackageName = "io.chiansafe.web3-unity.exchangers.ramp" - }); OnRampPurchaseCreated?.Invoke(obj); } private void InvokeOffRampSaleCreated(OffRampSaleData obj) { - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = "Ramp Sale Happened", - PackageName = "io.chiansafe.web3-unity.exchangers.ramp" - }); OffRampSaleCreated?.Invoke(obj); } } diff --git a/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.cs b/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.cs index 9acbbe4f9..8df9d764d 100644 --- a/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.cs +++ b/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.cs @@ -16,8 +16,6 @@ namespace ChainSafe.GamingSdk.Editor { public partial class Web3SettingsEditor : EditorWindow { - // Default values - private const string EnableAnalyticsScriptingDefineSymbol = "ENABLE_ANALYTICS"; // Initializes window diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Debugging.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Debugging.dll index e9d7a2a0c..3b1ebb8a8 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Debugging.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Debugging.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Gelato.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Gelato.dll index 08b333ddf..b9dd49ce2 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Gelato.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Gelato.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessSigner.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessSigner.dll index 78e6afce5..4aa1936cb 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessSigner.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessSigner.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessTransactionExecutor.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessTransactionExecutor.dll index 6eef8b185..64a4ae123 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessTransactionExecutor.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.InProcessTransactionExecutor.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.SygmaClient.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.SygmaClient.dll index a57dddd15..0b9cdf31c 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.SygmaClient.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.SygmaClient.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.EthereumWindow.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.EthereumWindow.dll index 12cc4aa9e..39ec2b78f 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.EthereumWindow.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.EthereumWindow.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.MetaMask.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.MetaMask.dll index 076a13d87..bc78153c7 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.MetaMask.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.MetaMask.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.ThirdParty.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.ThirdParty.dll index 40b9bad81..9138455f5 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.ThirdParty.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.ThirdParty.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.dll index 4194f249f..760350b6e 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.Unity.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.WalletConnect.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.WalletConnect.dll index 70cef0608..61b2a9fe3 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.WalletConnect.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.WalletConnect.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.dll b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.dll index 348465965..7aeea7153 100644 Binary files a/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.dll and b/Packages/io.chainsafe.web3-unity/Runtime/Libraries/ChainSafe.Gaming.dll differ diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Countly.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Countly.cs deleted file mode 100644 index 27f34c1e0..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Countly.cs +++ /dev/null @@ -1,546 +0,0 @@ -using System; -using System.Collections; -using System.Runtime.CompilerServices; -using System.Collections.Generic; -using Notifications; -using Notifications.Impls; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Entities; -using Plugins.CountlySDK.Persistance.Repositories; -using Plugins.CountlySDK.Persistance.Repositories.Impls; -using Plugins.CountlySDK.Services; -using Plugins.iBoxDB; -using UnityEngine; -using Plugins.CountlySDK.Enums; - -[assembly: InternalsVisibleTo("PlayModeTests")] -namespace Plugins.CountlySDK -{ - public class Countly : MonoBehaviour - { - //SDK limit defaults - internal const int MaxKeyLengthDefault = 128; - internal const int MaxValueSizeDefault = 256; - internal const int MaxSegmentationValuesDefault = 100; - internal const int MaxBreadcrumbCountDefault = 100; - internal const int MaxStackTraceLinesPerThreadDefault = 30; - internal const int MaxStackTraceLineLengthDefault = 200; - internal const int MaxStackTraceThreadCountDefault = 30; - - public CountlyAuthModel Auth; - public CountlyConfigModel Config; - internal RequestCountlyHelper RequestHelper; - internal CountlyConfiguration Configuration; - - /// - /// Check if SDK has been initialized. - /// - /// bool - public bool IsSDKInitialized { get; private set; } - - private CountlyLogHelper _logHelper; - private static Countly _instance = null; - internal StorageAndMigrationHelper StorageHelper; - internal readonly object lockObj = new object(); - private List _listeners = new List(); - - /// - /// Return countly shared instance. - /// - /// Countly - public static Countly Instance - { - get - { - if (_instance == null) - { - - GameObject gameObject = new GameObject("_countly"); - _instance = gameObject.AddComponent(); - } - - return _instance; - - } - internal set - { - _instance = value; - } - } - - /// - /// Check/Update consent for a particular feature. - /// - ///ConsentCountlyService - public ConsentCountlyService Consents { get; private set; } - - /// - /// Exposes functionality to record crashes/errors and record breadcrumbs. - /// - /// CrashReportsCountlyService - public CrashReportsCountlyService CrashReports { get; private set; } - - /// - /// Exposes functionality to get the current device ID and change id. - /// - /// DeviceIdCountlyService - public DeviceIdCountlyService Device { get; private set; } - - /// - /// Exposes functionality to record custom events. - /// - /// EventCountlyService - public EventCountlyService Events { get; private set; } - - internal InitializationCountlyService Initialization { get; private set; } - - /// - /// Exposes functionality to set location parameters. - /// - /// LocationService - public Services.LocationService Location { get; private set; } - - /// - /// Exposes functionality to update the remote config values. It also provides a way to access the currently downloaded ones. - /// - /// RemoteConfigCountlyService - public RemoteConfigCountlyService RemoteConfigs { get; private set; } - - /// - /// Exposes functionality to report start rating. - /// - /// StarRatingCountlyService - public StarRatingCountlyService StarRating { get; private set; } - - /// - /// Exposes functionality to set and change custom user properties and interact with custom property modifiers. - /// - /// UserDetailsCountlyService - public UserDetailsCountlyService UserDetails { get; private set; } - - /// - /// Exposes functionality to start and stop recording views and report positions for heat-map. - /// - /// ViewCountlyService - public ViewCountlyService Views { get; private set; } - - public MetricHelper MetricHelper { get; private set; } - internal SessionCountlyService Session { get; set; } - - /// - /// Add callbacks to listen to push notification events for when a notification is received and when it is clicked. - /// - /// NotificationsCallbackService - public NotificationsCallbackService Notifications { get; set; } - - private bool _logSubscribed; - private PushCountlyService _push; - - - /// - /// Initialize SDK at the start of your app - /// - private void Awake() - { - DontDestroyOnLoad(gameObject); - Instance = this; - - //Auth and Config will not be null in case initializing through countly prefab - if (Auth != null && Config != null) - { - Init(new CountlyConfiguration(Auth, Config)); - } - - } - - public void Init(CountlyConfiguration configuration) - { - if (IsSDKInitialized) - { - _logHelper.Error("SDK has already been initialized, 'Init' should not be called a second time!"); - return; - } - - Configuration = configuration; - _logHelper = new CountlyLogHelper(Configuration); - - _logHelper.Info("[Init] Initializing Countly [SdkName: " + Constants.SdkName + " SdkVersion: " + Constants.SdkVersion + "]"); - - configuration.metricHelper = new MetricHelper(configuration.overridenMetrics); - - if (configuration.Parent != null) - { - transform.parent = configuration.Parent.transform; - } - - if (string.IsNullOrEmpty(configuration.ServerUrl)) - { - throw new ArgumentNullException(configuration.ServerUrl, "Server URL is required."); - } - - if (string.IsNullOrEmpty(configuration.AppKey)) - { - throw new ArgumentNullException(configuration.AppKey, "App Key is required."); - } - - if (configuration.ServerUrl[configuration.ServerUrl.Length - 1] == '/') - { - configuration.ServerUrl = configuration.ServerUrl.Remove(configuration.ServerUrl.Length - 1); - } - - _logHelper.Debug("[Init] SDK initialized with the URL:[" + configuration.ServerUrl + "] and the appKey:[" + configuration.AppKey + "]"); - - - if (configuration.SessionDuration < 1) - { - _logHelper.Error("[Init] provided session duration is less than 1. Replacing it with 1."); - configuration.SessionDuration = 1; - } - _logHelper.Debug("[Init] session duration set to [" + configuration.SessionDuration + "]"); - - if (configuration.EnablePost) - { - _logHelper.Debug("[Init] Setting HTTP POST to be forced"); - } - - if (configuration.Salt != null) - { - _logHelper.Debug("[Init] Enabling tamper protection"); - } - - if (configuration.NotificationMode != TestMode.None) - { - _logHelper.Debug("[Init] Enabling push notification"); - } - - if (configuration.EnableTestMode) - { - _logHelper.Warning("[Init] Enabling test mode"); - } - - if (configuration.EnableAutomaticCrashReporting) - { - _logHelper.Debug("[Init] Enabling automatic crash reporting"); - } - - // Have a look at the SDK limit values - if (configuration.EventQueueThreshold < 1) - { - _logHelper.Error("[Init] provided event queue size is less than 1. Replacing it with 1."); - configuration.EventQueueThreshold = 1; - } - _logHelper.Debug("[Init] event queue size set to [" + configuration.EventQueueThreshold + "]"); - - if (configuration.StoredRequestLimit < 1) - { - _logHelper.Error("[Init] provided request queue size is less than 1. Replacing it with 1."); - configuration.StoredRequestLimit = 1; - } - _logHelper.Debug("[Init] request queue size set to [" + configuration.StoredRequestLimit + "]"); - - if (configuration.MaxKeyLength != MaxKeyLengthDefault) - { - if (configuration.MaxKeyLength < 1) - { - configuration.MaxKeyLength = 1; - _logHelper.Warning("[Init] provided 'maxKeyLength' is less than '1'. Setting it to '1'."); - } - _logHelper.Info("[Init] provided 'maxKeyLength' override:[" + configuration.MaxKeyLength + "]"); - } - - if (configuration.MaxValueSize != MaxValueSizeDefault) - { - if (configuration.MaxValueSize < 1) - { - configuration.MaxValueSize = 1; - _logHelper.Warning("[Init] provided 'maxValueSize' is less than '1'. Setting it to '1'."); - } - _logHelper.Info("[Init] provided 'maxValueSize' override:[" + configuration.MaxValueSize + "]"); - } - - if (configuration.MaxSegmentationValues != MaxSegmentationValuesDefault) - { - if (configuration.MaxSegmentationValues < 1) - { - configuration.MaxSegmentationValues = 1; - _logHelper.Warning("[Init] provided 'maxSegmentationValues' is less than '1'. Setting it to '1'."); - } - _logHelper.Info("[Init] provided 'maxSegmentationValues' override:[" + configuration.MaxSegmentationValues + "]"); - } - - if (configuration.TotalBreadcrumbsAllowed != MaxBreadcrumbCountDefault) - { - if (configuration.TotalBreadcrumbsAllowed < 1) - { - configuration.TotalBreadcrumbsAllowed = 1; - _logHelper.Warning("[Init] provided 'maxBreadcrumbCount' is less than '1'. Setting it to '1'."); - } - _logHelper.Info("[Init] provided 'maxBreadcrumbCount' override:[" + configuration.TotalBreadcrumbsAllowed + "]"); - } - - if (configuration.MaxStackTraceLinesPerThread != MaxStackTraceLinesPerThreadDefault) - { - if (configuration.MaxStackTraceLinesPerThread < 1) - { - configuration.MaxStackTraceLinesPerThread = 1; - _logHelper.Warning("[Init] provided 'maxStackTraceLinesPerThread' is less than '1'. Setting it to '1'."); - } - _logHelper.Info("[Init] provided 'maxStackTraceLinesPerThread' override:[" + configuration.MaxStackTraceLinesPerThread + "]"); - } - - if (configuration.MaxStackTraceLineLength != MaxStackTraceLineLengthDefault) - { - if (configuration.MaxStackTraceLineLength < 1) - { - configuration.MaxStackTraceLineLength = 1; - _logHelper.Warning("[Init] provided 'maxStackTraceLineLength' is less than '1'. Setting it to '1'."); - } - _logHelper.Info("[Init] provided 'maxStackTraceLineLength' override:[" + configuration.MaxStackTraceLineLength + "]"); - } - - if (configuration.SafeEventIDGenerator == null) - { - configuration.SafeEventIDGenerator = new SafeIDGenerator(); - } - - if (configuration.SafeViewIDGenerator == null) - { - configuration.SafeViewIDGenerator = new SafeIDGenerator(); - } - - FirstLaunchAppHelper.Process(); - - RequestBuilder requestBuilder = new RequestBuilder(); - StorageHelper = new StorageAndMigrationHelper(_logHelper, requestBuilder); - StorageHelper.OpenDB(); - - IDictionary migrationParams = new Dictionary() - { - {StorageAndMigrationHelper.key_from_2_to_3_custom_id_set, configuration.DeviceId != null }, - }; - - StorageHelper.RunMigration(migrationParams); - - Init(requestBuilder, StorageHelper.RequestRepo, StorageHelper.EventRepo, StorageHelper.ConfigDao); - - Device.InitDeviceId(configuration.DeviceId); - OnInitialisationComplete(); - - _logHelper.Debug("[Countly] Finished Initializing SDK."); - } - - private void Init(RequestBuilder requestBuilder, RequestRepository requestRepo, - NonViewEventRepository nonViewEventRepo, Dao configDao) - { - CountlyUtils countlyUtils = new CountlyUtils(this); - RequestHelper = new RequestCountlyHelper(Configuration, _logHelper, countlyUtils, requestBuilder, requestRepo, this); - - Consents = new ConsentCountlyService(Configuration, _logHelper, Consents, RequestHelper); - Events = new EventCountlyService(Configuration, _logHelper, RequestHelper, nonViewEventRepo, Consents); - - Location = new Services.LocationService(Configuration, _logHelper, RequestHelper, Consents); - Notifications = new NotificationsCallbackService(Configuration, _logHelper); - ProxyNotificationsService notificationsService = new ProxyNotificationsService(transform, Configuration, _logHelper, InternalStartCoroutine, Events); - _push = new PushCountlyService(Configuration, _logHelper, RequestHelper, notificationsService, Notifications, Consents); - Session = new SessionCountlyService(Configuration, _logHelper, Events, RequestHelper, Location, Consents, this); - - CrashReports = new CrashReportsCountlyService(Configuration, _logHelper, RequestHelper, Consents); - Initialization = new InitializationCountlyService(Configuration, _logHelper, Location, Session, Consents); - RemoteConfigs = new RemoteConfigCountlyService(Configuration, _logHelper, RequestHelper, countlyUtils, configDao, Consents, requestBuilder); - - StarRating = new StarRatingCountlyService(Configuration, _logHelper, Consents, Events); - UserDetails = new UserDetailsCountlyService(Configuration, _logHelper, RequestHelper, countlyUtils, Consents); - Views = new ViewCountlyService(Configuration, _logHelper, Events, Consents); - Device = new DeviceIdCountlyService(Configuration, _logHelper, Session, RequestHelper, Events, countlyUtils, Consents); - - CreateListOfIBaseService(); - RegisterListenersToServices(); - } - - private async void OnInitialisationComplete() - { - lock (lockObj) - { - IsSDKInitialized = true; - _ = Initialization.OnInitialisationComplete(); - foreach (AbstractBaseService listener in _listeners) - { - listener.OnInitializationCompleted(); - } - } - - } - - private void CreateListOfIBaseService() - { - _listeners.Clear(); - - _listeners.Add(_push); - _listeners.Add(Views); - _listeners.Add(Events); - _listeners.Add(Device); - _listeners.Add(Session); - _listeners.Add(Location); - _listeners.Add(Consents); - _listeners.Add(StarRating); - _listeners.Add(UserDetails); - _listeners.Add(CrashReports); - _listeners.Add(RemoteConfigs); - _listeners.Add(Initialization); - } - - private void RegisterListenersToServices() - { - Device.Listeners = _listeners; - Consents.Listeners = _listeners; - - foreach (AbstractBaseService listener in _listeners) - { - listener.LockObj = lockObj; - } - } - - /// - /// End session on application close/quit - /// - private void OnApplicationQuit() - { - if (!IsSDKInitialized) - { - return; - } - - _logHelper.Debug("[Countly] OnApplicationQuit"); - Session?._sessionTimer?.Dispose(); - StorageHelper?.CloseDB(); - } - - internal void CloseDBConnection() - { - StorageHelper?.CloseDB(); - } - - internal void ClearStorage() - { - if (!IsSDKInitialized) - { - return; - } - - _logHelper.Debug("[Countly] ClearStorage"); - - PlayerPrefs.DeleteAll(); - StorageHelper?.ClearDBData(); - - StorageHelper?.CloseDB(); - } - - private void OnApplicationFocus(bool hasFocus) - { - if (!IsSDKInitialized) - { - return; - } - - _logHelper?.Debug("[Countly] OnApplicationFocus: " + hasFocus); - - if (hasFocus) - { - SubscribeAppLog(); - } - else - { - HandleAppPauseOrFocus(); - } - } - - private void OnApplicationPause(bool pauseStatus) - { - lock (lockObj) - { - if (!IsSDKInitialized) - { - return; - } - - _logHelper?.Debug("[Countly] OnApplicationPause: " + pauseStatus); - - if (CrashReports != null) - { - CrashReports.IsApplicationInBackground = pauseStatus; - } - - if (pauseStatus) - { - HandleAppPauseOrFocus(); - if (!Configuration.IsAutomaticSessionTrackingDisabled) - { - _ = Session?.EndSessionAsync(); - } - } - else - { - SubscribeAppLog(); - if (!Configuration.IsAutomaticSessionTrackingDisabled) - { - _ = Session?.BeginSessionAsync(); - } - } - } - } - - private void HandleAppPauseOrFocus() - { - UnsubscribeAppLog(); - } - - // Whenever app is enabled - private void OnEnable() - { - SubscribeAppLog(); - } - - // Whenever app is disabled - private void OnDisable() - { - UnsubscribeAppLog(); - } - - private void LogCallback(string condition, string stackTrace, LogType type) - { - if (type == LogType.Exception) - { - CrashReports?.SendCrashReportAsync(condition, stackTrace); - } - - } - - private void SubscribeAppLog() - { - if (_logSubscribed) - { - return; - } - - Application.logMessageReceived += LogCallback; - _logSubscribed = true; - } - - private void UnsubscribeAppLog() - { - if (!_logSubscribed) - { - return; - } - - Application.logMessageReceived -= LogCallback; - _logSubscribed = false; - } - - private void InternalStartCoroutine(IEnumerator enumerator) - { - StartCoroutine(enumerator); - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Countly.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Countly.cs.meta deleted file mode 100644 index 717774516..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Countly.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 3830ecbe0f874710af3c6377b4540a81 -timeCreated: 1558362112 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/CountlyUtils.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/CountlyUtils.cs deleted file mode 100644 index e5d82273a..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/CountlyUtils.cs +++ /dev/null @@ -1,288 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Security.Cryptography; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using UnityEngine; - -namespace Plugins.CountlySDK -{ - public class CountlyUtils - { - private readonly Countly _countly; - internal string ServerInputUrl { get; private set; } - internal string ServerOutputUrl { get; private set; } - - public CountlyUtils(Countly countly) - { - _countly = countly; - - ServerInputUrl = _countly.Configuration.ServerUrl + "/i?"; - ServerOutputUrl = _countly.Configuration.ServerUrl + "/o/sdk?"; - } - - public static string GetUniqueDeviceId() - { - string uniqueID = SystemInfo.deviceUniqueIdentifier; - if (uniqueID.Length > 5) - { - return "CLY_" + uniqueID; - } - else - { - return "CLY_" + SafeRandomVal(); - } - } - - public static string GetAppVersion() - { - return Application.version; - } - - /// - /// Retrieves a dictionary of base parameters required for requests to the Countly server. - /// - /// - /// A dictionary containing essential parameters, including "app_key," "device_id," "t," "sdk_name," "sdk_version," "av," and time-based metrics. - /// - public Dictionary GetBaseParams() - { - Dictionary baseParams = new Dictionary - { - {"app_key", _countly.Configuration.AppKey}, - {"device_id", _countly.Device.DeviceId}, - {"t", Type()}, - {"sdk_name", Constants.SdkName}, - {"sdk_version", Constants.SdkVersion}, - {"av", GetAppVersion()} - }; - - // Add time-based metrics to the base parameters dictionary - foreach (KeyValuePair item in TimeMetricModel.GetTimeMetricModel()) - { - baseParams.Add(item.Key, item.Value); - } - return baseParams; - } - - /// - /// Retrieves the set of parameters, "app_key" and "device_id,", required to be sent along with a remote configuration request. - /// - /// - /// Dictionary containing the "app_key" and "device_id" parameters required for the remote config request. - /// - public Dictionary GetAppKeyAndDeviceIdParams() - { - return new Dictionary - { - {"app_key", _countly.Configuration.AppKey}, - {"device_id", _countly.Device.DeviceId} - }; - } - - /// - /// Checks whether a string is null, empty, or consists only of whitespace characters. - /// Convenience call that combines both checks - /// - /// The string to be checked. - /// - /// true if the input string is null, empty, or contains only whitespace characters; - /// otherwise, false. - /// - public bool IsNullEmptyOrWhitespace(string input) - { - return string.IsNullOrEmpty(input) || string.IsNullOrWhiteSpace(input); - } - - /// - /// Checks whether a given picture URL is valid based on its format. - /// - /// The URL of the picture to be validated. - /// - /// true if the picture URL is valid; otherwise, false. - /// - public bool IsPictureValid(string pictureUrl) - { - // Check if the provided url contains additional query parameters. Indicated by "?" - if (!string.IsNullOrEmpty(pictureUrl) && pictureUrl.Contains("?")) - { - // Remove the query string portion to isolate the file extension. - pictureUrl = pictureUrl.Split(new[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0]; - } - - // Check the validity of the picture URL based on its file extension. - return string.IsNullOrEmpty(pictureUrl) - || pictureUrl.EndsWith(".png") - || pictureUrl.EndsWith(".jpg") - || pictureUrl.EndsWith(".jpeg") - || pictureUrl.EndsWith(".gif"); - } - - /// - /// Converts a byte array to a hexadecimal string representation. - /// - /// The byte array to be converted. - /// - /// A hexadecimal string representation of the input byte array, - /// or an empty string if the input byte array is null. - /// - public string GetStringFromBytes(byte[] bytes) - { - if (bytes == null) - { - // Always return a value as a fallback - return ""; - } - - StringBuilder hex = new StringBuilder(bytes.Length * 2); - - // Iterate through each byte and convert to hexadecimal - foreach (byte b in bytes) - { - hex.AppendFormat("{0:x2}", b); - } - - return hex.ToString(); - } - - /// - /// Removes dictionary keys exceeding a specified count - /// - /// - /// - /// - /// - public void TruncateSegmentationValues(Dictionary? segmentation, int maxCount, string prefix, CountlyLogHelper logger) - { - if (segmentation == null) - { - return; - } - - List keysToRemove = segmentation.Keys.Skip(maxCount).ToList(); - - foreach (string key in keysToRemove) - { - logger.Warning($"{prefix}, Value exceeded the maximum segmentation count key:[{key}]"); - segmentation.Remove(key); - } - } - - /// - /// Removes specific reserved keys from a dictionary of segmentation values - /// - /// - /// - /// - /// - public void RemoveReservedKeysFromSegmentation(Dictionary? segmentation, string[] reservedKeys, string messagePrefix, CountlyLogHelper logger) - { - if (segmentation == null) - { - return; - } - - foreach (string rKey in reservedKeys) - { - if (segmentation.ContainsKey(rKey)) - { - logger.Warning($"{messagePrefix} provided segmentation contains protected key [{rKey}]"); - segmentation.Remove(rKey); - } - } - } - - /// - /// Returns the current timestamp in seconds using the Unix time format - /// - public int CurrentTimestampSeconds() - { - return (int)(DateTimeOffset.UtcNow.ToUnixTimeSeconds()); - } - - /// - /// Creates a crypto-safe SHA-256 hashed random value. - /// - /// Randomly generated string - public static string SafeRandomVal() - { - long timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(); - using (RandomNumberGenerator random = new RNGCryptoServiceProvider()) - { - byte[] value = new byte[6]; - random.GetBytes(value); - string b64Value = Convert.ToBase64String(value); - return b64Value + timestamp; - } - } - - /// - /// Removes unsupported data types from provided Dictionary - /// - /// - /// - /// Returns true if any entry had been removed - public bool RemoveUnsupportedDataTypes(Dictionary? data, CountlyLogHelper? logger) - { - if (data == null) - { - return false; - } - - List keysToRemove = new List(); - bool removed = false; - - foreach (var entry in data) - { - string key = entry.Key; - object value = entry.Value; - - if (string.IsNullOrEmpty(key) || !(value is string || value is int || value is double || value is bool || value is float)) - { - // found unsupported data type or null key or value, add key to removal list - keysToRemove.Add(key); - removed = true; - } - } - - // Remove the keys marked for removal - foreach (string key in keysToRemove) - { - data.Remove(key); - } - - if (removed & logger != null) - { - logger.Warning("[Utils] Unsupported data types were removed from provided segmentation"); - } - - return removed; - } - - /// - /// Returns the device ID type of the current device ID.
- /// 0 - developer provided
- /// 1 - SDK generated
- ///
- private int Type() - { - int type = 0; - - switch (_countly.Device.DeviceIdType) - { - case DeviceIdType.DeveloperProvided: - type = 0; - break; - case DeviceIdType.SDKGenerated: - type = 1; - break; - default: - break; - } - return type; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/CountlyUtils.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/CountlyUtils.cs.meta deleted file mode 100644 index 01f7d3eba..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/CountlyUtils.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 3228d29bd25f4f828a05e88aa3fe434d -timeCreated: 1558879568 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/CountlyBuildProcessor.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/CountlyBuildProcessor.cs deleted file mode 100644 index 4d3294bbf..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/CountlyBuildProcessor.cs +++ /dev/null @@ -1,45 +0,0 @@ -#if ENABLE_VSTU - -#if UNITY_ANDROID -using System.IO; -using UnityEngine; -#endif - -#if !UNITY_2017 -using UnityEditor.Build.Reporting; -#endif -using UnityEditor; -using UnityEditor.Build; - -namespace Plugins.CountlySDK.Editor -{ - -#if UNITY_2017 - internal class CountlyBuildProcessor : IPreprocessBuild - { - - public void OnPreprocessBuild(BuildTarget target, string path) - { -#else - internal class CountlyBuildProcessor : IPreprocessBuildWithReport - { - public void OnPreprocessBuild(BuildReport report) - { -#endif - -#if UNITY_ANDROID - string directoryPath = "/Plugins/Android/Notifications/"; - string filePath = "/Plugins/Android/Notifications/libs/countly_notifications.jar"; - if (!File.Exists(Application.dataPath + "" + filePath)) { - if (Directory.Exists(Application.dataPath + directoryPath) && !File.Exists(Application.dataPath + "" + filePath)) { - Debug.LogError("[CountlyBuildProcessor] notifications.jar not found at: " + filePath); - } - } -#endif - } - public int callbackOrder { get { return 0; } } - } - - -} -#endif \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/CountlyBuildProcessor.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/CountlyBuildProcessor.cs.meta deleted file mode 100644 index 53cb8e083..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/CountlyBuildProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0a4be9509a66cd04492a8428de13b7ee -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/EditorConfigSolutionFileGenerator.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/EditorConfigSolutionFileGenerator.cs deleted file mode 100644 index a5628bb66..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/EditorConfigSolutionFileGenerator.cs +++ /dev/null @@ -1,45 +0,0 @@ -#if ENABLE_VSTU -using UnityEditor; -using SyntaxTree.VisualStudio.Unity.Bridge; - -/// -/// This class hooks into the Visual Studio .sln generation step and modifies the file -/// to include .editorconfig, which enforces consistent formatting standards and naming -/// conventions. -/// https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017 -/// -[InitializeOnLoad] -public class EditorConfigSolutionFileGenerator -{ - public static string kEditorConfigProjectFindStr = "EndProject\r\nGlobal"; - public static string kEditorConfigProjectReplaceStr = - "EndProject\r\n" + - "Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{B24FE069-BB5F-4F16-BCDA-61C28EABC46B}\"\r\n" + - " ProjectSection(SolutionItems) = preProject\r\n" + - " .editorconfig = .editorconfig\r\n" + - " EndProjectSection\r\n" + - "EndProject\r\n" + - "Global"; - - public static string kGlobalSectionFindStr = "EndGlobalSection\r\nEndGlobal"; - public static string kGlobalSectionReplaceStr = - "EndGlobalSection\r\n" + - " GlobalSection(ExtensibilityGlobals) = postSolution\r\n" + - " SolutionGuid = {FD87994B-C032-4821-BD72-E057C33083EF}\r\n" + - " EndGlobalSection\r\n" + - "EndGlobal"; - - static EditorConfigSolutionFileGenerator() - { - ProjectFilesGenerator.SolutionFileGeneration += AppendEditorConfig; - } - - protected static string AppendEditorConfig(string fileName, string fileContent) - { - fileContent = fileContent.Replace(kEditorConfigProjectFindStr, kEditorConfigProjectReplaceStr); - fileContent = fileContent.Replace(kGlobalSectionFindStr, kGlobalSectionReplaceStr); - - return fileContent; - } -} -#endif diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/EditorConfigSolutionFileGenerator.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/EditorConfigSolutionFileGenerator.cs.meta deleted file mode 100644 index 27833dd32..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Editor/EditorConfigSolutionFileGenerator.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 056bfdedc1c541d4b9a62aab34f642a3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/Consents.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/Consents.cs deleted file mode 100644 index ddcb908bf..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/Consents.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Plugins.CountlySDK.Enums -{ - public enum Consents - { - Push, - Views, - Users, - Events, - Clicks, - Crashes, - Location, - Sessions, - Feedback, - StarRating, - RemoteConfig - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/Consents.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/Consents.cs.meta deleted file mode 100644 index 0ef8f5a52..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/Consents.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 312bd0051f5454b2f9bdeeafe3548650 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/DeviceIdType.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/DeviceIdType.cs deleted file mode 100644 index 2c8cb574a..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/DeviceIdType.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.ComponentModel; - -namespace Plugins.CountlySDK.Enums -{ - public enum DeviceIdType - { - SDKGenerated = 0, - DeveloperProvided = 1, - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/DeviceIdType.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/DeviceIdType.cs.meta deleted file mode 100644 index 1c8227f9a..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/DeviceIdType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5e994720d64abf343a472003f4946429 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/TestMode.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/TestMode.cs deleted file mode 100755 index f63ef957c..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/TestMode.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel; - -namespace Plugins.CountlySDK.Enums -{ - public enum TestMode - { - None = -1, - // NOTE: The integer values assigned are NOT MEANT TO BE CHANGED - [Description("Used for Android/iOS Production build")] - ProductionToken = 0, - [Description("Used for iOS Debug/Development/Test build")] - iOSTestToken = 1, - [Description("Used for Android Debug/Development/Test build")] - AndroidTestToken = 2, - [Description("Used for iOS AdHoc build")] - iOSAdHocToken = 2 - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/TestMode.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/TestMode.cs.meta deleted file mode 100755 index c4dc8ca2e..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Enums/TestMode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e871812cbd7947f43acf93d4fba37d98 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Constants.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Constants.cs deleted file mode 100644 index 88215c201..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Constants.cs +++ /dev/null @@ -1,56 +0,0 @@ - -using UnityEngine; - -namespace Plugins.CountlySDK.Helpers -{ - internal class Constants - { - public const string SdkVersion = "23.12.0"; - -#if UNITY_EDITOR - public const string SdkName = "csharp-unity-editor"; -#elif UNITY_ANDROID - public const string SdkName = "csharp-unity-android"; -#elif UNITY_IOS - public const string SdkName = "csharp-unity-ios"; -#elif UNITY_STANDALONE_WIN - public const string SdkName = "csharp-unity-windows"; -#elif UNITY_STANDALONE_OSX - public const string SdkName = "csharp-unity-osx"; -#elif UNITY_STANDALONE_LINUX - public const string SdkName = "csharp-unity-linux"; -#elif UNITY_WEBGL - public const string SdkName = "csharp-unity-webgl"; -#elif UNITY_TVOS - public const string SdkName = "csharp-unity-tvos"; -#elif UNITY_WSA_10_0 - public const string SdkName = "csharp-unity-uwp"; -#elif UNITY_PS4 - public const string SdkName = "csharp-unity-ps4" -#elif UNITY_XBOXONE - public const string SdkName = "csharp-unity-xboxone" -#else - public const string SdkName = "generic"; -#endif - - public const string CountlyServerUrl = "https://us-try.count.ly/"; - public const string DeviceIDKey = "DeviceID"; - public const string DeviceIDTypeKey = "DeviceIDType"; - - - public const string SchemaVersion = "Countly.SchemaVersion"; - public const string FirstAppLaunch = "Countly.FirstAppLaunch"; - public const string FirstAppLaunchSegment = "firstAppLaunch"; - - #region Notification Keys - - public const string MessageIDKey = "c.i"; - public const string TitleDataKey = "title"; - public const string MessageDataKey = "message"; - public const string ImageUrlKey = "c.m"; - public const string ActionButtonKey = "c.b"; - public const string SoundDataKey = "sound"; - - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Constants.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Constants.cs.meta deleted file mode 100755 index 107d71a30..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Constants.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e9c27426cbaf3f745b77fb9cee7ab4dc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Converter.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Converter.cs deleted file mode 100644 index d04a01445..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Converter.cs +++ /dev/null @@ -1,138 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Entities; - -namespace Plugins.CountlySDK.Helpers -{ - /// Providing methods for converting data between different models and JSON representations. - public static class Converter - { - /// - /// Converts an EventEntity object to a CountlyEventModel object. - /// - /// - /// CountlyEventModel object representing the converted data, or null if the input entity is null or invalid. - /// - public static CountlyEventModel ConvertEventEntityToEventModel(EventEntity entity, CountlyLogHelper L) - { - // Check if the input EventEntity is null - if (entity == null) - { - L?.Warning("[Converter] 'ConvertEventEntityToEventModel': EventEntity variable is null"); - return null; - } - if (string.IsNullOrEmpty(entity.Json)) - { - L?.Warning("[Converter] 'ConvertEventEntityToEventModel': EventEntity.Json variable is null or empty"); - return null; - } - - try - { - - CountlyEventModel model = JsonConvert.DeserializeObject(entity.Json); - model.Id = entity.Id; - - return model; - - } - catch (Exception ex) - { - // Handle JSON serialization error - L?.Warning($"[Converter] 'ConvertEventEntityToEventModel': JSON serialization error: {ex.Message}"); - return null; - } - } - - /// - /// Converts a CountlyEventModel object to an EventEntity object. - /// - /// EventEntity object representing the converted data. - public static EventEntity ConvertEventModelToEventEntity(CountlyEventModel model, long id) - { - string json = JsonConvert.SerializeObject(model, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); - model.Id = id; - - return new EventEntity - { - Id = id, - Json = json - }; - } - - /// - /// Converts a SegmentEntity object to a SegmentModel object. - /// - /// SegmentModel object representing the converted data. - public static SegmentModel ConvertSegmentEntityToSegmentModel(SegmentEntity entity) - { - SegmentModel model = JsonConvert.DeserializeObject(entity.Json); - model.Id = entity.Id; - return model; - } - - /// - /// Converts a SegmentModel object to a SegmentEntity object. - /// - /// SegmentEntity object representing the converted data. - public static SegmentEntity ConvertSegmentModelToSegmentEntity(SegmentModel model, long id) - { - string json = JsonConvert.SerializeObject(model, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); - model.Id = id; - - return new SegmentEntity - { - Id = id, - Json = json - }; - } - - /// - /// Converts a RequestEntity object to a CountlyRequestModel object. - /// - /// CountlyRequestModel object representing the converted data. - public static CountlyRequestModel ConvertRequestEntityToRequestModel(RequestEntity entity) - { - CountlyRequestModel model = JsonConvert.DeserializeObject(entity.Json); - model.Id = entity.Id; - return model; - } - - /// - /// Converts a CountlyRequestModel object to a RequestEntity object. - /// - /// RequestEntity object representing the converted data. - public static RequestEntity ConvertRequestModelToRequestEntity(CountlyRequestModel model, long id) - { - string json = JsonConvert.SerializeObject(model, Formatting.Indented, - new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); - model.Id = id; - - return new RequestEntity - { - Id = id, - Json = json - }; - } - - /// - /// Converts a JSON string to a Dictionary of string and object. - /// - /// Dictionary of string and object representing the converted JSON data, or null if the input JSON string is null. - public static Dictionary ConvertJsonToDictionary(string json, CountlyLogHelper L) - { - if (json == null) - { - L?.Warning("[Converter] 'ConvertJsonToDictionary': Provided Json is null"); - return null; - } - - return JsonConvert.DeserializeObject>(json); - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Converter.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Converter.cs.meta deleted file mode 100644 index 31a32a9bf..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/Converter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8aebe53c7fe746c7aa484d09ab8785d9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyLogHelper.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyLogHelper.cs deleted file mode 100644 index 72ba2f02d..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyLogHelper.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Plugins.CountlySDK.Models; - -public class CountlyLogHelper -{ - private const string TAG = "[Countly]"; - private readonly CountlyConfiguration _configuration; - internal CountlyLogHelper(CountlyConfiguration configuration) - { - _configuration = configuration; - } - - internal void Info(string message) - { - if (_configuration.EnableConsoleLogging) - { - UnityEngine.Debug.Log("[Info]" + TAG + message); - } - - } - - internal void Debug(string message) - { - if (_configuration.EnableConsoleLogging) - { - UnityEngine.Debug.Log("[Debug]" + TAG + message); - } - - } - - internal void Verbose(string message) - { - if (_configuration.EnableConsoleLogging) - { - UnityEngine.Debug.Log("[Verbose]" + TAG + message); - } - - } - - internal void Error(string message) - { - if (_configuration.EnableConsoleLogging) - { - UnityEngine.Debug.LogError("[Error]" + TAG + message); - } - } - - internal void Warning(string message) - { - if (_configuration.EnableConsoleLogging) - { - UnityEngine.Debug.LogWarning("[Warning]" + TAG + message); - } - } - -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyLogHelper.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyLogHelper.cs.meta deleted file mode 100644 index c08598998..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyLogHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 02f7513d0313344848c218c05adf5d45 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyMainThreadHandler.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyMainThreadHandler.cs deleted file mode 100644 index 8d62d0233..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyMainThreadHandler.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Threading; -using Plugins.CountlySDK; -using UnityEngine; - -public class CountlyMainThreadHandler : MonoBehaviour -{ - private static CountlyMainThreadHandler _instance; - private Thread mainThread; - private Action _queuedAction; - private readonly object lockObject = new object(); // For thread safety - - public static CountlyMainThreadHandler Instance - { - get - { - if (_instance == null) - { - // If instance is null, add this script to the created Countly object - GameObject gameObject = Countly.Instance.gameObject; - _instance = gameObject.AddComponent(); - } - return _instance; - } - internal set - { - // Allow internal setting of the instance (used during cleanup) - _instance = value; - } - } - - private void Awake() - { - // Record the main thread when the script is first initialized - mainThread = Thread.CurrentThread; - } - - public bool IsMainThread() - { - return Thread.CurrentThread.ManagedThreadId == mainThread.ManagedThreadId; - } - - public void RunOnMainThread(Action action) - { - // Check if we are on the main thread - if (IsMainThread()) - { - // If on the main thread, invoke the action immediately - action.Invoke(); - } - else - { - // If on a different thread, queue the action to be executed on the main thread - lock (lockObject) - { - _queuedAction = action; - } - } - } - - private void Update() - { - // Execute any queued action on the main thread during the Unity Update phase - if (_queuedAction != null) - { - lock (lockObject) - { - _queuedAction.Invoke(); - _queuedAction = null; - } - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyMainThreadHandler.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyMainThreadHandler.cs.meta deleted file mode 100644 index 715f8837e..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyMainThreadHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 65c548d701c912641b9790aa9face003 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyResponse.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyResponse.cs deleted file mode 100755 index 274288e4e..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyResponse.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Plugins.CountlySDK.Helpers -{ - public struct CountlyResponse - { - public int StatusCode { get; set; } - public bool IsSuccess { get; set; } - public string ErrorMessage { get; set; } - public string Data { get; set; } - - public override string ToString() - { - return $"{nameof(StatusCode)}: {StatusCode}, {nameof(IsSuccess)}: {IsSuccess}, {nameof(ErrorMessage)}: {ErrorMessage}, {nameof(Data)}: {Data}"; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyResponse.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyResponse.cs.meta deleted file mode 100755 index 0bd6d60ee..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/CountlyResponse.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a35ea7954d8a0924089d8e3861197947 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/FirstLaunchAppHelper.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/FirstLaunchAppHelper.cs deleted file mode 100644 index ac5666571..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/FirstLaunchAppHelper.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using UnityEngine; - -namespace Plugins.CountlySDK.Helpers -{ - /// - /// Helper class for managing and tracking the first launch of the application. - /// - internal static class FirstLaunchAppHelper - { - private static bool? _firstLaunchApp; - - /// - /// Processes the first launch of the application. - /// - /// - /// This method checks if the application has been launched for the first time. - /// If it is the first launch, it sets the appropriate flag and saves it to PlayerPrefs. - /// - /// - public static void Process() - { - if (!PlayerPrefs.HasKey(Constants.FirstAppLaunch)) - { - PlayerPrefs.SetInt(Constants.FirstAppLaunch, 1); - PlayerPrefs.Save(); - _firstLaunchApp = true; - } - else - { - PlayerPrefs.SetInt(Constants.FirstAppLaunch, 0); - PlayerPrefs.Save(); - _firstLaunchApp = false; - } - } - - /// - /// Gets a value indicating whether this is the first launch of the application. - /// - /// - /// true if this is the first launch of the application; otherwise, false. - /// - public static bool IsFirstLaunchApp - { - get - { - if (!_firstLaunchApp.HasValue) - { - Debug.LogWarning("[FirstLaunchAppHelper] IsFirstLaunchApp : Process should be called when session begins"); - Process(); - } - return _firstLaunchApp.Value; - } - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/FirstLaunchAppHelper.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/FirstLaunchAppHelper.cs.meta deleted file mode 100644 index b70f21641..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/FirstLaunchAppHelper.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 8cdc40a19ec94e87b450dca94c53c531 -timeCreated: 1561647792 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/MetricHelper.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/MetricHelper.cs deleted file mode 100644 index a1c5d1f36..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/MetricHelper.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System.Collections.Generic; -using Newtonsoft.Json; -using UnityEngine; - -namespace Plugins.CountlySDK.Helpers -{ - public class MetricHelper - { - internal Dictionary overridenMetrics; - readonly string unityPlatform; - - public MetricHelper() : this(null) - { - - } - - public MetricHelper(Dictionary overridenMetrics) - { - string platform = Application.platform.ToString().ToLower(); - unityPlatform = (Application.platform == RuntimePlatform.IPhonePlayer) ? "iOS" : platform; - - this.overridenMetrics = overridenMetrics; - } - - public string OS - { - get - { - if (overridenMetrics != null && overridenMetrics.ContainsKey("_os")) - { - return overridenMetrics["_os"]; - } - return unityPlatform; - } - } - - public string OSVersion - { - get - { - if (overridenMetrics != null && overridenMetrics.ContainsKey("_os_version")) - { - return overridenMetrics["_os_version"]; - } - return SystemInfo.operatingSystem; - } - } - - public string Device - { - get - { - if (overridenMetrics != null && overridenMetrics.ContainsKey("_device")) - { - return overridenMetrics["_device"]; - } - return SystemInfo.deviceModel; - } - } - - public string Resolution - { - get - { - if (overridenMetrics != null && overridenMetrics.ContainsKey("_resolution")) - { - return overridenMetrics["_resolution"]; - } - return Screen.currentResolution.ToString(); - } - } - - public string AppVersion - { - get - { - if (overridenMetrics != null && overridenMetrics.ContainsKey("_app_version")) - { - return overridenMetrics["_app_version"]; - } - return Application.version; - } - } - - public string Density - { - get - { - if (overridenMetrics != null && overridenMetrics.ContainsKey("_density")) - { - return overridenMetrics["_density"]; - } - return Screen.dpi.ToString(); - } - } - - public string Locale - { - get - { - if (overridenMetrics != null && overridenMetrics.ContainsKey("_locale")) - { - return overridenMetrics["_locale"]; - } - return Application.systemLanguage.ToString(); - } - } - - /// - /// Generates a JSON representation of device and application metrics, combining default and overridden metrics. - /// - public string buildMetricJSON() - { - Dictionary metrics = new Dictionary - { - { "_os", OS }, - { "_os_version", OSVersion}, - { "_device", Device}, - { "_resolution", Resolution}, - { "_app_version", AppVersion}, - { "_density", Density}, - { "_locale", Locale} - }; - - if (overridenMetrics != null) - { - foreach (KeyValuePair kvp in overridenMetrics) - { - if (!metrics.ContainsKey(kvp.Key)) - { - metrics[kvp.Key] = kvp.Value; - } - } - } - - return JsonConvert.SerializeObject(metrics, Formatting.Indented, - new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); - } - } -} - diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/MetricHelper.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/MetricHelper.cs.meta deleted file mode 100644 index e01dd51f6..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/MetricHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e5ba923b54226f0448a3e813e934425c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestBuilder.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestBuilder.cs deleted file mode 100644 index 0c70bd415..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestBuilder.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using Plugins.CountlySDK; -using Plugins.CountlySDK.Models; -using UnityEngine; - -internal class RequestBuilder -{ - - internal RequestBuilder() - { - } - - /// - /// Builds request by adding Base params into supplied queryParams parameters. - /// The data is appended in the URL. - /// - /// - /// - internal CountlyRequestModel BuildRequest(IDictionary baseParams, IDictionary queryParams) - { - //Metrics added to each request - IDictionary requestData = baseParams; - foreach (KeyValuePair item in queryParams) - { - requestData.Add(item.Key, item.Value); - } - - string data = BuildQueryString(requestData); - CountlyRequestModel requestModel = new CountlyRequestModel(null, data); - - return requestModel; - } - - /// - /// Builds query string using supplied queryParams parameters. - /// - /// - /// - internal string BuildQueryString(IDictionary queryParams) - { - // Dictionary queryParams = JsonConvert.DeserializeObject>(data); - StringBuilder requestStringBuilder = new StringBuilder(); - - //Query params supplied for creating request - foreach (KeyValuePair item in queryParams) - { - if (!string.IsNullOrEmpty(item.Key) && item.Value != null) - { - requestStringBuilder.AppendFormat(requestStringBuilder.Length == 0 ? "{0}={1}" : "&{0}={1}", item.Key, - Convert.ToString(item.Value)); - } - } - - string result = requestStringBuilder.ToString(); - - return Uri.EscapeUriString(result); - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestBuilder.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestBuilder.cs.meta deleted file mode 100644 index cc9e7ea6e..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestBuilder.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 76028af6f7ee06b4c9533efc184cd2e5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestCountlyHelper.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestCountlyHelper.cs deleted file mode 100644 index d6c39bbd9..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestCountlyHelper.cs +++ /dev/null @@ -1,396 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Repositories; -using UnityEngine; -using UnityEngine.Networking; - -namespace Plugins.CountlySDK.Helpers -{ - public class RequestCountlyHelper - { - private bool _isQueueBeingProcess; - private readonly CountlyLogHelper Log; - private readonly CountlyUtils _countlyUtils; - private readonly CountlyConfiguration _config; - private readonly RequestBuilder _requestBuilder; - internal readonly RequestRepository _requestRepo; - private readonly MonoBehaviour _monoBehaviour; - private readonly int countlyRequestRemoveLimit = 100; - - internal RequestCountlyHelper(CountlyConfiguration config, CountlyLogHelper log, CountlyUtils countlyUtils, RequestBuilder requestBuilder, RequestRepository requestRepo, MonoBehaviour monoBehaviour) - { - Log = log; - _config = config; - _requestRepo = requestRepo; - _countlyUtils = countlyUtils; - _requestBuilder = requestBuilder; - _monoBehaviour = monoBehaviour; - } - - /// - /// Adds a Countly request to the queue, ensuring that the queue size does not exceed the maximum limit. - /// If the queue size exceeds the limit, it removes the oldest requests to make space for the new one. - /// - /// The Countly request model to be added to the queue. - internal void AddRequestToQueue(CountlyRequestModel request) - { - Log.Verbose($"[RequestCountlyHelper] AddRequestToQueue, Request: [{request.ToString()}]"); - - if (_config.EnableTestMode) - { - return; - } - - if (_requestRepo.Count >= _config.StoredRequestLimit) - { - // Calculate how many items need to be removed from the queue to accommodate the new request. - int exceedAmount = _requestRepo.Count - _config.StoredRequestLimit; - int removeAmount = Mathf.Min(exceedAmount, countlyRequestRemoveLimit) + 1; - Log.Warning("[RequestCountlyHelper] Request Queue is full. Dropping the oldest request."); - - // Remove the calculated amount of oldest requests from the queue. - while (removeAmount > 0) - { - _requestRepo.Dequeue(); - removeAmount--; - } - } - - _requestRepo.Enqueue(request); - } - - /// - /// An internal method which iterates a queue of requests and sends them for processing. - /// If a request fails, processing stops, and only successful requests are removed from the queue. - /// - internal async Task ProcessQueue() - { - if (_isQueueBeingProcess) - { - Log.Verbose("[RequestCountlyHelper] ProcessQueue, queue is being processed."); - return; - } - - _isQueueBeingProcess = true; - CountlyRequestModel[] requests = null; - - try - { - requests = _requestRepo.Models.ToArray(); - Log.Verbose($"[RequestCountlyHelper] ProcessQueue, request count: [{requests.Length}]"); - } - catch (Exception ex) - { - Log.Warning($"[RequestCountlyHelper] ProcessQueue, exception occurred while converting Models to array. Exception: {ex}"); - _isQueueBeingProcess = false; - return; - } - - // make sure that flag is corrected and exit - if (requests.Length == 0) - { - Log.Verbose("[RequestCountlyHelper] ProcessQueue, Request Queue is empty. Returning."); - _isQueueBeingProcess = false; - return; - } - - foreach (CountlyRequestModel reqModel in requests) - { - // Add the remaining request count in RequestData - reqModel.RequestData += "&rr=" + (requests.Length - 1); - - CountlyResponse response = await ProcessRequest(reqModel); - - if (!response.IsSuccess) - { - Log.Verbose($"[RequestCountlyHelper] ProcessQueue: Request failed. Response: [{response.ToString()}]"); - _isQueueBeingProcess = false; - break; - } - - _requestRepo.Dequeue(); - } - - _isQueueBeingProcess = false; - Log.Verbose("[RequestCountlyHelper] ProcessQueue, _isQueueBeingProcess is false"); - } - - /// - /// Decides whether to use a POST or GET method based on configuration and request size, and then send the request accordingly. - /// - private async Task ProcessRequest(CountlyRequestModel model) - { - Log.Verbose($"[RequestCountlyHelper] Process request, request: [{model}]"); - bool shouldPost = _config.EnablePost || model.RequestData.Length > 2000; - -#if UNITY_WEBGL - // There is not HTTP GET for WebGL. We always do a HTTP POST - Log.Debug($"[RequestCountlyHelper] ProcessRequest, Calling StartProcessRequestRoutine for WebGL"); - return await StartProcessRequestRoutine(_countlyUtils.ServerInputUrl, model.RequestData); -#else - if (shouldPost) { - Log.Debug($"[RequestCountlyHelper] ProcessRequest, Using HTTP POST"); - return await Task.Run(() => PostAsync(_countlyUtils.ServerInputUrl, model.RequestData)); - } - Log.Debug($"[RequestCountlyHelper] ProcessRequest, Using HTTP GET"); - return await Task.Run(() => GetAsync(_countlyUtils.ServerInputUrl, model.RequestData)); -#endif - } - - /// - /// An internal function to add a request to request queue. - /// - internal void AddToRequestQueue(Dictionary queryParams) - { - CountlyRequestModel requestModel = _requestBuilder.BuildRequest(_countlyUtils.GetBaseParams(), queryParams); - - AddRequestToQueue(requestModel); - } - - private string AddChecksum(string query) - { - if (!string.IsNullOrEmpty(_config.Salt)) - { - // Create a SHA256 - using (SHA256 sha256Hash = SHA256.Create()) - { - byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(query + _config.Salt)); - string hex = _countlyUtils.GetStringFromBytes(bytes); - - query += "&checksum256=" + hex; - Log.Debug($"[RequestCountlyHelper] AddChecksum, Checksum added query = [{query}]"); - } - } - - return query; - } - - /// - /// Makes an Asynchronous GET request to the Countly server. - /// - /// - /// - /// - internal async Task GetAsync(string uri, string data) - { - Log.Verbose($"[RequestCountlyHelper] GetAsync, calling with request: [{uri}], params: [{data}]"); - - CountlyResponse countlyResponse = new CountlyResponse(); - string query = AddChecksum(data); - string url = uri + query; - - try - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync()) - { - int code = (int)response.StatusCode; - using (Stream stream = response.GetResponseStream()) - using (StreamReader reader = new StreamReader(stream)) - { - string res = await reader.ReadToEndAsync(); - - countlyResponse.Data = res; - countlyResponse.StatusCode = code; - countlyResponse.IsSuccess = IsSuccess(countlyResponse); - } - } - } - catch (WebException ex) - { - countlyResponse.ErrorMessage = ex.Message; - if (ex.Response != null) - { - HttpWebResponse response = (HttpWebResponse)ex.Response; - int code = (int)response.StatusCode; - using (Stream stream = ex.Response.GetResponseStream()) - using (StreamReader reader = new StreamReader(stream)) - { - string res = await reader.ReadToEndAsync(); - countlyResponse.StatusCode = code; - countlyResponse.Data = res; - countlyResponse.IsSuccess = IsSuccess(countlyResponse); - } - } - } - - Log.Verbose($"[RequestCountlyHelper] GetAsync, Request URL: [{url}], Params: [{query}], Response: [{countlyResponse.ToString()}]"); - return countlyResponse; - } - - /// - /// Makes an Asynchronous POST request to the Countly server. - /// - /// - /// - /// - internal async Task PostAsync(string uri, string data) - { - CountlyResponse countlyResponse = new CountlyResponse(); - - try - { - string query = AddChecksum(data); - byte[] dataBytes = Encoding.ASCII.GetBytes(query); - - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); - request.ContentLength = dataBytes.Length; - request.ContentType = "application/x-www-form-urlencoded"; - request.Method = "POST"; - - using (Stream requestBody = request.GetRequestStream()) - { - await requestBody.WriteAsync(dataBytes, 0, dataBytes.Length); - } - - using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync()) - { - int code = (int)response.StatusCode; - using (Stream stream = response.GetResponseStream()) - using (StreamReader reader = new StreamReader(stream)) - { - string res = await reader.ReadToEndAsync(); - - countlyResponse.Data = res; - countlyResponse.StatusCode = code; - countlyResponse.IsSuccess = IsSuccess(countlyResponse); - } - } - } - catch (WebException ex) - { - countlyResponse.ErrorMessage = ex.Message; - if (ex.Response != null) - { - HttpWebResponse response = (HttpWebResponse)ex.Response; - int code = (int)response.StatusCode; - using (Stream stream = ex.Response.GetResponseStream()) - using (StreamReader reader = new StreamReader(stream)) - { - string res = await reader.ReadToEndAsync(); - countlyResponse.StatusCode = code; - countlyResponse.Data = res; - countlyResponse.IsSuccess = IsSuccess(countlyResponse); - } - } - } - - Log.Verbose($"[RequestCountlyHelper] PostAsync, Request URL: [{uri}], Body: [{data}], Response: [{countlyResponse.ToString()}]"); - return countlyResponse; - } - - /// - /// Asynchronously initiates a request routine, combining URL and data, and starts a coroutine to process the request with checksum validation. - /// - /// - /// - /// - private Task StartProcessRequestRoutine(string uri, string data) - { - Log.Debug($"[RequestCountlyHelper] StartProcessRequestRoutine, Start"); - TaskCompletionSource tcs = new TaskCompletionSource(); - - try - { - // 'IsObjectMonoBehaviour can only be called from the main thread' - // That's why we have to move it to main thread. - CountlyMainThreadHandler.Instance.RunOnMainThread(() => - { - try - { - _monoBehaviour.StartCoroutine(ProcessRequestCoroutine(uri, data, (response) => - { - tcs.SetResult(response); - })); - } - catch (Exception ex) - { - Log.Error($"[RequestCountlyHelper] StartProcessRequestRoutine, Exception occurred while starting coroutine. Exception: [{ex}]"); - tcs.SetException(ex); - } - }); - } - catch (Exception ex) - { - Log.Error($"[RequestCountlyHelper] StartProcessRequestRoutine, Exception occurred while queueing to main thread. Exception: [{ex}]"); - tcs.SetException(ex); - } - - return tcs.Task; - } - - /// - /// Processes a UnityWebRequest coroutine, handling response and errors, and invoking a callback with the CountlyResponse. - /// - /// - /// - /// - /// - private IEnumerator ProcessRequestCoroutine(string uri, string data, Action callback) - { - Log.Debug($"[RequestCountlyHelper] ProcessRequestCoroutine, Start"); - CountlyResponse countlyResponse = new CountlyResponse(); - - string query = AddChecksum(data); - string url = uri + query; - - using (UnityWebRequest webRequest = UnityWebRequest.Put(url, data)) - { - webRequest.method = UnityWebRequest.kHttpVerbPOST; - yield return webRequest.SendWebRequest(); - string[] pages = url.Split('?'); - int page = pages.Length - 1; - int code = (int)webRequest.responseCode; - - countlyResponse.Data = webRequest.downloadHandler.text; - countlyResponse.ErrorMessage = webRequest.error; - countlyResponse.StatusCode = code; - countlyResponse.IsSuccess = IsSuccess(countlyResponse); - Log.Debug($"[RequestCountlyHelper] ProcessRequestCoroutine, Request URL: [{uri}], Body: [{pages[page]}], Response: [{countlyResponse}]"); - } - Log.Debug($"[RequestCountlyHelper] ProcessRequestCoroutine, Process completed invoking callback."); - callback?.Invoke(countlyResponse); - } - - /// - /// Determines if a CountlyResponse indicates a successful request based on the HTTP status code and the presence of a "result" key in the JSON response data. - /// - /// The CountlyResponse object to evaluate. - /// True if the status code is between 200 and 299 and the response data contains a "result" key; otherwise, false. - private bool IsSuccess(CountlyResponse countlyResponse) - { - if (countlyResponse.StatusCode >= 200 && countlyResponse.StatusCode < 300) - { - try - { - JObject json = JObject.Parse(countlyResponse.Data); - - if (json.ContainsKey("result")) - { - return true; - } - } - catch (JsonException ex) - { - Log.Debug($"[RequestCountlyHelper] IsSuccess : Returned request is not a JSON object. Exception: [{ex}]"); - return false; - } - } - else - { - Log.Debug($"[RequestCountlyHelper] IsSuccess, Status Code: [{countlyResponse.StatusCode}] is not in between 200-299. Returning false."); - } - return false; - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestCountlyHelper.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestCountlyHelper.cs.meta deleted file mode 100644 index 092fbfe25..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/RequestCountlyHelper.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 10068d8aa2d74079b7015ede45faa9ab -timeCreated: 1558169636 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/SafeIDGenerator.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/SafeIDGenerator.cs deleted file mode 100644 index b95193b1f..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/SafeIDGenerator.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace Plugins.CountlySDK -{ - public interface ISafeIDGenerator - { - string GenerateValue(); - } - - public class SafeIDGenerator : ISafeIDGenerator - { - public string GenerateValue() - { - return CountlyUtils.SafeRandomVal(); - } - } -} - diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/SafeIDGenerator.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/SafeIDGenerator.cs.meta deleted file mode 100644 index b7a5e1057..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/SafeIDGenerator.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c96f6a909dd164ddfa160749dcc2a7d5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/StorageAndMigrationHelper.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/StorageAndMigrationHelper.cs deleted file mode 100644 index 68acdb227..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/StorageAndMigrationHelper.cs +++ /dev/null @@ -1,269 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Data; -using System.Linq; -using iBoxDB.LocalServer; -using Newtonsoft.Json; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Dao; -using Plugins.CountlySDK.Persistance.Entities; -using Plugins.CountlySDK.Persistance.Repositories; -using Plugins.CountlySDK.Persistance.Repositories.Impls; -using Plugins.iBoxDB; -using UnityEngine; -using System.Web; -using System.Text; -using UnityEngine.Networking; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Persistance; - -namespace Plugins.CountlySDK.Helpers -{ - public enum EntityType - { - ViewEvents, NonViewEvents, Requests, ViewEventSegments, NonViewEventSegments, Configs, EventNumberInSameSessions - } - - internal class StorageAndMigrationHelper - { - private DB _db; - internal int CurrentVersion = 0; - private const long _dbNumber = 3; - internal readonly int SchemaVersion = 3; - public const string key_from_2_to_3_custom_id_set = "2_3_custom_id_set"; - - private CountlyLogHelper _logHelper; - private readonly RequestBuilder _requestBuilder; - internal SegmentDao EventSegmentDao { get; private set; } - - internal Dao ConfigDao { get; private set; } - internal Dao RequestDao { get; private set; } - internal Dao EventDao { get; private set; } - internal Dao EventNrInSameSessionDao { get; private set; } - - internal RequestRepository RequestRepo { get; private set; } - internal NonViewEventRepository EventRepo { get; private set; } - internal ViewEventRepository ViewRepo { get; private set; } - - internal StorageAndMigrationHelper(CountlyLogHelper logHelper, RequestBuilder requestBuilder) - { - _logHelper = logHelper; - _requestBuilder = requestBuilder; - - if (FirstLaunchAppHelper.IsFirstLaunchApp) - { - CurrentVersion = SchemaVersion; - PlayerPrefs.SetInt(Constants.SchemaVersion, SchemaVersion); - } - else - { - CurrentVersion = PlayerPrefs.GetInt(Constants.SchemaVersion, 0); - } - } - - /// - /// Create database and tables - /// - private DB BuildDatabase(long dbNumber) - { - DB.Root(Application.persistentDataPath); - DB db = new DB(dbNumber); - - db.GetConfig().EnsureTable(EntityType.Configs.ToString(), "Id"); - db.GetConfig().EnsureTable(EntityType.Requests.ToString(), "Id"); - db.GetConfig().EnsureTable(EntityType.NonViewEvents.ToString(), "Id"); - db.GetConfig().EnsureTable(EntityType.NonViewEventSegments.ToString(), "Id"); - - if (CurrentVersion < 1) - { - db.GetConfig().EnsureTable(EntityType.ViewEvents.ToString(), "Id"); - db.GetConfig().EnsureTable(EntityType.ViewEventSegments.ToString(), "Id"); - db.GetConfig().EnsureTable(EntityType.EventNumberInSameSessions.ToString(), "Id"); - } - - return db; - } - - /// - /// Open database connection and initialize data access objects. - /// - internal void OpenDB() - { - _logHelper.Debug("[CountlyStorageHelper] OpenDB"); - - _db = BuildDatabase(_dbNumber); - DB.AutoBox auto = _db.Open(); - - _logHelper.Debug("[CountlyStorageHelper] OpenDB path: " + Application.persistentDataPath + "/db3.box"); - - EventSegmentDao = new SegmentDao(auto, EntityType.NonViewEventSegments.ToString(), _logHelper); - - ConfigDao = new Dao(auto, EntityType.Configs.ToString(), _logHelper); - RequestDao = new Dao(auto, EntityType.Requests.ToString(), _logHelper); - EventDao = new Dao(auto, EntityType.NonViewEvents.ToString(), _logHelper); - - if (CurrentVersion < 1) - { - EventNrInSameSessionDao = new Dao(auto, EntityType.EventNumberInSameSessions.ToString(), _logHelper); - - Dao viewDao = new Dao(auto, EntityType.ViewEvents.ToString(), _logHelper); - SegmentDao viewSegmentDao = new SegmentDao(auto, EntityType.ViewEventSegments.ToString(), _logHelper); - - ViewRepo = new ViewEventRepository(viewDao, viewSegmentDao, _logHelper); - ViewRepo.Initialize(); - } - - RequestRepo = new RequestRepository(RequestDao, _logHelper); - EventRepo = new NonViewEventRepository(EventDao, EventSegmentDao, _logHelper); - - EventRepo.Initialize(); - RequestRepo.Initialize(); - - } - - /// - /// Close database connection. - /// - internal void CloseDB() - { - _logHelper.Debug("[CountlyStorageHelper] CloseDB"); - - _db.Close(); - } - - /// - /// Migrate database schema. - /// - internal void RunMigration(IDictionary migrationParams) - { - _logHelper.Verbose("[CountlyStorageHelper] RunMigration : currentVersion = " + CurrentVersion); - - /* - * Schema Version = 1 : - * - Deletion of the data in the “EventNumberInSameSessionEntity” table - * - Copy data of 'Views Repository(Entity Dao, Segment Dao)' into Event Repository(Entity Dao, Segment Dao)'. - */ - if (CurrentVersion == 0) - { - Migration_EventNumberInSameSessionEntityDataRemoval(); - Migration_CopyViewDataIntoEventData(); - - CurrentVersion = 1; - PlayerPrefs.SetInt(Constants.SchemaVersion, CurrentVersion); - } - - if (CurrentVersion == 1) - { - Migration_MigrateOldRequests(); - CurrentVersion = 2; - PlayerPrefs.SetInt(Constants.SchemaVersion, CurrentVersion); - } - - if (CurrentVersion == 2) - { - bool customIdProvided = (bool)migrationParams[key_from_2_to_3_custom_id_set]; - Migration_GuessTheDeviceIDType(customIdProvided); - CurrentVersion = 3; - PlayerPrefs.SetInt(Constants.SchemaVersion, CurrentVersion); - } - } - - /// - /// Helper for migration from version 0 to version 1. - /// Deletion Of data in the 'EventNumberInSameSessionEntity' table. - /// - private void Migration_EventNumberInSameSessionEntityDataRemoval() - { - EventNrInSameSessionDao.RemoveAll(); - _logHelper.Verbose("[CountlyStorageHelper] Migration_EventNumberInSameSessionEntityDataRemoval"); - } - - /// - /// Helper for migration from version 0 to version 1. - /// Copy data of 'Views Repository(Entity Dao, Segment Dao)' into Event Repository(Entity Dao, Segment Dao)'. - /// - private void Migration_CopyViewDataIntoEventData() - { - while (ViewRepo.Count > 0) - { - EventRepo.Enqueue(ViewRepo.Dequeue()); - } - _logHelper.Verbose("[CountlyStorageHelper] Migration_CopyViewDataIntoEventData"); - - } - - /// - /// Helper for migration from version 1 to version 2. - /// Go through all requests and remove the checksum param set there. - /// Checksum would now be computed just before sending the request - /// - private void Migration_MigrateOldRequests() - { - //get all stored requests - CountlyRequestModel[] requestModels = RequestRepo.Models.ToArray(); - foreach (CountlyRequestModel request in requestModels) - { - //go through all of them - if (request.RequestData == null) - { - // if we have no request data then that means that all of the info is in the request URL - // start by parsing all the params from the URL. - // remove the checksum and then write the request back as a string - int index = request.RequestUrl.IndexOf('?'); - string uri = request.RequestUrl.Substring(index); - NameValueCollection collection = HttpUtility.ParseQueryString(uri); - - Dictionary queryParams = collection.AllKeys.ToDictionary(t => t, t => (object)collection[t]); - queryParams.Remove("checksum256"); - string data = _requestBuilder.BuildQueryString(queryParams); - - request.RequestUrl = null; - request.RequestData = data; - } - else - { - // if we don't have request data then that means that all of the request params are in the request data field - // deserialize the values, remove the checksum and then combine them all into a single array which should then be the replacement - Dictionary requestData = JsonConvert.DeserializeObject>(request.RequestData); - requestData.Remove("checksum256"); - - request.RequestUrl = null; - request.RequestData = _requestBuilder.BuildQueryString(requestData); - } - - bool result = RequestRepo.Update(request); - if (!result) - { - _logHelper.Warning("[CountlyStorageHelper] Migration_MigrateOldRequests: updating the request failed"); - //we failed to update the old request, - - RequestRepo.DeleteEntry(request); - } - } - _logHelper.Verbose("[CountlyStorageHelper] Migration_MigrateOldRequests"); - - //refresh internal memory represensation for future migrations - RequestRepo.RefreshMemoryCache(); - } - - private void Migration_GuessTheDeviceIDType(bool customIdProvided) - { - if (customIdProvided) - { - PlayerPrefs.SetInt(Constants.DeviceIDTypeKey, (int)DeviceIdType.DeveloperProvided); - } - else - { - PlayerPrefs.SetInt(Constants.DeviceIDTypeKey, (int)DeviceIdType.SDKGenerated); - } - } - - internal void ClearDBData() - { - EventRepo.Clear(); - RequestRepo.Clear(); - ConfigDao.RemoveAll(); - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/StorageAndMigrationHelper.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/StorageAndMigrationHelper.cs.meta deleted file mode 100644 index 36332df1b..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Helpers/StorageAndMigrationHelper.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 15f82e900ca34febb540457a1680e2c3 -timeCreated: 1558447278 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyAuthModel.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyAuthModel.cs deleted file mode 100644 index 0370c57a7..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyAuthModel.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Plugins.CountlySDK.Models -{ - [Serializable] - public class CountlyAuthModel - { - public string ServerUrl; - public string AppKey; - public string DeviceId; - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyAuthModel.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyAuthModel.cs.meta deleted file mode 100644 index c1a72f6f9..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyAuthModel.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d0f40ff388c54f758ada9d29b6dce774 -timeCreated: 1558361965 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfigModel.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfigModel.cs deleted file mode 100644 index 0c8d12469..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfigModel.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; - -namespace Plugins.CountlySDK.Models -{ - [Serializable] - public class CountlyConfigModel - { - public string Salt; - public bool EnablePost; - public bool EnableTestMode; - public bool EnableConsoleLogging; - public TestMode NotificationMode; - public readonly bool EnableManualSessionHandling; - public int SessionDuration; - public int EventQueueThreshold; - public int StoredRequestLimit; - public int TotalBreadcrumbsAllowed; - public bool EnableAutomaticCrashReporting; - - /// - /// Initializes the SDK configurations - /// - /// - /// - /// - /// - /// - /// Session is updated after each interval passed. - /// This interval is also used to process request queue. The interval must be in seconds - /// - public CountlyConfigModel(string salt = null, bool enablePost = false, bool enableTestMode = false, bool enableConsoleErrorLogging = false, - bool ignoreSessionCooldown = false, bool enableManualSessionHandling = false, - int sessionDuration = 60, int eventQueueThreshold = 100, - int storedRequestLimit = 1000, int totalBreadcrumbsAllowed = 100, - TestMode notificationMode = TestMode.None, bool enableAutomaticCrashReporting = true) - - { - this.Salt = salt; - EnablePost = enablePost; - EnableTestMode = enableTestMode; - EnableConsoleLogging = enableConsoleErrorLogging; - NotificationMode = notificationMode; - SessionDuration = sessionDuration; - //EnableManualSessionHandling = enableManualSessionHandling; - EnableManualSessionHandling = false; - EventQueueThreshold = eventQueueThreshold; - StoredRequestLimit = storedRequestLimit; - TotalBreadcrumbsAllowed = totalBreadcrumbsAllowed; - EnableAutomaticCrashReporting = enableAutomaticCrashReporting; - } - - public override string ToString() - { - return $"{nameof(Salt)}: {Salt}, {nameof(EnablePost)}: {EnablePost}, {nameof(EnableConsoleLogging)}: {EnableConsoleLogging}, {nameof(NotificationMode)}: {NotificationMode}, {nameof(EnableManualSessionHandling)}: {EnableManualSessionHandling}, {nameof(SessionDuration)}: {SessionDuration}, {nameof(EventQueueThreshold)}: {EventQueueThreshold}, {nameof(StoredRequestLimit)}: {StoredRequestLimit}, {nameof(TotalBreadcrumbsAllowed)}: {TotalBreadcrumbsAllowed}, {nameof(EnableAutomaticCrashReporting)}: {EnableAutomaticCrashReporting}"; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfigModel.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfigModel.cs.meta deleted file mode 100755 index 88883b7fb..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfigModel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fb910fd4fc64f234da4ed69935f44829 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfiguration.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfiguration.cs deleted file mode 100644 index ac5acc129..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfiguration.cs +++ /dev/null @@ -1,461 +0,0 @@ -using System; -using System.Collections.Generic; -using JetBrains.Annotations; -using Notifications; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Services; -using UnityEngine; - -namespace Plugins.CountlySDK.Models -{ - [Serializable] - public class CountlyConfiguration - { - /// - /// URL of the Countly server to submit data to. - /// Mandatory field. - /// - [Obsolete("ServerUrl is deprecated. Use CountlyConfiguration(string appKey, string serverUrl) instead.")] - public string ServerUrl = null; - - /// - /// App key for the application being tracked. - /// Mandatory field. - /// - [Obsolete("AppKey is deprecated. Use CountlyConfiguration(string appKey, string serverUrl) instead.")] - public string AppKey = null; - - /// - /// Unique ID for the device the app is running on. - /// - [Obsolete("DeviceId is deprecated. Use SetDeviceId(string deviceId) instead.")] - public string DeviceId = null; - - /// - /// Set to prevent parameter tampering. - /// - [Obsolete("Salt is deprecated. Use SetParameterTamperingProtectionSalt(string salt) instead.")] - public string Salt = null; - - /// - /// Set to send all requests made to the Countly server using HTTP POST. - /// - [Obsolete("EnablePost is deprecated. Use EnableForcedHttpPost() instead.")] - public bool EnablePost = false; - - /// - /// Set to true if you want the SDK to pretend that it's functioning. - /// - [Obsolete("EnableTestMode is deprecated. This is going to be removed in the future.")] - public bool EnableTestMode = false; - - /// - /// Set to true if you want to enable countly internal debugging logs. - /// - [Obsolete("EnableConsoleLogging is deprecated. Use EnableLogging() instead.")] - public bool EnableConsoleLogging = false; - - /// - /// Set mode of push notification. - /// - [Obsolete("NotificationMode is deprecated. Use SetNotificationMode(TestMode mode) instead.")] - public TestMode NotificationMode = TestMode.None; - - /// - /// Set to true to enable manual session handling. - /// - [Obsolete("EnableManualSessionHandling is deprecated. This is going to be removed in the future.")] - public readonly bool EnableManualSessionHandling = false; - - /// - /// Sets the interval for the automatic update calls - /// min value 1 (1 second), max value 600 (10 minutes) - /// - [Obsolete("SessionDuration is deprecated. Use SetUpdateSessionTimerDelay(int duration) instead.")] - public int SessionDuration = 60; - - /// - /// Maximum size of all string keys - /// - [Obsolete("MaxKeyLength is deprecated. Use SetMaxKeyLength(int length) instead.")] - public int MaxKeyLength = 128; - - /// - /// Maximum size of all values in our key-value pairs - /// - [Obsolete("MaxValueSize is deprecated. Use SetMaxValueSize(int size) instead.")] - public int MaxValueSize = 256; - - /// - /// Max amount of custom (dev provided) segmentation in one event - /// - [Obsolete("MaxSegmentationValues is deprecated. Use SetMaxSegmentationValues(int values) instead.")] - public int MaxSegmentationValues = 100; - - /// - /// Limits how many stack trace lines would be recorded per thread - /// - [Obsolete("MaxStackTraceLinesPerThread is deprecated. Use SetMaxStackTraceLinesPerThread(int lines) instead.")] - public int MaxStackTraceLinesPerThread = 30; - - /// - /// Limits how many characters are allowed per stack trace line - /// - [Obsolete("MaxStackTraceLineLength is deprecated. Use SetMaxStackTraceLineLength(int length) instead.")] - public int MaxStackTraceLineLength = 200; - - /// - /// Set threshold value for the number of events that can be stored locally. - /// - [Obsolete("EventQueueThreshold is deprecated. Use SetEventQueueSizeToSend(int threshold) instead.")] - public int EventQueueThreshold = 100; - - /// - /// Set limit for the number of requests that can be stored locally. - /// - [Obsolete("StoredRequestLimit is deprecated. Use SetMaxRequestQueueSize(int limit) instead.")] - public int StoredRequestLimit = 1000; - - /// - /// Set the maximum amount of breadcrumbs. - /// - [Obsolete("TotalBreadcrumbsAllowed is deprecated. Use SetMaxBreadcrumbCount(int amount) instead.")] - public int TotalBreadcrumbsAllowed = 100; - - /// - /// Set true to enable uncaught crash reporting. - /// - [Obsolete("EnableAutomaticCrashReporting is deprecated. Use DisableAutomaticCrashReporting() instead.")] - public bool EnableAutomaticCrashReporting = true; - - /// - /// Set if consent should be required. - /// - [Obsolete("RequiresConsent is deprecated. Use SetRequiresConsent(bool enable) instead.")] - public bool RequiresConsent = false; - - internal SafeIDGenerator SafeViewIDGenerator = null; - internal SafeIDGenerator SafeEventIDGenerator = null; - - internal string City = null; - internal string Location = null; - internal string IPAddress = null; - internal string CountryCode = null; - internal bool IsLocationDisabled = false; - internal bool IsAutomaticSessionTrackingDisabled = false; - - internal Consents[] GivenConsent { get; private set; } - internal string[] EnabledConsentGroups { get; private set; } - internal List NotificationEventListeners; - internal Dictionary ConsentGroups { get; private set; } - internal Dictionary overridenMetrics; - internal MetricHelper metricHelper; - - /// - /// Parent must be undestroyable - /// - public GameObject Parent = null; - - [Obsolete("CountlyConfiguration() is deprecated, this is going to be removed in the future. Use CountlyConfiguration(string appKey, string serverUrl) instead.")] - public CountlyConfiguration() - { - ConsentGroups = new Dictionary(); - NotificationEventListeners = new List(); - } - - public CountlyConfiguration(string appKey, string serverUrl) - { - AppKey = appKey; - ServerUrl = serverUrl; - - ConsentGroups = new Dictionary(); - NotificationEventListeners = new List(); - } - - internal CountlyConfiguration(CountlyAuthModel authModel, CountlyConfigModel config) - { - ConsentGroups = new Dictionary(); - ServerUrl = authModel.ServerUrl; - AppKey = authModel.AppKey; - DeviceId = authModel.DeviceId; - - Salt = config.Salt; - EnablePost = config.EnablePost; - EnableManualSessionHandling = config.EnableManualSessionHandling; - EnableTestMode = config.EnableTestMode; - EnableConsoleLogging = config.EnableConsoleLogging; - NotificationMode = config.NotificationMode; - SessionDuration = config.SessionDuration; - EventQueueThreshold = config.EventQueueThreshold; - StoredRequestLimit = config.StoredRequestLimit; - TotalBreadcrumbsAllowed = config.TotalBreadcrumbsAllowed; - EnableAutomaticCrashReporting = config.EnableAutomaticCrashReporting; - NotificationEventListeners = new List(); - } - - public override string ToString() - { - return $"{nameof(ServerUrl)}: {ServerUrl}, {nameof(AppKey)}: {AppKey}, {nameof(DeviceId)}: {DeviceId}, {nameof(EnableTestMode)}: {EnableTestMode}, {nameof(EnableConsoleLogging)}: {EnableConsoleLogging}, {nameof(EventQueueThreshold)}: {EventQueueThreshold}, {nameof(StoredRequestLimit)}: {StoredRequestLimit}"; - } - - /// - /// Disabled the automatic session tracking. - /// - public void DisableAutomaticSessionTracking() - { - IsAutomaticSessionTrackingDisabled = true; - } - - /// - /// Disabled the location tracking on the Countly server - /// - public void DisableLocation() - { - IsLocationDisabled = true; - } - - /// - /// Give consent to features in case consent is required. - /// - /// array of consent for which consent should be given - public void GiveConsent([NotNull] Consents[] consents) - { - GivenConsent = consents; - } - - /// - /// Group multiple consents into a consent group - /// - /// name of the consent group that will be created - /// array of consent to be added to the consent group - /// - public void CreateConsentGroup([NotNull] string groupName, [NotNull] Consents[] consents) - { - ConsentGroups[groupName] = consents; - } - - /// - /// Give consent to the provided consent groups - /// - /// array of consent group for which consent should be given - /// - public void GiveConsentToGroup([NotNull] string[] groupName) - { - EnabledConsentGroups = groupName; - } - - /// - /// Add Notification listener. - /// - /// - public void AddNotificationListener(INotificationListener listener) - { - NotificationEventListeners.Add(listener); - } - - #region Setters - /// - /// Set metric overrides. - /// - public void SetMetricOverride(Dictionary overridenMetrics) - { - this.overridenMetrics = overridenMetrics; - } - - /// - /// Set location parameters that will be used during init. - /// - /// ISO Country code for the user's country - /// Name of the user's city - /// comma separate lat and lng values."56.42345,123.45325" - /// user's IP Address - /// - public CountlyConfiguration SetLocation(string countryCode, string city, string gpsCoordinates, string ipAddress) - { - City = city; - IPAddress = ipAddress; - CountryCode = countryCode; - Location = gpsCoordinates; - - return this; - } - - /// - /// Set unique ID for the device the app is running on. - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetDeviceId(string deviceId) - { - DeviceId = deviceId; - - return this; - } - - /// - /// Set to prevent parameter tampering. - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetParameterTamperingProtectionSalt(string salt) - { - Salt = salt; - - return this; - } - - /// - /// Enables to send all requests made to the Countly server using HTTP POST. - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration EnableForcedHttpPost() - { - EnablePost = true; - - return this; - } - - /// - /// Enables Countly internal debugging logs. - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration EnableLogging() - { - EnableConsoleLogging = true; - - return this; - } - - /// - /// Set mode of push notification. - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetNotificationMode(TestMode mode) - { - NotificationMode = mode; - - return this; - } - - /// - /// Sets the interval for the automatic update calls. Min value 1 (1 second) - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetUpdateSessionTimerDelay(int duration) - { - SessionDuration = duration; - - return this; - } - - /// - /// Set maximum size of all string keys - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetMaxKeyLength(int length) - { - MaxKeyLength = length; - - return this; - } - - /// - /// Set maximum size of all values in our key-value pairs - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetMaxValueSize(int size) - { - MaxValueSize = size; - - return this; - } - - /// - /// Set max amount of custom (dev provided) segmentation in one event - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetMaxSegmentationValues(int values) - { - MaxSegmentationValues = values; - - return this; - } - - /// - /// Set the limit of how many stack trace lines would be recorded per thread - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetMaxStackTraceLinesPerThread(int lines) - { - MaxStackTraceLinesPerThread = lines; - - return this; - } - - /// - /// Set the limit of how many characters are allowed per stack trace line - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetMaxStackTraceLineLength(int length) - { - MaxStackTraceLineLength = length; - - return this; - } - - /// - /// Set threshold value for the number of events that can be stored locally. - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetEventQueueSizeToSend(int threshold) - { - EventQueueThreshold = threshold; - - return this; - } - - /// - /// Set limit for the number of requests that can be stored locally. - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetMaxRequestQueueSize(int limit) - { - StoredRequestLimit = limit; - - return this; - } - - /// - /// Set the maximum amount of breadcrumbs. - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetMaxBreadcrumbCount(int amount) - { - TotalBreadcrumbsAllowed = amount; - - return this; - } - - /// - /// Disables uncaught crash reporting. - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration DisableAutomaticCrashReporting() - { - EnableAutomaticCrashReporting = false; - - return this; - } - - /// - /// Enables requirement of the consent. - /// - /// Modified instance of the CountlyConfiguration - public CountlyConfiguration SetRequiresConsent(bool enable) - { - RequiresConsent = enable; - - return this; - } - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfiguration.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfiguration.cs.meta deleted file mode 100644 index 3598c4461..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyConfiguration.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e9ef1b74c00ad4028808f7609052280c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyEventModel.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyEventModel.cs deleted file mode 100644 index bd74818cb..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyEventModel.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using Newtonsoft.Json; -using Plugins.CountlySDK.Persistance; - -namespace Plugins.CountlySDK.Models -{ - [Serializable] - public class CountlyEventModel : IModel - { - /// - /// Initializes a new instance of event model. - /// - /// - /// - /// - /// - /// - public CountlyEventModel(string key, IDictionary segmentation = null, int? count = 1, double? sum = null, double? duration = null) - { - Key = key; - Count = count ?? 1; - if (segmentation != null) - { - Segmentation = new SegmentModel(segmentation); - } - Duration = duration; - Sum = sum; - - TimeMetricModel timeModel = TimeMetricModel.GetTimeZoneInfoForRequest(); - - Hour = timeModel.Hour; - DayOfWeek = timeModel.DayOfWeek; - Timestamp = timeModel.Timestamp; - } - - public CountlyEventModel() - { - } - - [JsonIgnore] - public long Id { get; set; } - - [JsonProperty("key")] public string Key { get; set; } - - [JsonProperty("count")] public int? Count { get; set; } - - [JsonProperty("sum")] public double? Sum { get; set; } - - [JsonProperty("dur")] public double? Duration { get; set; } - - [JsonProperty("segmentation")] public SegmentModel Segmentation { get; set; } - - [JsonProperty("timestamp")] public long Timestamp { get; set; } - - [JsonProperty("hour")] public int Hour { get; set; } - - [JsonProperty("dow")] public int DayOfWeek { get; set; } - - #region Reserved Event Names - - [JsonIgnore] public const string NPSEvent = "[CLY]_nps"; - - [JsonIgnore] public const string ViewEvent = "[CLY]_view"; - - [JsonIgnore] public const string SurveyEvent = "[CLY]_survey"; - - [JsonIgnore] public const string ViewActionEvent = "[CLY]_action"; - - [JsonIgnore] public const string StarRatingEvent = "[CLY]_star_rating"; - - [JsonIgnore] public const string PushActionEvent = "[CLY]_push_action"; - - [JsonIgnore] public const string OrientationEvent = "[CLY]_orientation"; - - - - #endregion - - - public override string ToString() - { - return $"{nameof(Id)}: {Id}, {nameof(Key)}: {Key}, {nameof(Count)}: {Count}, {nameof(Sum)}: {Sum}, {nameof(Duration)}: {Duration}, {nameof(Segmentation)}: {Segmentation}, {nameof(Timestamp)}: {Timestamp}, {nameof(Hour)}: {Hour}, {nameof(DayOfWeek)}: {DayOfWeek},"; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyEventModel.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyEventModel.cs.meta deleted file mode 100755 index 905b2aade..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyEventModel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 767d8c9a84f0dfb40971165a212e5de7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyExceptionDetailModel.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyExceptionDetailModel.cs deleted file mode 100644 index 57762477c..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyExceptionDetailModel.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using Newtonsoft.Json; -using Plugins.CountlySDK.Helpers; -using UnityEngine; - -namespace Plugins.CountlySDK.Models -{ - [Serializable] - internal class CountlyExceptionDetailModel - { - //device metrics - [JsonProperty("_os")] - public string OS { get; set; } - [JsonProperty("_os_version")] - public string OSVersion { get; set; } - [JsonProperty("_manufacture")] - public string Manufacture { get; set; } - - [JsonProperty("_device")] - public string Device { get; set; } - [JsonProperty("_resolution")] - public string Resolution { get; set; } - [JsonProperty("_app_version")] - public string AppVersion { get; set; } - [JsonProperty("_cpu")] - public string Cpu { get; set; } - [JsonProperty("_opengl")] - public string Opengl { get; set; } - - //state of device - [JsonProperty("_ram_current")] - public string RamCurrent { get; set; } - [JsonProperty("_ram_total")] - public string RamTotal { get; set; } - [JsonProperty("_disk_current")] - public string DiskCurrent { get; set; } - [JsonProperty("_disk_total")] - public string DiskTotal { get; set; } - [JsonProperty("_bat")] - public string Battery { get; set; } - [JsonProperty("_orientation")] - public string Orientation { get; set; } - - [JsonProperty("_root")] - public string Root { get; set; } - [JsonProperty("_online")] - public string Online { get; set; } - [JsonProperty("_muted")] - public string Muted { get; set; } - [JsonProperty("_background")] - public string Background { get; set; } - [JsonProperty("_name")] - public string Name { get; set; } - [JsonProperty("_error")] - public string Error { get; set; } - [JsonProperty("_nonfatal")] - public bool Nonfatal { get; set; } - [JsonProperty("_logs")] - public string Logs { get; set; } - [JsonProperty("_run")] - public string Run { get; set; } - [JsonProperty("_custom")] - public Dictionary Custom { get; set; } - internal CountlyExceptionDetailModel() { } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyExceptionDetailModel.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyExceptionDetailModel.cs.meta deleted file mode 100755 index c55c5e038..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyExceptionDetailModel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 42df6c050b4af69498630216a70a1858 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyRequestModel.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyRequestModel.cs deleted file mode 100644 index 5595a4cb6..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyRequestModel.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using Plugins.CountlySDK.Persistance; - -namespace Plugins.CountlySDK.Models -{ - public class CountlyRequestModel : IModel - { - public CountlyRequestModel(string requestUrl, string requestData) - { - RequestUrl = requestUrl; - RequestData = requestData; - } - - //the request URL field does not seem to be used and probably exists only for migration purposes - public string RequestUrl { get; set; } - public string RequestData { get; set; } - public long Id { get; set; } - - public override string ToString() - { - return $"{nameof(RequestUrl)}: {RequestUrl}, {nameof(RequestData)}: {RequestData}, {nameof(Id)}: {Id}"; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyRequestModel.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyRequestModel.cs.meta deleted file mode 100755 index 84b7c8dc8..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyRequestModel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8c27ebd93d630574c8ba96a5b4b2e949 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyUserDetailsModel.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyUserDetailsModel.cs deleted file mode 100644 index 73a8e6c07..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyUserDetailsModel.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System.Collections.Generic; -using Newtonsoft.Json; - -namespace Plugins.CountlySDK.Models -{ - public class CountlyUserDetailsModel - { - [JsonProperty("name")] - internal string Name { get; set; } - [JsonProperty("username")] - internal string Username { get; set; } - [JsonProperty("email")] - internal string Email { get; set; } - [JsonProperty("organization")] - internal string Organization { get; set; } - [JsonProperty("phone")] - internal string Phone { get; set; } - - //Web URL to picture - //"https://pbs.twimg.com/profile_images/1442562237/012_n_400x400.jpg", - [JsonProperty("picture")] - internal string PictureUrl { get; set; } - - [JsonProperty("gender")] - internal string Gender { get; set; } - [JsonProperty("byear")] - internal string BirthYear { get; set; } - - [JsonProperty("custom")] - //dots (.) and dollar signs ($) in key names will be stripped out. - internal IDictionary Custom { get; set; } - - /// - /// Initializes a new instance of User Model with the specified params - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public CountlyUserDetailsModel(string name, string username, string email, string organization, string phone, - string pictureUrl, string gender, string birthYear, IDictionary customData) - { - Name = name; - Username = username; - Email = email; - Organization = organization; - Phone = phone; - PictureUrl = pictureUrl; - Gender = gender; - BirthYear = birthYear; - if (customData != null) - { - Custom = customData as Dictionary; - } - } - - /// - /// This constructor is used to initialize custom user details only. - /// - /// - public CountlyUserDetailsModel(IDictionary customData) - { - Custom = customData as Dictionary; - } - - public override string ToString() - { - return $"{nameof(Name)}: {Name}, {nameof(Username)}: {Username}, {nameof(Email)}: {Email}, {nameof(Organization)}: {Organization}, {nameof(Phone)}: {Phone}, {nameof(PictureUrl)}: {PictureUrl}, {nameof(Gender)}: {Gender}, {nameof(BirthYear)}: {BirthYear}, {nameof(Custom)}: {Custom}"; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyUserDetailsModel.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyUserDetailsModel.cs.meta deleted file mode 100755 index 70dd07cb2..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/CountlyUserDetailsModel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bab6d79f6f2ce1f4493960cde14543f8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/SegmentModel.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/SegmentModel.cs deleted file mode 100644 index 3fa477f59..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/SegmentModel.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Plugins.CountlySDK.Persistance; - -namespace Plugins.CountlySDK.Models -{ - public class SegmentModel : Dictionary, IModel - { - public long Id { get; set; } - - public SegmentModel() - { - } - - public SegmentModel(IDictionary dictionary) : base(dictionary) - { - } - - public override string ToString() - { - return string.Join(";", this.Select(x => x.Key + "=" + x.Value).ToArray()); - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/SegmentModel.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/SegmentModel.cs.meta deleted file mode 100644 index 4175274a6..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/SegmentModel.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 723c2ed6e5b04e368b85ef9a77bc7ace -timeCreated: 1558586214 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/TimeMetricModel.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/TimeMetricModel.cs deleted file mode 100644 index 28eec2ed9..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/TimeMetricModel.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using Newtonsoft.Json; - -namespace Plugins.CountlySDK.Models -{ - internal class TimeMetricModel - { - [JsonProperty("timestamp")] - public long Timestamp { get; set; } - [JsonProperty("hour")] - public int Hour { get; set; } - [JsonProperty("dow")] - public int DayOfWeek { get; set; } - [JsonProperty("tz")] - public string Timezone { get; set; } - - //variable to hold last used timestamp - private DateTimeOffset _lastMilliSecTimeStamp = DateTimeOffset.UtcNow; - - static TimeMetricModel() { } - private TimeMetricModel() { } - - internal static Dictionary GetTimeMetricModel() - { - TimeMetricModel model = TimeMetricModel.GetTimeZoneInfoForRequest(); - return new Dictionary - { - {"timestamp", model.Timestamp }, - {"hour", model.Hour }, - {"dow", model.DayOfWeek }, - {"tz", model.Timezone }, - }; - } - - private long GetUniqueMilliSecTimeStamp(DateTime? requestedDatetime = null) - { - //get current timestamp in miliseconds - DateTimeOffset currentMilliSecTimeStamp = DateTimeOffset.UtcNow; - - if (requestedDatetime.HasValue) - { - currentMilliSecTimeStamp = requestedDatetime.Value; - - _lastMilliSecTimeStamp = _lastMilliSecTimeStamp >= currentMilliSecTimeStamp - ? _lastMilliSecTimeStamp.AddMilliseconds(1) - : _lastMilliSecTimeStamp = currentMilliSecTimeStamp; - } - else - { - _lastMilliSecTimeStamp = currentMilliSecTimeStamp; - } - - return _lastMilliSecTimeStamp.ToUnixTimeMilliseconds(); - } - - internal static TimeMetricModel GetTimeZoneInfoForRequest() - { - DateTime currentDateTime = DateTime.Now; - TimeMetricModel model = - new TimeMetricModel - { - Hour = currentDateTime.TimeOfDay.Hours, - DayOfWeek = (int)currentDateTime.DayOfWeek, - Timezone = TimeZone.CurrentTimeZone.GetUtcOffset(currentDateTime).TotalMinutes.ToString(CultureInfo.InvariantCulture) - }; - - model.Timestamp = model.GetUniqueMilliSecTimeStamp(currentDateTime); - return model; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/TimeMetricModel.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/TimeMetricModel.cs.meta deleted file mode 100755 index 21680f0bd..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Models/TimeMetricModel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1db3d80ff5737434cad3fc9628788346 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Dao/SegmentDao.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Dao/SegmentDao.cs deleted file mode 100644 index 9a5bdcdca..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Dao/SegmentDao.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Text; -using iBoxDB.LocalServer; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Entities; -using Plugins.iBoxDB; -using UnityEngine; - -namespace Plugins.CountlySDK.Persistance.Dao -{ - public class SegmentDao : Dao - { - private readonly CountlyLogHelper Log; - private readonly StringBuilder _stringBuilder = new StringBuilder(); - - public SegmentDao(AutoBox auto, string table, CountlyLogHelper log) : base(auto, table, log) - { - Log = log; - } - - - public SegmentEntity GetByEventId(long eventId) - { - - Log.Debug("[SegmentDao] GetByEventId: eventId = " + eventId); - - _stringBuilder.Clear(); - - string ql = _stringBuilder.Append("from ").Append(Table).Append(" where EventId==?").ToString(); - - try - { - System.Collections.Generic.List entities = Auto.Select(ql, eventId); - if (entities.Count > 1) - { - throw new ArgumentException("Only one or zero segment can be assigned to entity with id " + eventId + ". " - + entities.Count + " segments found."); - } - - if (entities.Count == 0) - { - return null; - } - - return entities[0]; - } - catch (Exception ex) - { - Log.Debug("[SegmentDao] GetByEventId: Couldn't complete db operation, [" + ex.Message + "]"); - return null; - } - } - - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Dao/SegmentDao.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Dao/SegmentDao.cs.meta deleted file mode 100644 index b754b533b..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Dao/SegmentDao.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 4d452538c8634102b2234ce14e4c1f1f -timeCreated: 1558587310 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/ConfigEntity.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/ConfigEntity.cs deleted file mode 100644 index 4a8235b87..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/ConfigEntity.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Plugins.CountlySDK.Persistance.Entities -{ - public class ConfigEntity : IEntity - { - public long Id; - public string Json; - - public long GetId() - { - return Id; - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/ConfigEntity.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/ConfigEntity.cs.meta deleted file mode 100644 index c46315fb7..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/ConfigEntity.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 102eadb1d1dc48a3862c8521ad8bbfcb -timeCreated: 1558879303 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventEntity.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventEntity.cs deleted file mode 100644 index dbdeeead5..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventEntity.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Plugins.CountlySDK.Persistance.Entities -{ - public class EventEntity : IEntity - { - public long Id; - public string Json; - - public long GetId() - { - return Id; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventEntity.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventEntity.cs.meta deleted file mode 100644 index 00fb5f656..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventEntity.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 13d290097367478699fed39c06cde61d -timeCreated: 1558505424 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventNumberInSameSessionEntity.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventNumberInSameSessionEntity.cs deleted file mode 100644 index 1f74bbb90..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventNumberInSameSessionEntity.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Plugins.CountlySDK.Persistance.Entities -{ - public class EventNumberInSameSessionEntity : IEntity - { - public long Id; - public string EventKey; - public int Number; - - public long GetId() - { - return Id; - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventNumberInSameSessionEntity.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventNumberInSameSessionEntity.cs.meta deleted file mode 100644 index 71b4618c7..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/EventNumberInSameSessionEntity.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 45bfebdfce334479975783a0c5afa68b -timeCreated: 1561559472 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/IEntity.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/IEntity.cs deleted file mode 100644 index bb0af1232..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/IEntity.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Plugins.CountlySDK.Persistance.Entities -{ - public interface IEntity - { - long GetId(); - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/IEntity.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/IEntity.cs.meta deleted file mode 100644 index 8a5182c33..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/IEntity.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c896daf60a6842349a0472b2fb99b418 -timeCreated: 1558595301 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/RequestEntity.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/RequestEntity.cs deleted file mode 100644 index 21e03ec30..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/RequestEntity.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Plugins.CountlySDK.Persistance.Entities -{ - public class RequestEntity : IEntity - { - public long Id; - public string Json; - - public long GetId() - { - return Id; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/RequestEntity.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/RequestEntity.cs.meta deleted file mode 100644 index 0f34cfe63..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/RequestEntity.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c737b431ae4f4bc68605df05421c1e11 -timeCreated: 1558559474 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/SegmentEntity.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/SegmentEntity.cs deleted file mode 100644 index 3a085702c..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/SegmentEntity.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Plugins.CountlySDK.Persistance.Entities -{ - public class SegmentEntity : IEntity - { - public long Id; - public string Json; - public long EventId; - - public long GetId() - { - return Id; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/SegmentEntity.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/SegmentEntity.cs.meta deleted file mode 100644 index a8391e113..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Entities/SegmentEntity.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: edcec07aa0e542c8a39bda1dc2139ac8 -timeCreated: 1558585247 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/IModel.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/IModel.cs deleted file mode 100644 index a54db4600..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/IModel.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Plugins.CountlySDK.Persistance -{ - public interface IModel - { - long Id { set; get; } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/IModel.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/IModel.cs.meta deleted file mode 100644 index d1842964e..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/IModel.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: aacad08f0d3f414fb29161492dbc8986 -timeCreated: 1558560483 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/AbstractEventRepository.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/AbstractEventRepository.cs deleted file mode 100644 index 616deafb4..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/AbstractEventRepository.cs +++ /dev/null @@ -1,91 +0,0 @@ -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Dao; -using Plugins.CountlySDK.Persistance.Entities; -using Plugins.iBoxDB; -using UnityEngine; - -namespace Plugins.CountlySDK.Persistance.Repositories -{ - public abstract class AbstractEventRepository : Repository - { - private readonly SegmentDao _segmentDao; - protected readonly CountlyLogHelper Log; - - protected AbstractEventRepository(Dao dao, SegmentDao segmentDao, CountlyLogHelper log) : base(dao, log) - { - Log = log; - _segmentDao = segmentDao; - - } - - public override void Initialize() - { - base.Initialize(); - foreach (CountlyEventModel model in Models) - { - SegmentEntity segmentEntity = _segmentDao.GetByEventId(model.Id); - if (segmentEntity == null) - { - continue; - } - - SegmentModel segmentModel = Converter.ConvertSegmentEntityToSegmentModel(segmentEntity); - @model.Segmentation = segmentModel; - } - } - - protected override CountlyEventModel ConvertEntityToModel(EventEntity entity) - { - return Converter.ConvertEventEntityToEventModel(entity, Log); - } - - protected override EventEntity ConvertModelToEntity(CountlyEventModel model) - { - return Converter.ConvertEventModelToEventEntity(model, GenerateNewId()); - } - - public override bool Enqueue(CountlyEventModel model) - { - Log.Debug("[" + GetType().Name + "] Enqueue: \n" + model); - - bool res = base.Enqueue(model); - if (!res) - { - return false; - } - - SegmentModel segmentModel = model.Segmentation; - if (segmentModel != null) - { - SegmentEntity segmentEntity = Converter.ConvertSegmentModelToSegmentEntity(segmentModel, _segmentDao.GenerateNewId()); - segmentEntity.EventId = model.Id; - _segmentDao.Save(segmentEntity); - } - - Log.Debug("[" + GetType().Name + "] Event repo enqueue: \n" + model + ", segment: " + segmentModel); - - return true; - } - - public override CountlyEventModel Dequeue() - { - CountlyEventModel @event = base.Dequeue(); - SegmentEntity segmentEntity = _segmentDao.GetByEventId(@event.Id); - if (segmentEntity != null) - { - SegmentModel segmentModel = Converter.ConvertSegmentEntityToSegmentModel(segmentEntity); - @event.Segmentation = segmentModel; - } - - Log.Debug("[" + GetType().Name + "] Event repo Dequeue: \n" + @event.ToString() + ", segment: " + @event.Segmentation?.ToString()); - return @event; - } - - public override void Clear() - { - base.Clear(); - _segmentDao.RemoveAll(); - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/AbstractEventRepository.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/AbstractEventRepository.cs.meta deleted file mode 100644 index a17cf8c4c..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/AbstractEventRepository.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f57c43c600064a94b9409ca758a2d991 -timeCreated: 1558507819 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/NonViewEventRepository.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/NonViewEventRepository.cs deleted file mode 100644 index 40df49c52..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/NonViewEventRepository.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Dao; -using Plugins.CountlySDK.Persistance.Entities; -using Plugins.iBoxDB; - -namespace Plugins.CountlySDK.Persistance.Repositories.Impls -{ - public class NonViewEventRepository : AbstractEventRepository - { - public NonViewEventRepository(Dao dao, SegmentDao segmentDao, CountlyLogHelper log) : base(dao, segmentDao, log) - { - } - - protected override bool ValidateModelBeforeEnqueue(CountlyEventModel model) - { - return true; - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/NonViewEventRepository.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/NonViewEventRepository.cs.meta deleted file mode 100644 index 9c6b67c1a..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/NonViewEventRepository.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: bd0cbfcfc9af48dfac72610baefcd38a -timeCreated: 1558790125 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/ViewEventRepository.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/ViewEventRepository.cs deleted file mode 100644 index 64239f55c..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/ViewEventRepository.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Dao; -using Plugins.CountlySDK.Persistance.Entities; -using Plugins.iBoxDB; -using UnityEngine; - -namespace Plugins.CountlySDK.Persistance.Repositories.Impls -{ - public class ViewEventRepository : AbstractEventRepository - { - - public ViewEventRepository(Dao dao, SegmentDao segmentDao, CountlyLogHelper log) : base(dao, segmentDao, log) - { - } - - protected override bool ValidateModelBeforeEnqueue(CountlyEventModel model) - { - Log.Debug("[ViewEventRepository] Validate model: \n" + model); - return model.Key.Equals(CountlyEventModel.ViewEvent); - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/ViewEventRepository.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/ViewEventRepository.cs.meta deleted file mode 100644 index f0a02e240..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Impls/ViewEventRepository.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c90836d26c3c4ebab87f686de579e436 -timeCreated: 1558790083 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Repository.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Repository.cs deleted file mode 100644 index 6460d7a98..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Repository.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System.Collections.Generic; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Entities; -using Plugins.iBoxDB; -using UnityEngine; - -namespace Plugins.CountlySDK.Persistance.Repositories -{ - public abstract class Repository where TEntity : class, IEntity, new() where TModel : IModel - { - private readonly Dao _dao; - private readonly CountlyLogHelper Log; - - protected Repository(Dao dao, CountlyLogHelper log) - { - _dao = dao; - this.Log = log; - } - - internal Queue Models { get; } = new Queue(); - - internal int Count => Models.Count; - - public virtual void Initialize() - { - RefreshMemoryCache(); - } - - public virtual bool Enqueue(TModel model) - { - Log.Verbose("[Repository] Enqueue, TModel: " + model); - - if (!ValidateModelBeforeEnqueue(model)) - { - return false; - } - - Models.Enqueue(model); - TEntity entity = ConvertModelToEntity(model); - bool res = _dao.Save(entity); - - return res; - } - - public virtual TModel Dequeue() - { - TModel model = Models.Dequeue(); - _dao.Remove(model.Id); - - Log.Verbose("[Repository] Dequeue, TModel: " + model.ToString()); - return model; - } - - public virtual bool Update(TModel model) - { - TEntity entity = ConvertModelToEntity(model); - return _dao.Update(entity); - } - - public virtual void RefreshMemoryCache() - { - Models.Clear(); - - List entities = _dao.LoadAll(); - foreach (TEntity entity in entities) - { - TModel model = ConvertEntityToModel(entity); - if (!ValidateModelBeforeEnqueue(model)) - { - continue; - } - - // Log.Verbose("[Repository] Loaded model: " + model.ToString()); - - Models.Enqueue(model); - } - Log.Verbose("[Repository] Loaded entities of type " + typeof(TEntity).Name + " from db:" + entities.Count); - } - - /// - /// Should only be used for migration or tests - /// - /// - /// - public virtual void DeleteEntry(TModel model) - { - _dao.Remove(model.Id); - Log.Verbose("[Repository] DeleteEntry, TModel: " + model.ToString()); - } - - - public virtual void Clear() - { - Models.Clear(); - _dao.RemoveAll(); - } - - protected abstract TModel ConvertEntityToModel(TEntity entity); - protected abstract TEntity ConvertModelToEntity(TModel model); - - protected long GenerateNewId() - { - return _dao.GenerateNewId(); - } - - protected abstract bool ValidateModelBeforeEnqueue(TModel model); - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Repository.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Repository.cs.meta deleted file mode 100644 index 14c733d23..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/Repository.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 4df9564071d345988369a6e7636d335a -timeCreated: 1558558528 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/RequestRepository.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/RequestRepository.cs deleted file mode 100644 index eea7e887f..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/RequestRepository.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Entities; -using Plugins.iBoxDB; - -namespace Plugins.CountlySDK.Persistance.Repositories -{ - internal class RequestRepository : Repository - { - public RequestRepository(Dao dao, CountlyLogHelper config) : base(dao, config) - { - } - - protected override CountlyRequestModel ConvertEntityToModel(RequestEntity entity) - { - return Converter.ConvertRequestEntityToRequestModel(entity); - } - - protected override RequestEntity ConvertModelToEntity(CountlyRequestModel model) - { - return Converter.ConvertRequestModelToRequestEntity(model, model.Id > 0 ? model.Id : GenerateNewId()); - } - - protected override bool ValidateModelBeforeEnqueue(CountlyRequestModel model) - { - return true; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/RequestRepository.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/RequestRepository.cs.meta deleted file mode 100644 index eae0aac8f..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Persistance/Repositories/RequestRepository.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 238b3016d4ec401ea4d26ddbd6fda13b -timeCreated: 1558559842 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Prefabs/Countly.prefab b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Prefabs/Countly.prefab deleted file mode 100644 index d411e41e7..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Prefabs/Countly.prefab +++ /dev/null @@ -1,62 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &1270423401348912 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 4847215846838172} - - component: {fileID: 114679878964049358} - m_Layer: 0 - m_Name: Countly - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &4847215846838172 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1270423401348912} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &114679878964049358 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1270423401348912} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 3830ecbe0f874710af3c6377b4540a81, type: 3} - m_Name: - m_EditorClassIdentifier: - Auth: - ServerUrl: https://try.count.ly/ - AppKey: YOUR_APP_KEY - DeviceId: - Config: - Salt: - EnableFirstAppLaunchSegment: 0 - EnablePost: 0 - EnableTestMode: 0 - EnableConsoleLogging: 1 - IgnoreSessionCooldown: 0 - NotificationMode: -1 - SessionDuration: 60 - EventQueueThreshold: 10 - StoredRequestLimit: 1000 - TotalBreadcrumbsAllowed: 100 - EnableAutomaticCrashReporting: 1 diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Prefabs/Countly.prefab.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Prefabs/Countly.prefab.meta deleted file mode 100644 index 773749a1a..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Prefabs/Countly.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: fa112482eec144a75b81bc5f456724c6 -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/AbstractBaseService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/AbstractBaseService.cs deleted file mode 100644 index 5e15e9028..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/AbstractBaseService.cs +++ /dev/null @@ -1,148 +0,0 @@ - -using System; -using System.Collections; -using System.Collections.Generic; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Models; - -namespace Plugins.CountlySDK.Services -{ - public abstract class AbstractBaseService - { - internal object LockObj { get; set; } - internal List Listeners { get; set; } - - protected CountlyLogHelper Log { get; private set; } - protected readonly CountlyConfiguration _configuration; - protected readonly ConsentCountlyService _consentService; - - - protected AbstractBaseService(CountlyConfiguration configuration, CountlyLogHelper logHelper, ConsentCountlyService consentService) - { - Log = logHelper; - _configuration = configuration; - _consentService = consentService; - } - - protected IDictionary RemoveSegmentInvalidDataTypes(IDictionary segments) - { - - if (segments == null || segments.Count == 0) - { - return segments; - } - - string moduleName = GetType().Name; - int i = 0; - List toRemove = new List(); - foreach (KeyValuePair item in segments) - { - if (++i > _configuration.MaxSegmentationValues) - { - toRemove.Add(item.Key); - continue; - } - Type type = item.Value?.GetType(); - bool isValidDataType = item.Value != null - && (type == typeof(int) - || type == typeof(bool) - || type == typeof(float) - || type == typeof(double) - || type == typeof(string)); - - - if (!isValidDataType) - { - toRemove.Add(item.Key); - Log.Warning("[" + moduleName + "] RemoveSegmentInvalidDataTypes: In segmentation Data type '" + type + "' of item '" + item.Key + "' isn't valid."); - } - } - - foreach (string k in toRemove) - { - segments.Remove(k); - } - - return segments; - } - - protected string TrimKey(string k) - { - if (k.Length > _configuration.MaxKeyLength) - { - Log.Warning("[" + GetType().Name + "] TrimKey : Max allowed key length is " + _configuration.MaxKeyLength + ". " + k + " will be truncated."); - k = k.Substring(0, _configuration.MaxKeyLength); - } - - return k; - } - - protected string[] TrimValues(string[] values) - { - for (int i = 0; i < values.Length; ++i) - { - if (values[i].Length > _configuration.MaxValueSize) - { - Log.Warning("[" + GetType().Name + "] TrimKey : Max allowed value length is " + _configuration.MaxKeyLength + ". " + values[i] + " will be truncated."); - values[i] = values[i].Substring(0, _configuration.MaxValueSize); - } - } - - - return values; - } - - protected string TrimValue(string fieldName, string v) - { - if (v != null && v.Length > _configuration.MaxValueSize) - { - Log.Warning("[" + GetType().Name + "] TrimValue : Max allowed '" + fieldName + "' length is " + _configuration.MaxValueSize + ". " + v + " will be truncated."); - v = v.Substring(0, _configuration.MaxValueSize); - } - - return v; - } - - protected IDictionary FixSegmentKeysAndValues(IDictionary segments) - { - if (segments == null || segments.Count == 0) - { - return segments; - } - - IDictionary segmentation = new Dictionary(); - foreach (KeyValuePair item in segments) - { - string k = item.Key; - object v = item.Value; - - if (k == null || k.Length == 0 || v == null) - { - continue; - } - - k = TrimKey(k); - - if (v.GetType() == typeof(string)) - { - v = TrimValue(k, (string)v); - } - - segmentation.Add(k, v); - } - - return segmentation; - } - internal virtual void OnInitializationCompleted() { } - internal virtual void DeviceIdChanged(string deviceId, bool merged) { } - internal virtual void ConsentChanged(List updatedConsents, bool newConsentValue, ConsentChangedAction action) { } - } - - internal enum ConsentChangedAction - { - Initialization, - ConsentUpdated, - DeviceIDChangedNotMerged, - } - -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/AbstractBaseService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/AbstractBaseService.cs.meta deleted file mode 100644 index eeec36355..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/AbstractBaseService.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 101ce125fb920429cbb218bf7a78fb09 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ConsentCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ConsentCountlyService.cs deleted file mode 100644 index a9d8d8c5a..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ConsentCountlyService.cs +++ /dev/null @@ -1,421 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Newtonsoft.Json.Linq; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; - -namespace Plugins.CountlySDK.Services -{ - public class ConsentCountlyService : AbstractBaseService - { - internal bool RequiresConsent { get; private set; } - internal readonly RequestCountlyHelper _requestCountlyHelper; - private Dictionary _countlyConsentGroups; - internal readonly Dictionary CountlyConsents; - - internal ConsentCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, ConsentCountlyService consentService, RequestCountlyHelper requestCountlyHelper) : base(configuration, logHelper, consentService) - { - Log.Debug("[ConsentCountlyService] Initializing."); - - if (configuration.RequiresConsent) - { - if (configuration.GivenConsent != null) - { - Log.Debug("[ConsentCountlyService] Enabling consent: " + string.Format("[{0}]", string.Join(", ", configuration.GivenConsent))); - } - - foreach (KeyValuePair entry in configuration.ConsentGroups) - { - Log.Debug("[ConsentCountlyService] Enabling consent group " + entry.Key + ": " + string.Format("[{0}]", string.Join(", ", entry.Value))); - } - } - - _requestCountlyHelper = requestCountlyHelper; - CountlyConsents = new Dictionary(); - RequiresConsent = _configuration.RequiresConsent; - _countlyConsentGroups = new Dictionary(_configuration.ConsentGroups); - - if (_configuration.EnabledConsentGroups != null) - { - foreach (KeyValuePair entry in _countlyConsentGroups) - { - if (_configuration.EnabledConsentGroups.Contains(entry.Key)) - { - SetConsentInternal(entry.Value, true, sendRequest: false, ConsentChangedAction.Initialization); - } - } - } - - SetConsentInternal(_configuration.GivenConsent, true, sendRequest: false, ConsentChangedAction.Initialization); - } - - #region Public Methods - /// - /// Check if consent for the specific feature has been given - /// - /// The consent that should be checked - /// Returns "true" if the consent for the checked feature has been provided - public bool CheckConsent(Consents consent) - { - lock (LockObj) - { - Log.Info("[ConsentCountlyService] CheckConsent : consent = " + consent.ToString()); - return CheckConsentInternal(consent); - } - } - - /// - /// An internal function to check if consent for the specific feature has been given - /// - /// The consent that should be checked - /// Returns "true" if the consent for the checked feature has been provided - internal bool CheckConsentInternal(Consents consent) - { - bool result = !RequiresConsent || CheckConsentRawValue(consent); - Log.Verbose("[ConsentCountlyService] CheckConsent : consent = " + consent.ToString() + ", result = " + result); - return result; - } - - /// - /// Returns the raw consent value as it is stored internally - /// - /// - /// - internal bool CheckConsentRawValue(Consents consent) - { - return CountlyConsents.ContainsKey(consent) && CountlyConsents[consent]; - } - - /// - /// Check if consent for any feature has been given - /// - /// Returns "true" if consent is given for any of the possible features - internal bool AnyConsentGiven() - { - bool result = !RequiresConsent; - - if (result) - { - Log.Verbose("[ConsentCountlyService] AnyConsentGiven = " + result); - return result; - } - - foreach (KeyValuePair entry in CountlyConsents) - { - if (entry.Value) - { - result = true; - break; - } - } - - Log.Verbose("[ConsentCountlyService] AnyConsentGiven = " + result); - - return result; - } - - /// - /// Give consent to the provided features - /// - /// array of consents for which consent should be given - /// - public void GiveConsent(Consents[] consents) - { - lock (LockObj) - { - Log.Info("[ConsentCountlyService] GiveConsent : consents = " + (consents != null)); - - if (!RequiresConsent) - { - Log.Debug("[ConsentCountlyService] GiveConsent: Please set consent to be required before calling this!"); - return; - } - - SetConsentInternal(consents, true, sendRequest: true); - } - } - - /// - /// Give consent to all features - /// - /// - public void GiveConsentAll() - { - lock (LockObj) - { - Log.Info("[ConsentCountlyService] GiveConsentAll"); - - if (!RequiresConsent) - { - Log.Debug("[ConsentCountlyService] GiveConsentAll: Please set consent to be required before calling this!"); - return; - } - - Consents[] consents = Enum.GetValues(typeof(Consents)).Cast().ToArray(); - SetConsentInternal(consents, true, sendRequest: true); - } - } - - /// - /// Remove consent from the provided features - /// - /// array of consents for which consent should be removed - /// - public void RemoveConsent(Consents[] consents) - { - lock (LockObj) - { - Log.Info("[ConsentCountlyService] RemoveConsent : consents = " + (consents != null)); - - if (!RequiresConsent) - { - Log.Debug("[ConsentCountlyService] RemoveConsent: Please set consent to be required before calling this!"); - return; - } - - if (consents == null) - { - Log.Debug("[ConsentCountlyService] Calling RemoveConsent with null consents list!"); - return; - } - //Remove Duplicates entries - consents = consents.Distinct().ToArray(); - - SetConsentInternal(consents, false, sendRequest: true); - } - - } - - /// - /// Remove consent from all features - /// - /// - public void RemoveAllConsent() - { - lock (LockObj) - { - Log.Info("[ConsentCountlyService] RemoveAllConsent"); - - if (!RequiresConsent) - { - Log.Debug("[ConsentCountlyService] RemoveAllConsent: Please set consent to be required before calling this!"); - return; - } - - SetConsentInternal(CountlyConsents.Keys.ToArray(), false, sendRequest: true); - } - } - - /// - /// Give consent to the provided feature groups - /// - /// array of consent group for which consent should be given - /// - public void GiveConsentToGroup(string[] groupName) - { - lock (LockObj) - { - Log.Info("[ConsentCountlyService] GiveConsentToGroup : groupName = " + (groupName != null)); - - if (!RequiresConsent) - { - Log.Debug("[ConsentCountlyService] GiveConsentToGroup: Please set consent to be required before calling this!"); - return; - } - - if (groupName == null) - { - Log.Debug("[ConsentCountlyService] Calling GiveConsentToGroup with null groupName!"); - return; - } - - foreach (string name in groupName) - { - if (_countlyConsentGroups.ContainsKey(name)) - { - Consents[] consents = _countlyConsentGroups[name]; - SetConsentInternal(consents, true, sendRequest: true); - } - } - } - } - - /// - /// Remove consent from the provided feature groups - /// - /// An array of consent group names for which consent should be removed - /// - public void RemoveConsentOfGroup(string[] groupName) - { - lock (LockObj) - { - Log.Info("[ConsentCountlyService] RemoveConsentOfGroup : groupName = " + (groupName != null)); - - if (!RequiresConsent) - { - Log.Debug("[ConsentCountlyService] RemoveConsentOfGroup: Please set consent to be required before calling this!"); - return; - } - - if (groupName == null) - { - Log.Debug("[ConsentCountlyService] Calling RemoveConsentOfGroup with null groupName!"); - return; - } - - foreach (string name in groupName) - { - if (_countlyConsentGroups.ContainsKey(name)) - { - Consents[] consents = _countlyConsentGroups[name]; - SetConsentInternal(consents, false, sendRequest: true); - } - } - } - } - #endregion - - #region Internal Methods - /// - /// Internal method that send consent changes to server. - /// - /// List of consent - /// value to be set - internal async Task SendConsentChanges() - { - if (!RequiresConsent || _requestCountlyHelper == null) - { - return; - } - - JObject jObj = new JObject(); - Consents[] consents = System.Enum.GetValues(typeof(Consents)).Cast().ToArray(); - foreach (Consents consent in consents) - { - jObj.Add(GetConsentKey(consent), CheckConsentRawValue(consent)); - } - - Dictionary requestParams = - new Dictionary { { "consent", jObj } }; - - _requestCountlyHelper.AddToRequestQueue(requestParams); - await _requestCountlyHelper.ProcessQueue(); - } - #endregion - - #region Helper Methods - /// - /// Private method that returns consent key. - /// - /// a consent - ///string - private string GetConsentKey(Consents consent) - { - string key = ""; - switch (consent) - { - case Consents.Clicks: - key = "clicks"; - break; - case Consents.Crashes: - key = "crashes"; - break; - case Consents.Events: - key = "events"; - break; - case Consents.Location: - key = "location"; - break; - case Consents.Push: - key = "push"; - break; - case Consents.RemoteConfig: - key = "remote-config"; - break; - case Consents.Sessions: - key = "sessions"; - break; - case Consents.StarRating: - key = "star-rating"; - break; - case Consents.Users: - key = "users"; - break; - case Consents.Views: - key = "views"; - break; - case Consents.Feedback: - key = "feedback"; - break; - } - - return key; - } - /// - /// Private method that update selected consents. - /// - /// List of consent - /// value to be set - internal async void SetConsentInternal(Consents[] consents, bool value, bool sendRequest = false, ConsentChangedAction action = ConsentChangedAction.ConsentUpdated) - { - if (consents == null) - { - Log.Debug("[ConsentCountlyService] Calling SetConsentInternal with null consents list!"); - return; - } - - List updatedConsents = new List(consents.Length); - foreach (Consents consent in consents) - { - if (CountlyConsents.ContainsKey(consent) && CountlyConsents[consent] == value) - { - continue; - } - - if (!CountlyConsents.ContainsKey(consent) && !value) - { - continue; - } - - updatedConsents.Add(consent); - CountlyConsents[consent] = value; - - Log.Debug("[ConsentCountlyService] Setting consent for: [" + consent.ToString() + "] with value: [" + value + "]"); - } - - if (sendRequest && updatedConsents.Count > 0) - { - await SendConsentChanges(); - } - - NotifyListeners(updatedConsents, value, action); - } - - /// - /// On consents changed, call ConsentChanged on all listeners. - /// - /// List of modified consent - /// Modified Consents's new value - private void NotifyListeners(List updatedConsents, bool newConsentValue, ConsentChangedAction action) - { - if (Listeners == null || updatedConsents.Count < 1) - { - return; - } - - foreach (AbstractBaseService listener in Listeners) - { - listener.ConsentChanged(updatedConsents, newConsentValue, action); - } - - } - #endregion - - #region override Methods - internal override void DeviceIdChanged(string deviceId, bool merged) { } - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ConsentCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ConsentCountlyService.cs.meta deleted file mode 100644 index bf0251d59..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ConsentCountlyService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 72c3ce7d33ea438aa6c4b8d17afb144e -timeCreated: 1558168477 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/CrashReportsCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/CrashReportsCountlyService.cs deleted file mode 100644 index 1acf971a9..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/CrashReportsCountlyService.cs +++ /dev/null @@ -1,233 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using UnityEngine; - -namespace Plugins.CountlySDK.Services -{ - public class CrashReportsCountlyService : AbstractBaseService - { - internal bool IsApplicationInBackground { get; set; } - internal readonly Queue _crashBreadcrumbs = new Queue(); - - internal readonly RequestCountlyHelper _requestCountlyHelper; - - internal CrashReportsCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, RequestCountlyHelper requestCountlyHelper, ConsentCountlyService consentService) : base(configuration, logHelper, consentService) - { - Log.Debug("[CrashReportsCountlyService] Initializing."); - _requestCountlyHelper = requestCountlyHelper; - } - - #region Helper Methods - private string ManipulateStackTrace(string stackTrace) - { - string result = null; - if (!string.IsNullOrEmpty(stackTrace)) - { - string[] lines = stackTrace.Split('\n'); - - int limit = lines.Length; - - if (limit > _configuration.MaxStackTraceLinesPerThread) - { - limit = _configuration.MaxStackTraceLinesPerThread; - } - - for (int i = 0; i < limit; ++i) - { - string line = lines[i]; - - if (line.Length > _configuration.MaxStackTraceLineLength) - { - line = line.Substring(0, _configuration.MaxStackTraceLineLength); - } - - if (i + 1 != limit) - { - line += '\n'; - } - - result += line; - } - } - - return result; - } - #endregion - - /// - /// Public method that sends crash details to the server. Set param "nonfatal" to true for Custom Logged errors - /// - /// a string that contain detailed description of the exception. - /// a string that describes the contents of the callstack. - /// the type of the log message - /// custom key/values to be reported - /// Fof automatically captured errors, you should set to false, whereas on logged errors it should be true - /// - [Obsolete("SendCrashReportAsync(string message, string stackTrace, LogType type, IDictionary segments = null, bool nonfatal = true) is deprecated, this is going to be removed in the future.")] - public async Task SendCrashReportAsync(string message, string stackTrace, LogType type, - IDictionary segments = null, bool nonfatal = true) - { - lock (LockObj) - { - Log.Info("[CrashReportsCountlyService] SendCrashReportAsync : message = " + message + ", stackTrace = " + stackTrace); - - if (!_consentService.CheckConsentInternal(Consents.Crashes)) - { - return; - } - - if (string.IsNullOrEmpty(message) || string.IsNullOrWhiteSpace(message)) - { - Log.Warning("[CrashReportsCountlyService] SendCrashReportAsync : The parameter 'message' can't be null or empty"); - return; - } - - IDictionary segmentation = RemoveSegmentInvalidDataTypes(segments); - segmentation = FixSegmentKeysAndValues(segments); - - CountlyExceptionDetailModel model = ExceptionDetailModel(message, ManipulateStackTrace(stackTrace), nonfatal, segmentation); - _ = SendCrashReportInternal(model); - } - - await Task.CompletedTask; - } - /// - /// Public method that sends crash details to the server. Set param "nonfatal" to true for Custom Logged errors - /// - /// a string that contain detailed description of the exception. - /// a string that describes the contents of the callstack. - /// custom key/values to be reported - /// Fof automatically captured errors, you should set to false, whereas on logged errors it should be true - /// - public async Task SendCrashReportAsync(string message, string stackTrace, IDictionary segments = null, bool nonfatal = true) - { - if (_configuration.EnableAutomaticCrashReporting) - { - lock (LockObj) - { - Log.Info("[CrashReportsCountlyService] SendCrashReportAsync : message = " + message + ", stackTrace = " + stackTrace); - - if (!_consentService.CheckConsentInternal(Consents.Crashes)) - { - return; - } - - if (string.IsNullOrEmpty(message) || string.IsNullOrWhiteSpace(message)) - { - Log.Warning("[CrashReportsCountlyService] SendCrashReportAsync : The parameter 'message' can't be null or empty"); - return; - } - - IDictionary segmentation = RemoveSegmentInvalidDataTypes(segments); - segmentation = FixSegmentKeysAndValues(segments); - - CountlyExceptionDetailModel model = ExceptionDetailModel(message, ManipulateStackTrace(stackTrace), nonfatal, segmentation); - _ = SendCrashReportInternal(model); - } - } - - await Task.CompletedTask; - } - internal async Task SendCrashReportInternal(CountlyExceptionDetailModel model) - { - Log.Debug("[CrashReportsCountlyService] SendCrashReportInternal : model = " + model.ToString()); - - Dictionary requestParams = new Dictionary - { - { - "crash", JsonConvert.SerializeObject(model, Formatting.Indented, - new JsonSerializerSettings {NullValueHandling = NullValueHandling.Ignore}) - } - }; - - _requestCountlyHelper.AddToRequestQueue(requestParams); - await _requestCountlyHelper.ProcessQueue(); - - } - - /// - /// Adds string value to a list which is later sent over as logs whenever a cash is reported by system. - /// - /// a bread crumb for the crash report - public void AddBreadcrumbs(string value) - { - Log.Info("[CrashReportsCountlyService] AddBreadcrumbs : " + value); - - if (!_consentService.CheckConsentInternal(Consents.Crashes)) - { - return; - } - - if (_configuration.EnableTestMode) - { - return; - } - - string validBreadcrumb = value.Length > _configuration.MaxValueSize ? value.Substring(0, _configuration.MaxValueSize) : value; - - if (_crashBreadcrumbs.Count == _configuration.TotalBreadcrumbsAllowed) - { - _crashBreadcrumbs.Dequeue(); - } - - _crashBreadcrumbs.Enqueue(validBreadcrumb); - } - - /// - /// Create an CountlyExceptionDetailModel object from parameters. - /// - /// a string that contain detailed description of the exception. - /// a string that describes the contents of the callstack. - /// for automatically captured errors, you should set to false, whereas on logged errors it should be true - /// custom key/values to be reported - /// CountlyExceptionDetailModel - internal CountlyExceptionDetailModel ExceptionDetailModel(string message, string stackTrace, bool nonfatal, IDictionary segments) - { - return new CountlyExceptionDetailModel - { - OS = _configuration.metricHelper.OS, - OSVersion = SystemInfo.operatingSystem, - Device = SystemInfo.deviceName, - Resolution = Screen.currentResolution.ToString(), - AppVersion = Application.version, - Cpu = SystemInfo.processorType, - Opengl = SystemInfo.graphicsDeviceVersion, - RamTotal = SystemInfo.systemMemorySize.ToString(), - Battery = SystemInfo.batteryLevel.ToString(), - Orientation = Screen.orientation.ToString(), - Online = (Application.internetReachability > 0).ToString(), - - Name = message, - Error = stackTrace, - Nonfatal = nonfatal, - RamCurrent = null, - DiskCurrent = null, - DiskTotal = null, - Muted = null, - Background = IsApplicationInBackground.ToString(), - Root = null, - Logs = string.Join("\n", _crashBreadcrumbs), - Custom = segments as Dictionary, - Run = Time.realtimeSinceStartup.ToString(), -#if UNITY_IOS - Manufacture = UnityEngine.iOS.Device.generation.ToString() -#endif -#if UNITY_ANDROID - Manufacture = SystemInfo.deviceModel -#endif - }; - } - #region override Methods - internal override void DeviceIdChanged(string deviceId, bool merged) - { - - } - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/CrashReportsCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/CrashReportsCountlyService.cs.meta deleted file mode 100644 index 454bfc6ce..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/CrashReportsCountlyService.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 587fbe5dae4b6204799773100d0dd099 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/DeviceIdCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/DeviceIdCountlyService.cs deleted file mode 100644 index 6e0a55632..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/DeviceIdCountlyService.cs +++ /dev/null @@ -1,237 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using UnityEngine; - -namespace Plugins.CountlySDK.Services -{ - public class DeviceIdCountlyService : AbstractBaseService - { - private readonly CountlyUtils _countlyUtils; - private readonly EventCountlyService _eventCountlyService; - internal readonly RequestCountlyHelper _requestCountlyHelper; - private readonly SessionCountlyService _sessionCountlyService; - - private readonly int DEVICE_TYPE_FALLBACK_VALUE = -1; - - - internal DeviceIdCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, SessionCountlyService sessionCountlyService, - RequestCountlyHelper requestCountlyHelper, EventCountlyService eventCountlyService, CountlyUtils countlyUtils, ConsentCountlyService consentService) : base(configuration, logHelper, consentService) - { - Log.Debug("[DeviceIdCountlyService] Initializing."); - - _countlyUtils = countlyUtils; - _eventCountlyService = eventCountlyService; - _requestCountlyHelper = requestCountlyHelper; - _sessionCountlyService = sessionCountlyService; - } - /// - /// Returns the Device ID that is currently used by the SDK - /// - public string DeviceId { get; private set; } - - /// - /// Returns the type Device ID that is currently used by the SDK - /// - public DeviceIdType DeviceIdType { get; private set; } - - /// - /// Initialize DeviceId field with device id provided in configuration or with Random generated Id and Cache it. - /// - /// new device id provided in configuration - internal void InitDeviceId(string deviceId = null) - { - //**Priority is** - //Cached DeviceID (remains even after app kill) - //Static DeviceID (only when the app is running or in the background) - //User provided DeviceID - //Generate Random DeviceID - string storedDeviceId = PlayerPrefs.GetString(Constants.DeviceIDKey); - if (!_countlyUtils.IsNullEmptyOrWhitespace(storedDeviceId)) - { - //SDK already has a device id - - //assign locally stored device id - DeviceId = storedDeviceId; - - //Checking if device id type stored locally - int storedDIDType = PlayerPrefs.GetInt(Constants.DeviceIDTypeKey, DEVICE_TYPE_FALLBACK_VALUE); - - //checking if we valid device id type - if (storedDIDType == (int)DeviceIdType.SDKGenerated || storedDIDType == (int)DeviceIdType.DeveloperProvided) - { - //SDK has a valid device id type in storage. SDK will be using it. - DeviceIdType = (DeviceIdType)storedDIDType; - } - else - { - if (storedDIDType == DEVICE_TYPE_FALLBACK_VALUE) - { - Log.Error("[DeviceIdCountlyService] InitDeviceId: SDK doesn't have device ID type stored. There should have been one."); - } - else - { - Log.Error("[DeviceIdCountlyService] InitDeviceId: The stored device id type wasn't valid ['" + storedDeviceId + "']. SDK will assign a new type"); - } - - if (_countlyUtils.IsNullEmptyOrWhitespace(deviceId)) - { - UpdateDeviceIdAndDeviceIdType(DeviceId, DeviceIdType.SDKGenerated); - - } - else - { - UpdateDeviceIdAndDeviceIdType(DeviceId, DeviceIdType.DeveloperProvided); - } - } - } - else - { - //SDK doesn't have a device id stored locally - - //checking if developer provided device id is null or empty. - if (_countlyUtils.IsNullEmptyOrWhitespace(deviceId)) - { - UpdateDeviceIdAndDeviceIdType(CountlyUtils.GetUniqueDeviceId(), DeviceIdType.SDKGenerated); - } - else - { - UpdateDeviceIdAndDeviceIdType(deviceId, DeviceIdType.DeveloperProvided); - } - } - } - /// - /// Changes Device Id. - /// Adds currently recorded but not queued events to request queue. - /// Clears all started timed-events - /// Ends current session with old Device Id. - /// Begins a new session with new Device Id - /// - /// new device id - public async Task ChangeDeviceIdWithoutMerge(string deviceId) - { - lock (LockObj) - { - Log.Info("[DeviceIdCountlyService] ChangeDeviceIdWithoutMerge: deviceId = " + deviceId); - - //Ignore call if new and old device id are same - if (DeviceId == deviceId) - { - return; - } - - //Add currently recorded events to request queue - _eventCountlyService.AddEventsToRequestQueue(); - - //Cancel all timed events - _eventCountlyService.CancelAllTimedEvents(); - - //Ends current session - //Do not dispose timer object - if (!_configuration.IsAutomaticSessionTrackingDisabled) - { - _ = _sessionCountlyService.EndSessionAsync(); - } - - //Update device id - UpdateDeviceIdAndDeviceIdType(deviceId, DeviceIdType.DeveloperProvided); - - if (_consentService.RequiresConsent) - { - _consentService.SetConsentInternal(_consentService.CountlyConsents.Keys.ToArray(), false, sendRequest: false, ConsentChangedAction.DeviceIDChangedNotMerged); - } - - //Begin new session with new device id - //Do not initiate timer again, it is already initiated - if (!_configuration.IsAutomaticSessionTrackingDisabled) - { - _ = _sessionCountlyService.BeginSessionAsync(); - } - - NotifyListeners(false); - - _ = _requestCountlyHelper.ProcessQueue(); - } - - await Task.CompletedTask; - } - - /// - /// Changes DeviceId. - /// Continues with the current session. - /// Merges data for old and new Device Id. - /// - /// new device id - public async Task ChangeDeviceIdWithMerge(string deviceId) - { - lock (LockObj) - { - Log.Info("[DeviceIdCountlyService] ChangeDeviceIdWithMerge: deviceId = " + deviceId); - - //Ignore call if new and old device id are same - if (DeviceId == deviceId) - { - return; - } - - //Keep old device id - string oldDeviceId = DeviceId; - - //Update device id - UpdateDeviceIdAndDeviceIdType(deviceId, DeviceIdType.DeveloperProvided); - - //Merge user data for old and new device - Dictionary requestParams = - new Dictionary { { "old_device_id", oldDeviceId } }; - - _requestCountlyHelper.AddToRequestQueue(requestParams); - _ = _requestCountlyHelper.ProcessQueue(); - NotifyListeners(true); - } - - await Task.CompletedTask; - } - - /// - /// Updates Device ID both in app and in cache - /// - /// new device id - /// device id type - private void UpdateDeviceIdAndDeviceIdType(string newDeviceId, DeviceIdType type) - { - //Change device id and type - DeviceId = newDeviceId; - DeviceIdType = type; - - //Updating Cache - PlayerPrefs.SetString(Constants.DeviceIDKey, DeviceId); - PlayerPrefs.SetInt(Constants.DeviceIDTypeKey, (int)DeviceIdType); - - Log.Debug("[DeviceIdCountlyService] UpdateDeviceId: " + newDeviceId); - } - - /// - /// Call DeviceIdChanged on all listeners. - /// - /// If passed "true" if will perform a device ID merge server side of the old and new device ID. This will merge their data - private void NotifyListeners(bool merged) - { - if (Listeners == null) - { - return; - } - - foreach (AbstractBaseService listener in Listeners) - { - listener.DeviceIdChanged(DeviceId, merged); - } - } - - #region override Methods - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/DeviceIdCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/DeviceIdCountlyService.cs.meta deleted file mode 100644 index 56e9ef0cf..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/DeviceIdCountlyService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e495083a4dda4c55be0f9454a9aa1643 -timeCreated: 1558166363 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/EventCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/EventCountlyService.cs deleted file mode 100644 index ddd532f8b..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/EventCountlyService.cs +++ /dev/null @@ -1,321 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Repositories.Impls; - -namespace Plugins.CountlySDK.Services -{ - public class EventCountlyService : AbstractBaseService - { - private bool isQueueBeingProcessed = false; - internal readonly NonViewEventRepository _eventRepo; - private readonly RequestCountlyHelper _requestCountlyHelper; - - internal readonly IDictionary _timedEvents; - - internal EventCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, RequestCountlyHelper requestCountlyHelper, NonViewEventRepository nonViewEventRepo, ConsentCountlyService consentService) : base(configuration, logHelper, consentService) - { - Log.Debug("[EventCountlyService] Initializing."); - - _eventRepo = nonViewEventRepo; - _requestCountlyHelper = requestCountlyHelper; - _timedEvents = new Dictionary(); - } - - /// - /// Add all recorded events to request queue - /// - internal void CancelAllTimedEvents() - { - _timedEvents.Clear(); - } - - /// - /// Add all recorded events to request queue - /// - internal void AddEventsToRequestQueue() - { - - Log.Debug("[EventCountlyService] AddEventsToRequestQueue: Start"); - - if (_eventRepo.Models.Count == 0) - { - Log.Debug("[EventCountlyService] AddEventsToRequestQueue: Event queue is empty!"); - return; - } - - if (isQueueBeingProcessed) - { - Log.Verbose("[EventCountlyService] AddEventsToRequestQueue: Event queue being processed!"); - return; - } - isQueueBeingProcessed = true; - - int count = _eventRepo.Models.Count; - //Send all at once - Dictionary requestParams = - new Dictionary - { - { - "events", JsonConvert.SerializeObject(_eventRepo.Models, Formatting.Indented, - new JsonSerializerSettings {NullValueHandling = NullValueHandling.Ignore}) - } - }; - - _requestCountlyHelper.AddToRequestQueue(requestParams); - - Log.Debug("[EventCountlyService] AddEventsToRequestQueue: Remove events from event queue, count: " + count); - for (int i = 0; i < count; ++i) - { - _eventRepo.Dequeue(); - } - - isQueueBeingProcessed = false; - Log.Debug("[EventCountlyService] AddEventsToRequestQueue: End"); - } - - // - /// An internal method to record an event to the server with segmentation. - /// - /// event key - /// custom segmentation you want to set, leave null if you don't want to add anything - /// how many of these events have occurred, default value is "1" - /// set sum if needed, default value is "0" - /// set sum if needed, default value is "0" - /// - internal async Task RecordEventInternal(string key, IDictionary segmentation = null, - int? count = 1, double? sum = 0, double? duration = null) - { - if (!CheckConsentOnKey(key)) - { - return; - } - - if (string.IsNullOrEmpty(key) || string.IsNullOrWhiteSpace(key)) - { - Log.Warning("[EventCountlyService] RecordEventInternal : The event key '" + key + "'isn't valid."); - return; - } - - if (_configuration.EnableTestMode) - { - return; - } - - if (key.Length > _configuration.MaxKeyLength) - { - Log.Warning("[EventCountlyService] RecordEventInternal : Max allowed key length is " + _configuration.MaxKeyLength); - key = key.Substring(0, _configuration.MaxKeyLength); - } - - IDictionary segments = RemoveSegmentInvalidDataTypes(segmentation); - segments = FixSegmentKeysAndValues(segments); - - CountlyEventModel @event = new CountlyEventModel(key, segments, count, sum, duration); - - await RecordEventAsync(@event); - - } - - /// - /// An internal function to add an event to event queue. - /// - /// an event - /// - internal async Task RecordEventAsync(CountlyEventModel @event) - { - Log.Debug("[EventCountlyService] RecordEventAsync : " + @event.ToString()); - - if (_configuration.EnableTestMode) - { - return; - } - - _eventRepo.Enqueue(@event); - - if (_eventRepo.Count >= _configuration.EventQueueThreshold) - { - AddEventsToRequestQueue(); - await _requestCountlyHelper.ProcessQueue(); - } - } - - private bool CheckConsentOnKey(string key) - { - if (key.Equals(CountlyEventModel.ViewEvent)) - { - return _consentService.CheckConsentInternal(Consents.Views); - } - else if (key.Equals(CountlyEventModel.StarRatingEvent)) - { - return _consentService.CheckConsentInternal(Consents.StarRating); - } - else if (key.Equals(CountlyEventModel.PushActionEvent)) - { - return _consentService.CheckConsentInternal(Consents.Push); - } - else if (key.Equals(CountlyEventModel.ViewActionEvent)) - { - return _consentService.CheckConsentInternal(Consents.Clicks); - } - else if (key.Equals(CountlyEventModel.NPSEvent)) - { - return _consentService.CheckConsentInternal(Consents.Feedback); - } - else if (key.Equals(CountlyEventModel.SurveyEvent)) - { - return _consentService.CheckConsentInternal(Consents.Feedback); - } - else if (key.Equals(CountlyEventModel.OrientationEvent)) - { - return _consentService.CheckConsentInternal(Consents.Users); - } - else { return _consentService.CheckConsentInternal(Consents.Events); } - } - - /// - /// Start a timed event. - /// - /// event key - /// - public void StartEvent(string key) - { - lock (LockObj) - { - Log.Info("[EventCountlyService] StartEvent : key = " + key); - - if (!_consentService.CheckConsentInternal(Consents.Events)) - { - return; - } - - if (string.IsNullOrEmpty(key) || string.IsNullOrWhiteSpace(key)) - { - Log.Warning("[EventCountlyService] StartEvent : The event key '" + key + "' isn't valid."); - return; - } - - if (_timedEvents.ContainsKey(key)) - { - Log.Warning("[EventCountlyService] StartEvent : Event with key '" + key + "' has already started."); - return; - } - - TimeMetricModel timeModel = TimeMetricModel.GetTimeZoneInfoForRequest(); - _timedEvents.Add(key, DateTime.Now); - } - - } - - /// - /// Cancel a timed event. - /// - /// event key - /// - public void CancelEvent(string key) - { - lock (LockObj) - { - Log.Info("[EventCountlyService] CancelEvent : key = " + key); - - if (!_consentService.CheckConsentInternal(Consents.Events)) - { - return; - } - - if (string.IsNullOrEmpty(key) || string.IsNullOrWhiteSpace(key)) - { - Log.Warning("[EventCountlyService] CancelEvent : The event key '" + key + "' isn't valid."); - return; - } - - if (!_timedEvents.ContainsKey(key)) - { - Log.Warning("[EventCountlyService] CancelEvent : Time event with key '" + key + "' doesn't exist."); - return; - } - - _timedEvents.Remove(key); - } - - } - - /// - /// End a timed event. - /// - /// event key - /// custom segmentation you want to set, leave null if you don't want to add anything - /// how many of these events have occurred, default value is "1" - /// set sum if needed, default value is "0" - /// - public void EndEvent(string key, IDictionary segmentation = null, int? count = 1, double? sum = 0) - { - lock (LockObj) - { - Log.Info("[EventCountlyService] EndEvent : key = " + key + ", segmentation = " + segmentation + ", count = " + count + ", sum = " + sum); - - if (!_consentService.CheckConsentInternal(Consents.Events)) - { - return; - } - - if (string.IsNullOrEmpty(key) || string.IsNullOrWhiteSpace(key)) - { - Log.Warning("[EventCountlyService] EndEvent : The event key '" + key + "' isn't valid."); - return; - } - - if (!_timedEvents.ContainsKey(key)) - { - Log.Warning("[EventCountlyService] EndEvent : Time event with key '" + key + "' doesn't exist."); - return; - } - - DateTime startTime = _timedEvents[key]; - double duration = (DateTime.Now - startTime).TotalSeconds; - - CountlyEventModel @event = new CountlyEventModel(key, segmentation, count, sum, duration); - _ = RecordEventAsync(@event); - - _timedEvents.Remove(key); - } - - } - - /// - /// Report an event to the server with segmentation. - /// - /// event key - /// custom segmentation you want to set, leave null if you don't want to add anything - /// how many of these events have occurred, default value is "1" - /// set sum if needed, default value is "0" - /// set sum if needed, default value is "0" - /// - public async Task RecordEventAsync(string key, IDictionary segmentation = null, - int? count = 1, double? sum = 0, double? duration = null) - { - lock (LockObj) - { - Log.Info("[EventCountlyService] RecordEventAsync : key = " + key + ", segmentation = " + segmentation + ", count = " + count + ", sum = " + sum + ", duration = " + duration); - - _ = RecordEventInternal(key, segmentation, count, sum, duration); - } - - await Task.CompletedTask; - } - - #region override Methods - internal override void ConsentChanged(List updatedConsents, bool newConsentValue, ConsentChangedAction action) - { - if (updatedConsents.Contains(Consents.Events) && !newConsentValue) - { - CancelAllTimedEvents(); - } - } - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/EventCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/EventCountlyService.cs.meta deleted file mode 100644 index 72aace343..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/EventCountlyService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 1a4c2f93faf746cb948941574c4c8741 -timeCreated: 1558168445 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/InitializationCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/InitializationCountlyService.cs deleted file mode 100644 index 78e67e26a..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/InitializationCountlyService.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Linq; -using System.Threading.Tasks; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Models; - -namespace Plugins.CountlySDK.Services -{ - public class InitializationCountlyService : AbstractBaseService - { - private readonly LocationService _locationService; - private readonly SessionCountlyService _sessionService; - - internal InitializationCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, LocationService locationService, SessionCountlyService sessionCountlyService, ConsentCountlyService consentService) : base(configuration, logHelper, consentService) - { - Log.Debug("[InitializationCountlyService] Initializing."); - - _locationService = locationService; - _sessionService = sessionCountlyService; - } - - internal async Task OnInitialisationComplete() - { - lock (LockObj) - { - _ = _consentService.SendConsentChanges(); - _ = _sessionService.StartSessionService(); - } - - await Task.CompletedTask; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/InitializationCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/InitializationCountlyService.cs.meta deleted file mode 100644 index 80752602d..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/InitializationCountlyService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 5c6a4805a6164d80af8a1d1fcbb656a4 -timeCreated: 1558167250 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/LocationService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/LocationService.cs deleted file mode 100644 index a6bc814ca..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/LocationService.cs +++ /dev/null @@ -1,216 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using UnityEngine; - -namespace Plugins.CountlySDK.Services -{ - public class LocationService : AbstractBaseService - { - internal string City { get; private set; } - internal string Location { get; private set; } - internal string IPAddress { get; private set; } - internal string CountryCode { get; private set; } - internal bool IsLocationDisabled { get; private set; } - - private readonly RequestCountlyHelper _requestCountlyHelper; - - internal LocationService(CountlyConfiguration configuration, CountlyLogHelper logHelper, RequestCountlyHelper requestCountlyHelper, ConsentCountlyService consentService) : base(configuration, logHelper, consentService) - { - Log.Debug("[LocationService] Initializing."); - if (configuration.IsLocationDisabled) - { - Log.Debug("[LocationService] Disabling location"); - } - - if (configuration.CountryCode != null || configuration.City != null || configuration.Location != null || configuration.IPAddress != null) - { - Log.Debug("[LocationService] location: countryCode = [" + configuration.CountryCode + "], city = [" + configuration.City + "], gpsCoordinates = [" + configuration.Location + ",] ipAddress = [" + configuration.IPAddress + "]"); - } - - _requestCountlyHelper = requestCountlyHelper; - IsLocationDisabled = configuration.IsLocationDisabled; - - if (IsLocationDisabled || !_consentService.CheckConsentInternal(Consents.Location)) - { - City = null; - Location = null; - IPAddress = null; - CountryCode = null; - } - else - { - City = configuration.City; - Location = configuration.Location; - IPAddress = configuration.IPAddress; - CountryCode = configuration.CountryCode; - } - } - - /// - /// Sends a request with an empty "location" parameter. - /// - internal async Task SendRequestWithEmptyLocation() - { - Dictionary requestParams = - new Dictionary { - { "location", string.Empty } - }; - - _requestCountlyHelper.AddToRequestQueue(requestParams); - await _requestCountlyHelper.ProcessQueue(); - } - - /// - /// An internal function to add user's location request into request queue. - /// - internal async Task SendIndependantLocationRequest() - { - Log.Debug("[LocationService] SendIndependantLocationRequest"); - - if (!_consentService.CheckConsentInternal(Consents.Location)) - { - return; - } - - Dictionary requestParams = - new Dictionary(); - - /* - * Empty country code, city and IP address can not be sent. - */ - - if (!string.IsNullOrEmpty(IPAddress)) - { - requestParams.Add("ip_address", IPAddress); - } - - if (!string.IsNullOrEmpty(CountryCode)) - { - requestParams.Add("country_code", CountryCode); - } - - if (!string.IsNullOrEmpty(City)) - { - requestParams.Add("city", City); - } - - if (!string.IsNullOrEmpty(Location)) - { - requestParams.Add("location", Location); - } - - if (requestParams.Count > 0) - { - _requestCountlyHelper.AddToRequestQueue(requestParams); - await _requestCountlyHelper.ProcessQueue(); - } - } - - - - /// - /// Disabled the location tracking on the Countly server - /// - public async void DisableLocation() - { - lock (LockObj) - { - Log.Info("[LocationService] DisableLocation"); - - if (!_consentService.CheckConsentInternal(Consents.Location)) - { - return; - } - - IsLocationDisabled = true; - City = null; - Location = null; - IPAddress = null; - CountryCode = null; - - /* - *If the location feature gets disabled or location consent is removed, - *the SDK sends a request with an empty "location". - */ - - _ = SendRequestWithEmptyLocation(); - } - - await Task.CompletedTask; - } - - /// - /// Set Country code (ISO Country code), City, Location and IP address to be used for future requests. - /// - /// ISO Country code for the user's country - /// Name of the user's city - /// comma separate lat and lng values. For example, "56.42345,123.45325" - /// ipAddress like "192.168.88.33" - /// - public async void SetLocation(string countryCode, string city, string gpsCoordinates, string ipAddress) - { - lock (LockObj) - { - Log.Info("[LocationService] SetLocation : countryCode = " + countryCode + ", city = " + city + ", gpsCoordinates = " + gpsCoordinates + ", ipAddress = " + ipAddress); - - if (!_consentService.CheckConsentInternal(Consents.Location)) - { - return; - } - - /*If city is not paired together with country, - * a warning should be printed that they should be set together. - */ - if ((!string.IsNullOrEmpty(CountryCode) && string.IsNullOrEmpty(City)) - || (!string.IsNullOrEmpty(City) && string.IsNullOrEmpty(CountryCode))) - { - Log.Warning("[LocationService] In \"SetLocation\" both country code and city should be set together"); - } - - City = city; - IPAddress = ipAddress; - CountryCode = countryCode; - Location = gpsCoordinates; - - /* - * If location consent is given and location gets re-enabled (previously was disabled), - * we send that set location information in a separate request and save it in the internal location cache. - */ - if (countryCode != null || city != null || gpsCoordinates != null || ipAddress != null) - { - IsLocationDisabled = false; - _ = SendIndependantLocationRequest(); - } - } - - await Task.CompletedTask; - } - - /// - /// If location consent is removed, the SDK sends a request with an empty "location" parameter. - /// - private async void OnLocationConsentRemoved() - { - City = null; - Location = null; - IPAddress = null; - CountryCode = null; - - await SendRequestWithEmptyLocation(); - } - - #region override Methods - internal override void ConsentChanged(List updatedConsents, bool newConsentValue, ConsentChangedAction action) - { - if (action != ConsentChangedAction.DeviceIDChangedNotMerged && updatedConsents.Contains(Consents.Location) && !newConsentValue) - { - OnLocationConsentRemoved(); - } - - } - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/LocationService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/LocationService.cs.meta deleted file mode 100644 index 833798ae2..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/LocationService.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9de1f429519cc4039a22fb816ea03108 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/PushCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/PushCountlyService.cs deleted file mode 100644 index e74430ce5..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/PushCountlyService.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Notifications; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; - -namespace Plugins.CountlySDK.Services -{ - public class PushCountlyService : AbstractBaseService - { - private string _token; - private TestMode? _mode; - private bool _isDeviceRegistered; - private readonly RequestCountlyHelper _requestCountlyHelper; - private readonly INotificationsService _notificationsService; - private readonly NotificationsCallbackService _notificationsCallbackService; - - internal PushCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, RequestCountlyHelper requestCountlyHelper, INotificationsService notificationsService, NotificationsCallbackService notificationsCallbackService, ConsentCountlyService consentService) : base(configuration, logHelper, consentService) - { - Log.Debug("[PushCountlyService] Initializing."); - if (configuration.NotificationEventListeners.Count > 0) - { - Log.Debug("[PushCountlyService] Registering " + configuration.NotificationEventListeners.Count + " notification event listeners."); - } - - _requestCountlyHelper = requestCountlyHelper; - _notificationsService = notificationsService; - _notificationsCallbackService = notificationsCallbackService; - } - - /// - /// A private method to register device for receiving Push Notifications. - /// - private void EnableNotification() - { - Log.Debug("[PushCountlyService] EnableNotification"); - - //Enables push notification on start - if (_configuration.EnableTestMode || !_consentService.CheckConsentInternal(Consents.Push) || _configuration.NotificationMode == TestMode.None) - { - return; - } - - - EnablePushNotificationAsync(_configuration.NotificationMode); - } - - /// - /// Registers device for receiving Push Notifications - /// - /// Application mode - private void EnablePushNotificationAsync(TestMode mode) - { - Log.Debug("[PushCountlyService] EnablePushNotificationAsync : mode = " + mode); - - _mode = mode; - _isDeviceRegistered = true; - _notificationsService.GetToken(async result => - { - _token = result; - /* - * When the push notification service gets enabled successfully for the device, - * we send a request to the Countly server that the user is ready to receive push notifications. - */ - await PostToCountlyAsync(_mode, _token); - await ReportPushActionAsync(); - }); - - _notificationsService.OnNotificationClicked(async (data, index) => - { - _notificationsCallbackService.NotifyOnNotificationClicked(data, index); - await ReportPushActionAsync(); - }); - - _notificationsService.OnNotificationReceived(data => - { - _notificationsCallbackService.NotifyOnNotificationReceived(data); - }); - - } - - /// - /// Notifies Countly that the device is capable of receiving Push Notifications - /// - /// - private async Task PostToCountlyAsync(TestMode? mode, string token) - { - Log.Debug("[PushCountlyService] PostToCountlyAsync : token = " + token); - - if (!_mode.HasValue || !_consentService.CheckConsentInternal(Consents.Push)) - { - return; - } - - Dictionary requestParams = - new Dictionary - { - { "token_session", 1 }, - { "test_mode", (int)mode.Value }, - { $"{_configuration.metricHelper.OS}_token", token }, - }; - - _requestCountlyHelper.AddToRequestQueue(requestParams); - await _requestCountlyHelper.ProcessQueue(); - } - - /// - /// Report Push Actions stored in local cache to Countly server., - /// - private async Task ReportPushActionAsync() - { - Log.Debug("[PushCountlyService] ReportPushActionAsync"); - - if (!_consentService.CheckConsentInternal(Consents.Push)) - { - return new CountlyResponse { IsSuccess = false }; - } - - - return await _notificationsService.ReportPushActionAsync(); - } - - #region override Methods - internal override void OnInitializationCompleted() - { - EnableNotification(); - } - internal override void ConsentChanged(List updatedConsents, bool newConsentValue, ConsentChangedAction action) - { - if (updatedConsents.Contains(Consents.Push) && newConsentValue && !_isDeviceRegistered) - { - EnableNotification(); - } - } - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/PushCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/PushCountlyService.cs.meta deleted file mode 100644 index 90f5457c5..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/PushCountlyService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 1aa26b96f7c44a41b25433c47c0e59c6 -timeCreated: 1558167003 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/RemoteConfigCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/RemoteConfigCountlyService.cs deleted file mode 100644 index 106102e59..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/RemoteConfigCountlyService.cs +++ /dev/null @@ -1,148 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Entities; -using Plugins.iBoxDB; -using UnityEngine; -using UnityEngine.Networking; - -namespace Plugins.CountlySDK.Services -{ - public class RemoteConfigCountlyService : AbstractBaseService - { - private readonly CountlyUtils _countlyUtils; - private readonly Dao _configDao; - private readonly RequestBuilder _requestBuilder; - private readonly RequestCountlyHelper _requestCountlyHelper; - - /// - /// Get the remote config values. - /// - public Dictionary Configs { private set; get; } - - private readonly StringBuilder _requestStringBuilder = new StringBuilder(); - - internal RemoteConfigCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, RequestCountlyHelper requestCountlyHelper, CountlyUtils countlyUtils, Dao configDao, ConsentCountlyService consentService, RequestBuilder requestBuilder) : base(configuration, logHelper, consentService) - { - Log.Debug("[RemoteConfigCountlyService] Initializing."); - - _configDao = configDao; - _countlyUtils = countlyUtils; - _requestBuilder = requestBuilder; - _requestCountlyHelper = requestCountlyHelper; - - if (_consentService.CheckConsentInternal(Consents.RemoteConfig)) - { - Configs = FetchConfigFromDB(); - } - else - { - _configDao.RemoveAll(); - } - - } - - /// - /// Fetch fresh remote config values from server and initialize Configs - /// - internal async Task InitConfig() - { - Log.Debug("[RemoteConfigCountlyService] InitConfig"); - - if (_configuration.EnableTestMode) - { - return new CountlyResponse { IsSuccess = true }; - } - - return await Update(); - } - - /// - /// Fetch locally stored remote config values. - /// - /// Stored Remote config - private Dictionary FetchConfigFromDB() - { - Dictionary config = null; - List allConfigs = _configDao.LoadAll(); - if (allConfigs != null && allConfigs.Count > 0) - { - config = Converter.ConvertJsonToDictionary(allConfigs[0].Json, Log); - } - - Log.Debug("[RemoteConfigCountlyService] FetchConfigFromDB : Configs = " + config); - - return config; - } - - /// - /// Fetch fresh remote config values from server and store locally. - /// - /// - public async Task Update() - { - Log.Info("[RemoteConfigCountlyService] Update"); - - if (!_consentService.CheckConsentInternal(Consents.RemoteConfig)) - { - return new CountlyResponse - { - IsSuccess = false - }; - } - - Dictionary requestParams = _countlyUtils.GetBaseParams(); - - requestParams.Add("method", "fetch_remote_config"); - - string metricsJSON = _configuration.metricHelper.buildMetricJSON(); - requestParams.Add("metrics", metricsJSON); - - string data = _requestBuilder.BuildQueryString(requestParams); - - CountlyResponse response; - if (_configuration.EnablePost) - { - response = await Task.Run(() => _requestCountlyHelper.PostAsync(_countlyUtils.ServerInputUrl, data)); - } - else - { - response = await Task.Run(() => _requestCountlyHelper.GetAsync(_countlyUtils.ServerInputUrl, data)); - - } - if (response.IsSuccess) - { - _configDao.RemoveAll(); - ConfigEntity configEntity = new ConfigEntity - { - Id = _configDao.GenerateNewId(), - Json = response.Data - }; - _configDao.Save(configEntity); - Configs = Converter.ConvertJsonToDictionary(response.Data, Log); - - Log.Debug("[RemoteConfigCountlyService] UpdateConfig: " + response.ToString()); - - } - - return response; - } - - #region override Methods - internal override void ConsentChanged(List updatedConsents, bool newConsentValue, ConsentChangedAction action) - { - if (updatedConsents.Contains(Consents.RemoteConfig) && !newConsentValue) - { - Configs = null; - _configDao.RemoveAll(); - } - } - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/RemoteConfigCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/RemoteConfigCountlyService.cs.meta deleted file mode 100644 index 1c8ba93e1..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/RemoteConfigCountlyService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 6bd5dd84b2ae4c9db1afc8c01d20dbc0 -timeCreated: 1558178944 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/SessionCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/SessionCountlyService.cs deleted file mode 100644 index d6e3396f1..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/SessionCountlyService.cs +++ /dev/null @@ -1,306 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; -using System.Timers; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using UnityEngine; - -namespace Plugins.CountlySDK.Services -{ - public class SessionCountlyService : AbstractBaseService - { - internal Timer _sessionTimer; - internal DateTime _lastSessionRequestTime; - - /// - /// Check if session has been initiated. - /// - /// bool - internal bool IsSessionInitiated { get; private set; } - private readonly LocationService _locationService; - private readonly EventCountlyService _eventService; - internal readonly RequestCountlyHelper _requestCountlyHelper; - private readonly MonoBehaviour _monoBehaviour; - bool isInternalTimerStopped; - - internal SessionCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, EventCountlyService eventService, - RequestCountlyHelper requestCountlyHelper, LocationService locationService, ConsentCountlyService consentService, MonoBehaviour monoBehaviour) : base(configuration, logHelper, consentService) - { - Log.Debug("[SessionCountlyService] Initializing."); - if (configuration.IsAutomaticSessionTrackingDisabled) - { - Log.Debug("[SessionCountlyService] Disabling automatic session tracking"); - } - - _eventService = eventService; - _locationService = locationService; - _requestCountlyHelper = requestCountlyHelper; - _monoBehaviour = monoBehaviour; - - if (_configuration.IsAutomaticSessionTrackingDisabled) - { - Log.Verbose("[Countly][CountlyConfiguration] Automatic session tracking disabled!"); - } - } - - /// - /// Run session startup logic and start timer with the specified interval - /// - internal async Task StartSessionService() - { - if (_configuration.IsAutomaticSessionTrackingDisabled || !_consentService.CheckConsentInternal(Consents.Sessions)) - { - /* If location is disabled in init - and no session consent is given. Send empty location as separate request.*/ - if (_locationService.IsLocationDisabled || !_consentService.CheckConsentInternal(Consents.Location)) - { - await _locationService.SendRequestWithEmptyLocation(); - } - else - { - /* - * If there is no session consent or automatic session tracking is disabled, - * location values set in init should be sent as a separate location request. - */ - await _locationService.SendIndependantLocationRequest(); - } - } - else - { - //Start Session - await BeginSessionAsync(); - } - - InitSessionTimer(); - } - - /// - /// Initializes the timer for extending session with specified interval - /// - private void InitSessionTimer() - { -#if UNITY_WEBGL - _monoBehaviour.StartCoroutine(SessionTimerCoroutine()); -#else - _sessionTimer = new Timer { Interval = _configuration.SessionDuration * 1000 }; - _sessionTimer.Elapsed += SessionTimerOnElapsedAsync; - _sessionTimer.AutoReset = true; - _sessionTimer.Start(); -#endif - } - - private void SendRequestsAndExtendSession() - { - //Countly.Instance.UserProfile.Save(); - _eventService.AddEventsToRequestQueue(); - _ = _requestCountlyHelper.ProcessQueue(); - - if (!_configuration.IsAutomaticSessionTrackingDisabled) - { - _ = ExtendSessionAsync(); - } - } - - private IEnumerator SessionTimerCoroutine() - { - Log.Debug("[SessionCountlyService] SessionTimerCoroutine, Start"); - - if (isInternalTimerStopped) - { - yield break; - } - - yield return new WaitForSeconds(_configuration.SessionDuration); - SendRequestsAndExtendSession(); - Log.Debug("[SessionCountlyService] SessionTimerCoroutine, Coroutine completed."); - } - - /// - /// Stops the timer and unsubscribes from the Elapsed event. - /// This exists for preventing session extending after tests. - /// - internal void StopSessionTimer() - { - isInternalTimerStopped = true; - -#if UNITY_WEBGL - _monoBehaviour.StopCoroutine(SessionTimerCoroutine()); -#else - if (_sessionTimer != null) { - // Unsubscribe from the Elapsed event - _sessionTimer.Elapsed -= SessionTimerOnElapsedAsync; - - // Stop and dispose the timer - _sessionTimer.Stop(); - _sessionTimer.Dispose(); - } -#endif - } - - /// - /// Extends the session after the session duration is elapsed - /// - /// reference of caller - /// Provides data for Timer.Elapsedevent. - private async void SessionTimerOnElapsedAsync(object sender, ElapsedEventArgs elapsedEventArgs) - { - lock (LockObj) - { - - if (isInternalTimerStopped) - { - return; - } - - Log.Debug("[SessionCountlyService] SessionTimerOnElapsedAsync"); - SendRequestsAndExtendSession(); - } - - await Task.CompletedTask; - } - - /// - /// Initiates a session - /// - internal async Task BeginSessionAsync() - { - Log.Debug("[SessionCountlyService] BeginSessionAsync"); - - if (!_consentService.CheckConsentInternal(Consents.Sessions)) - { - return; - } - - if (IsSessionInitiated) - { - Log.Warning("[SessionCountlyService] BeginSessionAsync: The session has already started!"); - return; - } - - _lastSessionRequestTime = DateTime.Now; - //Session initiated - IsSessionInitiated = true; - - Dictionary requestParams = new Dictionary(); - requestParams.Add("begin_session", 1); - - /* If location is disabled or no location consent is given, - the SDK adds an empty location entry to every "begin_session" request. */ - if (_locationService.IsLocationDisabled || !_consentService.CheckConsentInternal(Consents.Location)) - { - requestParams.Add("location", string.Empty); - } - else - { - if (!string.IsNullOrEmpty(_locationService.IPAddress)) - { - requestParams.Add("ip_address", _locationService.IPAddress); - } - - if (!string.IsNullOrEmpty(_locationService.CountryCode)) - { - requestParams.Add("country_code", _locationService.CountryCode); - } - - if (!string.IsNullOrEmpty(_locationService.City)) - { - requestParams.Add("city", _locationService.City); - } - - if (!string.IsNullOrEmpty(_locationService.Location)) - { - requestParams.Add("location", _locationService.Location); - } - } - - string metricsJSON = _configuration.metricHelper.buildMetricJSON(); - requestParams.Add("metrics", metricsJSON); - - _requestCountlyHelper.AddToRequestQueue(requestParams); - await _requestCountlyHelper.ProcessQueue(); - } - - /// - /// Ends a session - /// - internal async Task EndSessionAsync() - { - Log.Debug("[SessionCountlyService] EndSessionAsync"); - - if (!_consentService.CheckConsentInternal(Consents.Sessions)) - { - return; - } - - if (!IsSessionInitiated) - { - Log.Warning("[SessionCountlyService] EndSessionAsync: The session isn't started yet!"); - return; - } - - IsSessionInitiated = false; - _eventService.AddEventsToRequestQueue(); - // Countly.Instance.UserProfile.Save(); - Dictionary requestParams = new Dictionary - { - {"end_session", 1}, - {"session_duration", Convert.ToInt32((DateTime.Now - _lastSessionRequestTime).TotalSeconds)} - }; - - _requestCountlyHelper.AddToRequestQueue(requestParams); - await _requestCountlyHelper.ProcessQueue(); - } - - /// - /// Extends a session by another session duration provided in configuration. By default session duration is 60 seconds. - /// - internal async Task ExtendSessionAsync() - { - Log.Debug("[SessionCountlyService] ExtendSessionAsync"); - - if (!_consentService.CheckConsentInternal(Consents.Sessions)) - { - return; - } - - if (!IsSessionInitiated) - { - Log.Warning("[SessionCountlyService] ExtendSessionAsync: The session isn't started yet!"); - return; - } - - Dictionary requestParams = new Dictionary - { - { - "session_duration", Convert.ToInt32((DateTime.Now - _lastSessionRequestTime).TotalSeconds) - } - }; - - _lastSessionRequestTime = DateTime.Now; - - _requestCountlyHelper.AddToRequestQueue(requestParams); - await _requestCountlyHelper.ProcessQueue(); - -#if UNITY_WEBGL - _monoBehaviour.StartCoroutine(SessionTimerCoroutine()); -#endif - } - - #region override Methods - internal override async void ConsentChanged(List updatedConsents, bool newConsentValue, ConsentChangedAction action) - { - if (updatedConsents.Contains(Consents.Sessions) && newConsentValue) - { - if (!_configuration.IsAutomaticSessionTrackingDisabled) - { - IsSessionInitiated = false; - await BeginSessionAsync(); - } - } - } - #endregion - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/SessionCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/SessionCountlyService.cs.meta deleted file mode 100644 index 76b989516..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/SessionCountlyService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d77293e485014fb1a0e8e2faf28cf737 -timeCreated: 1558166452 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/StarRatingCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/StarRatingCountlyService.cs deleted file mode 100644 index 40175e3d9..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/StarRatingCountlyService.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Models; - -namespace Plugins.CountlySDK.Services -{ - public class StarRatingCountlyService : AbstractBaseService - { - internal readonly EventCountlyService _eventCountlyService; - - internal StarRatingCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, ConsentCountlyService consentService, EventCountlyService eventCountlyService) : base(configuration, logHelper, consentService) - { - Log.Debug("[StarRatingCountlyService] Initializing."); - - _eventCountlyService = eventCountlyService; - } - - #region override Methods - #endregion - - - /// - /// Sends app rating to the server. - /// - /// name of platform - /// the current version of the app - /// value from 1 to 5 that will be set as the rating value - /// - public async Task ReportStarRatingAsync(string platform, string appVersion, int rating) - { - lock (LockObj) - { - Log.Info("[StarRatingCountlyService] ReportStarRatingAsync"); - - if (!_consentService.CheckConsentInternal(Consents.StarRating)) - { - return; - } - - if (string.IsNullOrEmpty(platform) || string.IsNullOrWhiteSpace(platform)) - { - Log.Warning("[StarRatingCountlyService] ReportStarRatingAsync : The platform name'" + platform + "'isn't valid."); - return; - } - - if (string.IsNullOrEmpty(appVersion) || string.IsNullOrWhiteSpace(appVersion)) - { - Log.Warning("[StarRatingCountlyService] ReportStarRatingAsync : The appVersion '" + appVersion + "'isn't valid."); - return; - } - - if (rating < 1 || rating > 5) - { - Log.Warning("[StarRatingCountlyService] ReportStarRatingAsync : The rating value'" + rating + "'isn't valid."); - return; - } - - StarRatingSegment segment = - new StarRatingSegment - { - Platform = platform, - AppVersion = appVersion, - Rating = rating, - }; - - CountlyEventModel eventModel = new CountlyEventModel(CountlyEventModel.StarRatingEvent, segment.ToDictionary(), null, null, null); - _ = _eventCountlyService.RecordEventAsync(eventModel); - } - - await Task.CompletedTask; - } - - - /// - /// Custom Segmentation for Star Rating event. - /// - [Serializable] - struct StarRatingSegment - { - public string Platform { get; set; } - public string AppVersion { get; set; } - public int Rating { get; set; } - - public IDictionary ToDictionary() - { - return new Dictionary() - { - {"platform", Platform}, - {"app_version", AppVersion}, - {"rating", Rating}, - }; - } - - } - - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/StarRatingCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/StarRatingCountlyService.cs.meta deleted file mode 100644 index 8306a0e24..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/StarRatingCountlyService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9fc426533bc643cf992366b6c4e4a30a -timeCreated: 1558167990 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/UserDetailsCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/UserDetailsCountlyService.cs deleted file mode 100644 index 51845e627..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/UserDetailsCountlyService.cs +++ /dev/null @@ -1,412 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; - -namespace Plugins.CountlySDK.Services -{ - public class UserDetailsCountlyService : AbstractBaseService - { - internal Dictionary CustomDataProperties { get; private set; } - - private readonly CountlyUtils _countlyUtils; - internal readonly RequestCountlyHelper _requestCountlyHelper; - internal UserDetailsCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, RequestCountlyHelper requestCountlyHelper, CountlyUtils countlyUtils, ConsentCountlyService consentService) : base(configuration, logHelper, consentService) - { - Log.Debug("[UserDetailsCountlyService] Initializing."); - - _countlyUtils = countlyUtils; - _requestCountlyHelper = requestCountlyHelper; - CustomDataProperties = new Dictionary(); - } - - /// - /// Add user custom detail to request queue. - /// - /// - private void AddCustomDetailToRequestQueue(IDictionary segments) - { - - IDictionary customDetail = FixSegmentKeysAndValues(segments); - - Dictionary requestParams = - new Dictionary - { - { "user_details", - JsonConvert.SerializeObject( - new Dictionary - { - { "custom", customDetail } - }) - } - }; - _requestCountlyHelper.AddToRequestQueue(requestParams); - _ = _requestCountlyHelper.ProcessQueue(); - } - - /// - /// Sets information about user. - /// - /// User Model with the specified params - /// - public async Task SetUserDetailsAsync(CountlyUserDetailsModel userDetailsModel) - { - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] SetUserDetailsAsync " + (userDetailsModel != null)); - - if (!_consentService.CheckConsentInternal(Consents.Users)) - { - return; - } - - if (userDetailsModel == null) - { - Log.Warning("[UserDetailsCountlyService] SetUserDetailsAsync : The parameter 'userDetailsModel' can't be null."); - return; - } - - if (!_countlyUtils.IsPictureValid(userDetailsModel.PictureUrl)) - { - Log.Warning($"[UserDetailsCountlyService] SetUserDetailAsync: Picture format for URL '{userDetailsModel.PictureUrl}' is not as expected. Expected formats are .png, .gif, or .jpeg"); - } - - - userDetailsModel.Name = TrimValue("Name", userDetailsModel.Name); - userDetailsModel.Phone = TrimValue("Phone", userDetailsModel.Phone); - userDetailsModel.Email = TrimValue("Email", userDetailsModel.Email); - userDetailsModel.Gender = TrimValue("Gender", userDetailsModel.Gender); - userDetailsModel.Username = TrimValue("Username", userDetailsModel.Username); - userDetailsModel.BirthYear = TrimValue("BirthYear", userDetailsModel.BirthYear); - userDetailsModel.Organization = TrimValue("Organization", userDetailsModel.Organization); - - if (userDetailsModel.PictureUrl != null && userDetailsModel.PictureUrl.Length > 4096) - { - Log.Warning("[" + GetType().Name + "] TrimValue : Max allowed length of 'PictureUrl' is " + _configuration.MaxValueSize); - userDetailsModel.PictureUrl = userDetailsModel.PictureUrl.Substring(0, 4096); - } - - userDetailsModel.Custom = FixSegmentKeysAndValues(userDetailsModel.Custom); - Dictionary requestParams = - new Dictionary - { - { "user_details", JsonConvert.SerializeObject(userDetailsModel, Formatting.Indented, - new JsonSerializerSettings{ NullValueHandling = NullValueHandling.Ignore }) }, - }; - - _requestCountlyHelper.AddToRequestQueue(requestParams); - _ = _requestCountlyHelper.ProcessQueue(); - } - - await Task.CompletedTask; - } - /// - /// Sets information about user with custom properties. - /// In custom properties you can provide any string key values to be stored with user. - /// - /// User custom detail - /// - public void SetCustomUserDetails(Dictionary customDetail) - { - Log.Info("[UserDetailsCountlyService] SetCustomUserDetails " + (customDetail != null)); - - if (!_consentService.CheckConsentInternal(Consents.Users)) - { - return; - } - - if (customDetail == null || customDetail.Count == 0) - { - Log.Warning("[UserDetailsCountlyService] SetCustomUserDetails : Provided custom detail 'customDetail' can't be null or empty."); - - return; - } - - AddCustomDetailToRequestQueue(customDetail); - } - - /// - /// Send provided values to server. - /// - /// - public async Task SaveAsync() - { - lock (LockObj) - { - if (!CustomDataProperties.Any()) - { - return; - } - - Log.Info("[UserDetailsCountlyService] SaveAsync"); - - - CountlyUserDetailsModel model = new CountlyUserDetailsModel(CustomDataProperties); - - CustomDataProperties = new Dictionary { }; - AddCustomDetailToRequestQueue(CustomDataProperties); - } - await Task.CompletedTask; - } - - - /// - /// Sets custom provide key/value as custom property. - /// - /// string with key for the property - /// string with value for the property - public void Set(string key, string value) - { - - if (string.IsNullOrEmpty(key)) - { - Log.Warning("[UserDetailsCountlyService] Set : key '" + key + "'isn't valid."); - - return; - } - - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] Set : key = " + key + ", value = " + value); - - AddToCustomData(key, TrimValue(key, value)); - } - } - - /// - /// Set value only if property does not exist yet. - /// - /// string with property name to set - /// string value to set - public void SetOnce(string key, string value) - { - if (string.IsNullOrEmpty(key)) - { - Log.Warning("[UserDetailsCountlyService] SetOnce : key '" + key + "'isn't valid."); - - return; - } - - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] SetOnce : key = " + key + ", value = " + value); - - AddToCustomData(key, new Dictionary { { "$setOnce", TrimValue(key, value) } }); - } - } - - /// - /// Increment custom property value by 1. - /// - /// string with property name to increment - public void Increment(string key) - { - if (string.IsNullOrEmpty(key)) - { - Log.Warning("[UserDetailsCountlyService] Increment : key '" + key + "'isn't valid."); - - return; - } - - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] Increment : key = " + key); - - AddToCustomData(key, new Dictionary { { "$inc", 1 } }); - } - } - - /// - /// Increment custom property value by provided value. - /// - /// string with property name to increment - /// double value by which to increment - public void IncrementBy(string key, double value) - { - if (string.IsNullOrEmpty(key)) - { - Log.Warning("[UserDetailsCountlyService] IncrementBy : key '" + key + "'isn't valid."); - - return; - } - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] IncrementBy : key = " + key + ", value = " + value); - - AddToCustomData(key, new Dictionary { { "$inc", value } }); - } - } - - /// - /// Multiply custom property value by provided value. - /// - /// string with property name to multiply - /// double value by which to multiply - public void Multiply(string key, double value) - { - if (string.IsNullOrEmpty(key)) - { - Log.Warning("[UserDetailsCountlyService] Multiply : key '" + key + "'isn't valid."); - - return; - } - - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] Multiply : key = " + key + ", value = " + value); - - AddToCustomData(key, new Dictionary { { "$mul", value } }); - } - } - - /// - /// Save maximal value between existing and provided. - /// - /// String with property name to check for max - /// double value to check for max - public void Max(string key, double value) - { - if (string.IsNullOrEmpty(key)) - { - Log.Warning("[UserDetailsCountlyService] Max : key '" + key + "'isn't valid."); - - return; - } - - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] Max : key = " + key + ", value = " + value); - - AddToCustomData(key, new Dictionary { { "$max", value } }); - } - } - - /// - /// Save minimal value between existing and provided. - /// - /// string with property name to check for min - /// double value to check for min - public void Min(string key, double value) - { - if (string.IsNullOrEmpty(key)) - { - Log.Warning("[UserDetailsCountlyService] Min : key '" + key + "'isn't valid."); - - return; - } - - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] Min : key = " + key + ", value = " + value); - - AddToCustomData(key, new Dictionary { { "$min", value } }); - } - } - - /// - /// Create array property, if property does not exist and add value to array - /// You can only use it on array properties or properties that do not exist yet. - /// - /// string with property name for array property - /// array with values to add - public void Push(string key, string[] value) - { - if (string.IsNullOrEmpty(key)) - { - Log.Warning("[UserDetailsCountlyService] Push : key '" + key + "'isn't valid."); - - return; - } - - - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] Push : key = " + key + ", value = " + value); - - AddToCustomData(key, new Dictionary { { "$push", TrimValues(value) } }); - } - } - - /// - /// Create array property, if property does not exist and add value to array, only if value is not yet in the array - /// You can only use it on array properties or properties that do not exist yet. - /// - /// string with property name for array property - /// array with values to add - public void PushUnique(string key, string[] value) - { - if (string.IsNullOrEmpty(key)) - { - Log.Warning("[UserDetailsCountlyService] PushUnique : key '" + key + "'isn't valid."); - - return; - } - - - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] PushUnique : key = " + key + ", value = " + value); - AddToCustomData(key, new Dictionary { { "$addToSet", TrimValues(value) } }); - } - } - - /// - /// Create array property, if property does not exist and remove value from array. - /// - /// String with property name for array property - /// array with values to remove from array - public void Pull(string key, string[] value) - { - if (string.IsNullOrEmpty(key)) - { - Log.Warning("[UserDetailsCountlyService] Pull : key '" + key + "'isn't valid."); - - return; - } - - lock (LockObj) - { - Log.Info("[UserDetailsCountlyService] Pull : key = " + key + ", value = " + value); - - value = TrimValues(value); - AddToCustomData(key, new Dictionary { { "$pull", value } }); - } - } - - - /// - /// Create a property - /// - /// property name - /// property value - private void AddToCustomData(string key, object value) - { - Log.Debug("[UserDetailsCountlyService] AddToCustomData: " + key + ", " + value); - - if (!_consentService.CheckConsentInternal(Consents.Users)) - { - return; - } - - key = TrimKey(key); - - if (CustomDataProperties.ContainsKey(key)) - { - string item = CustomDataProperties.Select(x => x.Key).FirstOrDefault(x => x.Equals(key, StringComparison.OrdinalIgnoreCase)); - if (item != null) - { - CustomDataProperties.Remove(item); - } - } - - CustomDataProperties.Add(key, value); - } - - #region override Methods - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/UserDetailsCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/UserDetailsCountlyService.cs.meta deleted file mode 100644 index 271229e44..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/UserDetailsCountlyService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 82059bc884b140ce80eb5a8f9cc0249a -timeCreated: 1558168052 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ViewCountlyService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ViewCountlyService.cs deleted file mode 100644 index 44aba129a..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ViewCountlyService.cs +++ /dev/null @@ -1,181 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using UnityEngine; - -namespace Plugins.CountlySDK.Services -{ - - public class ViewCountlyService : AbstractBaseService - { - internal bool _isFirstView = true; - internal readonly EventCountlyService _eventService; - private readonly Dictionary _viewToLastViewStartTime = new Dictionary(); - - internal ViewCountlyService(CountlyConfiguration configuration, CountlyLogHelper logHelper, EventCountlyService eventService, ConsentCountlyService consentService) : base(configuration, logHelper, consentService) - { - Log.Debug("[ViewCountlyService] Initializing."); - - _eventService = eventService; - } - /// - /// Start tracking a view - /// - /// name of the view - /// - public async Task RecordOpenViewAsync(string name, IDictionary segmentation = null) - { - lock (LockObj) - { - Log.Info("[ViewCountlyService] RecordOpenViewAsync : name = " + name); - - if (!_consentService.CheckConsentInternal(Consents.Views)) - { - return; - } - - if (string.IsNullOrEmpty(name)) - { - return; - } - - if (name.Length > _configuration.MaxKeyLength) - { - Log.Verbose("[ViewCountlyService] RecordOpenViewAsync : Max allowed key length is " + _configuration.MaxKeyLength); - name = name.Substring(0, _configuration.MaxKeyLength); - } - - IDictionary openViewSegment = new Dictionary - { - {"name", name}, - {"segment", _configuration.metricHelper.OS}, - {"visit", 1}, - {"start", _isFirstView ? 1 : 0} - }; - - if (segmentation != null) - { - segmentation = RemoveSegmentInvalidDataTypes(segmentation); - segmentation = FixSegmentKeysAndValues(segmentation); - - foreach (KeyValuePair item in openViewSegment) - { - segmentation[item.Key] = item.Value; - } - } - else - { - segmentation = openViewSegment; - } - - if (!_viewToLastViewStartTime.ContainsKey(name)) - { - _viewToLastViewStartTime.Add(name, DateTime.UtcNow); - } - - CountlyEventModel currentView = new CountlyEventModel(CountlyEventModel.ViewEvent, segmentation); - _ = _eventService.RecordEventAsync(currentView); - - _isFirstView = false; - } - - await Task.CompletedTask; - } - - /// - /// Stop tracking a view - /// - /// - /// - //TODO: this performs in a non standard way. It should only be possible to close started views. - public async Task RecordCloseViewAsync(string name) - { - lock (LockObj) - { - Log.Info("[ViewCountlyService] RecordCloseViewAsync : name = " + name); - - if (!_consentService.CheckConsentInternal(Consents.Views)) - { - return; - } - - if (string.IsNullOrEmpty(name)) - { - return; - } - - if (name.Length > _configuration.MaxKeyLength) - { - Log.Verbose("[ViewCountlyService] RecordCloseViewAsync : Max allowed key length is " + _configuration.MaxKeyLength); - name = name.Substring(0, _configuration.MaxKeyLength); - } - - double? duration = null; - if (_viewToLastViewStartTime.ContainsKey(name)) - { - DateTime lastViewStartTime = _viewToLastViewStartTime[name]; - duration = (DateTime.UtcNow - lastViewStartTime).TotalSeconds; - - _viewToLastViewStartTime.Remove(name); - } - - IDictionary segment = new Dictionary - { - {"name", name}, - {"segment", _configuration.metricHelper.OS}, - }; - - CountlyEventModel currentView = new CountlyEventModel(CountlyEventModel.ViewEvent, segment, 1, null, duration); - _ = _eventService.RecordEventAsync(currentView); - } - await Task.CompletedTask; - } - - /// - /// Reports a particular action with the specified details - /// - /// type of action - /// x-coordinate - /// y-coordinate - /// width of screen - /// height of screen - /// - public async Task ReportActionAsync(string type, int x, int y, int width, int height) - { - lock (LockObj) - { - Log.Info("[ViewCountlyService] ReportActionAsync : type = " + type + ", x = " + x + ", y = " + y + ", width = " + width + ", height = " + height); - - if (!_consentService.CheckConsentInternal(Consents.Views)) - { - return; - } - - IDictionary segmentation = new Dictionary() - { - {"type", type}, - {"x", x}, - {"y", y}, - {"width", width}, - {"height", height}, - }; - CountlyEventModel currentView = new CountlyEventModel(CountlyEventModel.ViewActionEvent, segmentation); - _ = _eventService.RecordEventAsync(currentView); - } - await Task.CompletedTask; - } - - #region override Methods - internal override void DeviceIdChanged(string deviceId, bool merged) - { - if (!merged) - { - _isFirstView = true; - } - } - #endregion - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ViewCountlyService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ViewCountlyService.cs.meta deleted file mode 100644 index d9838a9c0..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/CountlySDK/Services/ViewCountlyService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: fc5d108d3fe148e4ac4e4bc72cf05c3d -timeCreated: 1558167957 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Editor/CountlyEditorMenu.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Editor/CountlyEditorMenu.cs deleted file mode 100644 index c3d746846..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Editor/CountlyEditorMenu.cs +++ /dev/null @@ -1,13 +0,0 @@ -using UnityEngine; -using UnityEditor; - -#if UNITY_EDITOR -public class CountlyEditorMenu -{ - [MenuItem("Countly/SDK Documentation")] - private static void SDKDocumentation() - { - Application.OpenURL("https://support.count.ly/hc/en-us/articles/360037813851-Unity"); - } -} -#endif diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Editor/CountlyEditorMenu.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Editor/CountlyEditorMenu.cs.meta deleted file mode 100644 index 74843ca03..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Editor/CountlyEditorMenu.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 32c4e32b3d5203f439cd9e0d550fb7c5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/INotificationsService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/INotificationsService.cs deleted file mode 100644 index bcc93a22b..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/INotificationsService.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Plugins.CountlySDK.Helpers; -using System; -using System.Threading.Tasks; - -namespace Notifications -{ - public interface INotificationsService - { - bool IsInitializedWithoutError { get; set; } - void GetToken(Action result); - void OnNotificationClicked(Action result); - void OnNotificationReceived(Action result); - Task ReportPushActionAsync(); - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/INotificationsService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/INotificationsService.cs.meta deleted file mode 100644 index 9cb16b543..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/INotificationsService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 164a5816f19145c2b1f4133e7db7c481 -timeCreated: 1558805383 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidBridge.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidBridge.cs deleted file mode 100644 index 548c743ab..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidBridge.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Newtonsoft.Json.Linq; -using Plugins.CountlySDK.Models; -using System; -using UnityEngine; - -namespace Notifications.Impls.Android -{ - public class AndroidBridge : MonoBehaviour - { - private Action _onTokenResult; - private Action _OnNotificationReceiveResult; - private Action _OnNotificationClickResult; - - public CountlyLogHelper Log { get; set; } - - public void ListenTokenResult(Action result) => _onTokenResult = result; - public void ListenReceiveResult(Action result) => _OnNotificationReceiveResult = result; - public void ListenClickResult(Action result) => _OnNotificationClickResult = result; - - - private void Awake() - { - DontDestroyOnLoad(gameObject); - } - - public void OnTokenResult(string token) - { - _onTokenResult?.Invoke(token); - Log.Debug("[AndroidBridge] AndroidBridge Firebase token: " + token); - - } - - public void OnNotificationReceived(string data) - { - _OnNotificationReceiveResult?.Invoke(data); - Log.Debug("[AndroidBridge] onMessageReceived"); - - } - - public void OnNotificationClicked(string data) - { - int index = 0; - - JObject jObject = JObject.Parse(data); - - if (jObject != null) - { - index = (int)jObject.GetValue("click_index"); - } - _OnNotificationClickResult?.Invoke(data, index); - Log.Debug("[AndroidBridge] OnNotificationClicked"); - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidBridge.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidBridge.cs.meta deleted file mode 100644 index 337c0f55c..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidBridge.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 004a2bc839324d6ea50ae41214158219 -timeCreated: 1558980070 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidNotificationsService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidNotificationsService.cs deleted file mode 100644 index b6a7ffd56..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidNotificationsService.cs +++ /dev/null @@ -1,140 +0,0 @@ -using Newtonsoft.Json.Linq; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Services; -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading.Tasks; -using UnityEngine; - -namespace Notifications.Impls.Android -{ - public class AndroidNotificationsService : INotificationsService - { - private readonly Transform _countlyGameObject; - private const string BridgeName = "[Android] Bridge"; - private const string StorePackageName = "ly.count.unity.push_fcm.MessageStore"; - private const string CountlyPushPluginPackageName = "ly.count.unity.push_fcm.CountlyPushPlugin"; - private const string NotficationServicePackageName = "ly.count.unity.push_fcm.RemoteNotificationsService"; - - private readonly CountlyLogHelper Log; - private readonly AndroidBridge _bridge; - private readonly EventCountlyService _eventCountlyService; - - public bool IsInitializedWithoutError { get; set; } - - internal AndroidNotificationsService(Transform countlyGameObject, CountlyConfiguration config, CountlyLogHelper log, EventCountlyService eventCountlyService) - { - Log = log; - - Log.Debug("[AndroidNotificationsService] Initializing."); - - _countlyGameObject = countlyGameObject; - _eventCountlyService = eventCountlyService; - - GameObject gameObject = new GameObject(BridgeName); - gameObject.transform.parent = _countlyGameObject; - _bridge = gameObject.AddComponent(); - _bridge.Log = Log; - - try - { - AndroidJavaClass countlyPushPlugin = new AndroidJavaClass(CountlyPushPluginPackageName); - countlyPushPlugin.CallStatic("setEnableLog", config.EnableConsoleLogging); - IsInitializedWithoutError = true; - } - catch (Exception ex) - { - Log.Error("[AndroidNotificationsService] Exception in initializing service: " + ex.Message); - IsInitializedWithoutError = false; - } - } - - public void GetToken(Action result) - { - - Log.Debug("[AndroidNotificationsService] GetToken"); - -#if !UNITY_EDITOR - _bridge.ListenTokenResult(result); - - using (AndroidJavaObject jc = new AndroidJavaObject(NotficationServicePackageName)) { - jc.Call("getToken"); - } -#endif - } - - public void OnNotificationClicked(Action result) - { - Log.Debug("[AndroidNotificationsService] OnNotificationClicked"); - - _bridge.ListenClickResult(result); - } - - public void OnNotificationReceived(Action result) - { - Log.Debug("[AndroidNotificationsService] OnNotificationReceived"); - - _bridge.ListenReceiveResult(result); - } - - public async Task ReportPushActionAsync() - { - Log.Debug("[AndroidNotificationsService] ReportPushActionAsync"); - - AndroidJavaClass store = new AndroidJavaClass(StorePackageName); - - bool isInitialized = store.CallStatic("isInitialized"); - if (!isInitialized) - { - AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); - AndroidJavaObject activity = unityPlayer.GetStatic("currentActivity"); - AndroidJavaObject applicationContext = activity.Call("getApplicationContext"); - - store.CallStatic("init", applicationContext); - } - - string data = store.CallStatic("getMessagesData"); - if (string.IsNullOrEmpty(data)) - { - return new CountlyResponse - { - IsSuccess = false, - ErrorMessage = "Key is required." - }; - } - - JArray jArray = JArray.Parse(data); - - if (jArray != null) - { - foreach (JObject item in jArray) - { - string mesageId = item.GetValue("messageId").ToString(); - string identifier = item.GetValue("action_index").ToString(); - Dictionary segment = new Dictionary() - { - {"b", mesageId}, - {"i", identifier}, - {"p", "a"} - }; - - Log.Debug("[AndroidNotificationsService] ReportPushActionAsync key: " + CountlyEventModel.PushActionEvent + ", segments: " + segment); - - - CountlyEventModel eventModel = new CountlyEventModel(CountlyEventModel.PushActionEvent, segment); - await _eventCountlyService.RecordEventAsync(eventModel); - } - - store.CallStatic("clearMessagesData"); - - } - - return new CountlyResponse - { - IsSuccess = true, - }; - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidNotificationsService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidNotificationsService.cs.meta deleted file mode 100644 index 9b7f8d348..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/Android/AndroidNotificationsService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: fc5fd451b33c4a8883272fa90c273ac7 -timeCreated: 1558804290 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/NotificationsCallbackService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/NotificationsCallbackService.cs deleted file mode 100644 index cfe6fe5c8..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/NotificationsCallbackService.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Services; -using UnityEngine; - -namespace Notifications -{ - public class NotificationsCallbackService - { - CountlyLogHelper _logHelper; - private readonly List _listeners; - internal NotificationsCallbackService(CountlyConfiguration configuration, CountlyLogHelper logHelper) - { - _logHelper = logHelper; - _logHelper.Debug("[NotificationsCallbackService] Initializing."); - _listeners = configuration.NotificationEventListeners.Distinct().ToList(); - } - - /// - /// Add Notification listener. - /// - /// - public void AddListener(INotificationListener listener) - { - if (_listeners.Contains(listener)) - { - return; - } - - _listeners.Add(listener); - - _logHelper.Debug("[NotificationsCallbackService] AddListener: " + listener); - } - /// - /// Remove Notification listener. - /// - /// - public void RemoveListener(INotificationListener listener) - { - if (!_listeners.Contains(listener)) - { - return; - } - - _listeners.Remove(listener); - _logHelper.Debug("[NotificationsCallbackService] RemoveListener: " + listener); - - } - - /// - /// Trigger listener's Notification Received event with payload of push notification. - /// - /// - internal void NotifyOnNotificationReceived(string data) - { - foreach (INotificationListener listener in _listeners) - { - if (listener != null) - { - listener.OnNotificationReceived(data); - } - } - - _logHelper.Debug("[NotificationsCallbackService] SendMessageToListeners: " + data); - - } - - /// - /// Trigger listener's Notification Clicked event with payload of push notification and action index. - /// - /// - /// - internal void NotifyOnNotificationClicked(string data, int index) - { - foreach (INotificationListener listener in _listeners) - { - if (listener != null) - { - listener.OnNotificationClicked(data, index); - } - } - - _logHelper.Debug("[NotificationsCallbackService] SendMessageToListeners: " + data); - } - } - - public interface INotificationListener - { - void OnNotificationReceived(string message); - void OnNotificationClicked(string message, int index); - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/NotificationsCallbackService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/NotificationsCallbackService.cs.meta deleted file mode 100644 index 687a0aaa7..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/NotificationsCallbackService.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 462a4f2a0083e784f87301dfd6f0ce86 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/ProxyNotificationsService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/ProxyNotificationsService.cs deleted file mode 100644 index 2a1daa41e..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/ProxyNotificationsService.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections; -using System.IO; -using System.Threading.Tasks; -using Plugins.CountlySDK.Enums; -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Services; -using UnityEngine; - -namespace Notifications.Impls -{ - public class ProxyNotificationsService : INotificationsService - { - private readonly CountlyLogHelper _logHelper; - private readonly Transform _countlyGameObject; - private readonly INotificationsService _service; - public bool IsInitializedWithoutError { get; set; } - - internal ProxyNotificationsService(Transform countlyGameObject, CountlyConfiguration config, CountlyLogHelper logHelper, Action startCoroutine, EventCountlyService eventCountlyService) - { - _logHelper = logHelper; - _logHelper.Debug("[ProxyNotificationsService] Initializing."); - - _countlyGameObject = countlyGameObject; - - if (config.NotificationMode == TestMode.None) - { - return; - } - -#if UNITY_ANDROID - _service = new Notifications.Impls.Android.AndroidNotificationsService(_countlyGameObject, config, logHelper, eventCountlyService); -#elif UNITY_IOS - _service = new Notifications.Impls.iOs.IOsNotificationsService(_countlyGameObject, config, logHelper, startCoroutine, eventCountlyService); -#endif - IsInitializedWithoutError = true; - if (_service != null && !_service.IsInitializedWithoutError) - { - _service = null; - IsInitializedWithoutError = false; - } - } - - public void GetToken(Action result) - { - _logHelper.Verbose("[ProxyNotificationsService] GetToken"); - - if (_service != null) - { - _service.GetToken(result); - } - - } - - public void OnNotificationClicked(Action result) - { - _logHelper.Verbose("[ProxyNotificationsService] OnNotificationClicked"); - - if (_service != null) - { - _service.OnNotificationClicked(result); - } - } - - - public void OnNotificationReceived(Action result) - { - _logHelper.Verbose("[ProxyNotificationsService] OnNotificationReceived"); - - if (_service != null) - { - _service.OnNotificationReceived(result); - } - } - - public async Task ReportPushActionAsync() - { - _logHelper.Verbose("[ProxyNotificationsService] ReportPushActionAsync"); - - if (_service != null) - { - return await _service.ReportPushActionAsync(); - } - - return new CountlyResponse - { - IsSuccess = true, - }; - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/ProxyNotificationsService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/ProxyNotificationsService.cs.meta deleted file mode 100644 index 01e256cb3..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/ProxyNotificationsService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 4fc63e171b0c4e4cac55de2533158c1a -timeCreated: 1558805531 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/IOSBridge.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/IOSBridge.cs deleted file mode 100644 index e85377684..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/IOSBridge.cs +++ /dev/null @@ -1,87 +0,0 @@ -using UnityEngine; -using System; -using Plugins.CountlySDK.Models; -using Newtonsoft.Json.Linq; - -public class IOSBridge : MonoBehaviour -{ - public string MessageId { get; set; } - public string ButtonIndex { get; set; } - - public CountlyLogHelper Log { get; set; } - - private Action _onTokenResult; - private Action _OnNotificationReceiveResult; - private Action _OnNotificationClickResult; - - public void ListenTokenResult(Action result) => _onTokenResult = result; - public void ListenReceiveResult(Action result) => _OnNotificationReceiveResult = result; - public void ListenClickResult(Action result) => _OnNotificationClickResult = result; - - private void Awake() - { - DontDestroyOnLoad(gameObject); - } - -#if !UNITY_EDITOR && COUNTLY_ENABLE_IOS_PUSH - [System.Runtime.InteropServices.DllImport("__Internal")] - extern static public void registerForRemoteNotifications(); -#endif - - public void GetToken() - { - -#if !UNITY_EDITOR && COUNTLY_ENABLE_IOS_PUSH - registerForRemoteNotifications(); -#endif - - } - - - //Sent when the application successfully registered with Apple Push Notification Service (APNS). - void OnDidRegisterForRemoteNotificationsWithDeviceToken(string deviceToken) - { - Log.Debug("[IOSBridge] OnDidRegisterForRemoteNotificationsWithDeviceToken Token: " + deviceToken); - - if (deviceToken != null && deviceToken.Length != 0) - { - _onTokenResult?.Invoke(deviceToken); - } - } - - //Sent when the application failed to be registered with Apple Push Notification Service (APNS). - void OnDidFailToRegisterForRemoteNotificcallBackationsWithError(string error) - { - Log.Debug("[IOSBridge] OnDidFailToRegisterForRemoteNotificcallBackationsWithError error: " + error); - - } - - - void OnPushNotificationsReceived(string pushData) - { - Log.Debug("[IOSBridge] OnPushNotificationsReceived: " + pushData); - - _OnNotificationReceiveResult?.Invoke(pushData); - - } - - void OnPushNotificationsClicked(string pushData) - { - Log.Debug("[IOSBridge] OnPushNotificationsClicked: " + pushData); - - JObject item = JObject.Parse(pushData); - - MessageId = (string)item["c"]["i"]; - ButtonIndex = (string)item["action_index"]; - - _OnNotificationClickResult?.Invoke(pushData, int.Parse(ButtonIndex)); - - } - - - void OnDidRegisterUserNotificationSettings(string setting) - { - Log.Debug("[IOSBridge] OnDidRegisterUserNotificationSettings error: " + setting); - } - -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/IOSBridge.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/IOSBridge.cs.meta deleted file mode 100644 index 776d5ea3c..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/IOSBridge.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5686c0ae3520a47bf9ada096663a8e6c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/iOsNotificationsService.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/iOsNotificationsService.cs deleted file mode 100644 index a250b3a65..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/iOsNotificationsService.cs +++ /dev/null @@ -1,91 +0,0 @@ -using Plugins.CountlySDK.Helpers; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Services; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; -using UnityEngine; - -namespace Notifications.Impls.iOs -{ - public class IOsNotificationsService : INotificationsService - { - private readonly CountlyLogHelper Log; - private readonly Transform _countlyGameObject; - private readonly Action _startCoroutine; - private readonly EventCountlyService _eventCountlyService; - public bool IsInitializedWithoutError { get; set; } - - private readonly IOSBridge _bridge; - private const string BridgeName = "[iOS] Bridge"; - - internal IOsNotificationsService(Transform countlyGameObject, CountlyConfiguration configuration, CountlyLogHelper log, Action startCoroutine, EventCountlyService eventCountlyService) - { - Log = log; - _startCoroutine = startCoroutine; - _countlyGameObject = countlyGameObject; - _eventCountlyService = eventCountlyService; - - GameObject gameObject = new GameObject(BridgeName); - gameObject.transform.parent = _countlyGameObject; - - _bridge = gameObject.AddComponent(); - _bridge.Log = log; - - IsInitializedWithoutError = true; - - } - - public void GetToken(Action result) - { - // _startCoroutine.Invoke(RequestAuthorization(result)); - _bridge.ListenTokenResult(result); - _bridge.GetToken(); - } - - public async Task ReportPushActionAsync() - { - string mesageId = _bridge.MessageId; - string identifier = _bridge.ButtonIndex; - - if (_bridge.MessageId != null) - { - IDictionary segment = new Dictionary() - { - {"b", mesageId}, - {"i", identifier}, - {"p", "i"} - }; - - Log.Debug("[IOsNotificationsService] ReportPushActionAsync key: " + CountlyEventModel.PushActionEvent + ", segments: " + segment); - - CountlyEventModel eventModel = new CountlyEventModel(CountlyEventModel.PushActionEvent, segment); - await _eventCountlyService.RecordEventAsync(eventModel); - } - - _bridge.MessageId = null; - _bridge.ButtonIndex = null; - - return new CountlyResponse - { - IsSuccess = true, - }; - } - - public void OnNotificationClicked(Action result) - { - Log.Debug("[IOsNotificationsService] OnNotificationClicked register"); - - _bridge.ListenClickResult(result); - - } - - public void OnNotificationReceived(Action result) - { - Log.Debug("[IOsNotificationsService] OnNotificationReceived register"); - _bridge.ListenReceiveResult(result); - - } - } -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/iOsNotificationsService.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/iOsNotificationsService.cs.meta deleted file mode 100644 index 75a147d66..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/Notifications/Impls/iOs/iOsNotificationsService.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d69e3d75acc447a9ab55ee580a6a3175 -timeCreated: 1565183242 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/PluginAssembly.asmdef b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/PluginAssembly.asmdef deleted file mode 100644 index efc01cdc4..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/PluginAssembly.asmdef +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "PluginAssembly", - "references": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/PluginAssembly.asmdef.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/PluginAssembly.asmdef.meta deleted file mode 100644 index 5664a3aba..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/PluginAssembly.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 1e69005fbbf5a4cd0a6c61596a74886e -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iBoxDB/Dao.cs b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iBoxDB/Dao.cs deleted file mode 100644 index cdf722fe5..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iBoxDB/Dao.cs +++ /dev/null @@ -1,142 +0,0 @@ -using iBoxDB.LocalServer; -using Plugins.CountlySDK.Models; -using Plugins.CountlySDK.Persistance.Entities; -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace Plugins.iBoxDB -{ - public class Dao where TEntity : class, IEntity, new() - { - protected readonly AutoBox Auto; - protected readonly string Table; - private readonly CountlyLogHelper Log; - - public Dao(AutoBox auto, string table, CountlyLogHelper log) - { - Auto = auto; - Table = table; - Log = log; - } - - public bool Save(TEntity entity) - { - try - { - bool insertionResult = Auto.Insert(Table, entity); - if (!insertionResult) - { - Log.Info("[Dao] Save: Auto.Insert result: [" + insertionResult + "]"); - } - return insertionResult; - } - catch (Exception ex) - { - Log.Error("[Dao] Save: Couldn't complete db operation, [" + ex.Message + "]"); - } - - return false; - } - - public bool Update(TEntity entity) - { - try - { - bool updateResult = Auto.Update(Table, entity); - if (!updateResult) - { - Log.Info("[Dao] Update: Auto.Update result: [" + updateResult + "]"); - } - return updateResult; - } - catch (Exception ex) - { - Log.Error("[Dao] Update: Couldn't complete db operation, [" + ex.Message + "]"); - } - - return false; - } - - public List LoadAll() - { - List result = new List(); - try - { - result = Auto.Select("from " + Table + " order by Id asc"); - if (result.Count == 0) - { - Log.Info("[Dao] LoadAll: Auto.Select result: [" + string.Join(", ", result) + "]"); - } - return result; - } - catch (Exception ex) - { - Log.Error("[Dao] LoadAll: Couldn't complete db operation, [" + ex.Message + "]"); - } - - return result; - } - - public void Remove(params object[] key) - { - try - { - bool deletionResult = Auto.Delete(Table, key); - if (!deletionResult) - { - Log.Info("[Dao] Remove: Auto.Delete result: [" + deletionResult + "]"); - } - } - catch (Exception ex) - { - Log.Error("[Dao] Remove: Couldn't complete db operation, [" + ex.Message + "]"); - } - } - - public void RemoveAll() - { - try - { - List list = Auto.Select("from " + Table); - if (list.Count == 0) - { - Log.Info("[Dao] RemoveAll: Auto.Select result: [" + string.Join(", ", list) + "]"); - } - foreach (TEntity entity in list) - { - bool deletionResult = Auto.Delete(Table, entity.GetId()); - if (!deletionResult) - { - Log.Info("[Dao] RemoveAll: Auto.Delete result: [" + deletionResult + "]"); - } - } - } - catch (Exception ex) - { - Log.Error("[Dao] RemoveAll: Couldn't complete db operation, [" + ex.Message + "]"); - } - } - - public long GenerateNewId() - { - long result; - try - { - result = Auto.NewId(); - if (result < 0) - { - Log.Info("[Dao] GenerateNewId: Auto.NewId result: [" + result + "]"); - } - return result; - } - catch (Exception ex) - { - result = 0; - Log.Error("[Dao] GenerateNewId: Couldn't complete db operation, [" + ex.Message + "]"); - } - - return result; - } - } -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iBoxDB/Dao.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iBoxDB/Dao.cs.meta deleted file mode 100644 index 2c4e845df..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iBoxDB/Dao.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: a21c26461e7d46e6ab92bfdf33202c0a -timeCreated: 1558447266 \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.h b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.h deleted file mode 100644 index 9886107bf..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.h +++ /dev/null @@ -1,24 +0,0 @@ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -extern NSString* const kCountlyActionIdentifier; - -extern NSString* const kCountlyPNKeyCountlyPayload; -extern NSString* const kCountlyPNKeyNotificationID; -extern NSString* const kCountlyPNKeyButtons; -extern NSString* const kCountlyPNKeyDefaultURL; -extern NSString* const kCountlyPNKeyAttachment; -extern NSString* const kCountlyPNKeyActionButtonIndex; -extern NSString* const kCountlyPNKeyActionButtonTitle; -extern NSString* const kCountlyPNKeyActionButtonURL; - -@interface CountlyNotificationService : NSObject -#if TARGET_OS_IOS -+ (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent *))contentHandler API_AVAILABLE(ios(10.0)); -#endif - -NS_ASSUME_NONNULL_END - -@end diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.h.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.h.meta deleted file mode 100644 index 6a41ecc89..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.h.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 341a46fdb94064f65935b32be09742bb -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: - AddToEmbeddedBinaries: false - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.m b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.m deleted file mode 100644 index c84ac9124..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.m +++ /dev/null @@ -1,120 +0,0 @@ -#import "CountlyNotificationService.h" - -#if DEBUG -#define COUNTLY_EXT_LOG(fmt, ...) NSLog([@"%@ " stringByAppendingString:fmt], @"[CountlyNSE]", ##__VA_ARGS__) -#else -#define COUNTLY_EXT_LOG(...) -#endif - -NSString* const kCountlyActionIdentifier = @"CountlyActionIdentifier"; -NSString* const kCountlyCategoryIdentifier = @"CountlyCategoryIdentifier"; - -NSString* const kCountlyPNKeyCountlyPayload = @"c"; -NSString* const kCountlyPNKeyNotificationID = @"i"; -NSString* const kCountlyPNKeyButtons = @"b"; -NSString* const kCountlyPNKeyDefaultURL = @"l"; -NSString* const kCountlyPNKeyAttachment = @"a"; -NSString* const kCountlyPNKeyActionButtonIndex = @"b"; -NSString* const kCountlyPNKeyActionButtonTitle = @"t"; -NSString* const kCountlyPNKeyActionButtonURL = @"l"; - -@implementation CountlyNotificationService -#if TARGET_OS_IOS -+ (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent *))contentHandler -{ - COUNTLY_EXT_LOG(@"didReceiveNotificationRequest:withContentHandler:"); - - NSDictionary* countlyPayload = request.content.userInfo[kCountlyPNKeyCountlyPayload]; - NSString* notificationID = countlyPayload[kCountlyPNKeyNotificationID]; - - if (!notificationID) - { - COUNTLY_EXT_LOG(@"Countly payload not found in notification dictionary!"); - - contentHandler(request.content); - return; - } - - COUNTLY_EXT_LOG(@"Checking for notification modifiers..."); - UNMutableNotificationContent* bestAttemptContent = request.content.mutableCopy; - - NSArray* buttons = countlyPayload[kCountlyPNKeyButtons]; - if (buttons.count) - { - COUNTLY_EXT_LOG(@"%d custom action buttons found.", (int)buttons.count); - - NSMutableArray* actions = NSMutableArray.new; - - [buttons enumerateObjectsUsingBlock:^(NSDictionary* button, NSUInteger idx, BOOL * stop) - { - NSString* actionIdentifier = [NSString stringWithFormat:@"%@%lu", kCountlyActionIdentifier, (unsigned long)idx + 1]; - UNNotificationAction* action = [UNNotificationAction actionWithIdentifier:actionIdentifier title:button[kCountlyPNKeyActionButtonTitle] options:UNNotificationActionOptionForeground]; - [actions addObject:action]; - }]; - - NSString* categoryIdentifier = [kCountlyCategoryIdentifier stringByAppendingString:notificationID]; - - UNNotificationCategory* category = [UNNotificationCategory categoryWithIdentifier:categoryIdentifier actions:actions intentIdentifiers:@[] options:UNNotificationCategoryOptionNone]; - - [UNUserNotificationCenter.currentNotificationCenter setNotificationCategories:[NSSet setWithObject:category]]; - - bestAttemptContent.categoryIdentifier = categoryIdentifier; - - COUNTLY_EXT_LOG(@"%d custom action buttons added.", (int)buttons.count); - } - - NSString* attachmentURL = countlyPayload[kCountlyPNKeyAttachment]; - if (!attachmentURL.length) - { - COUNTLY_EXT_LOG(@"No attachment specified in Countly payload."); - COUNTLY_EXT_LOG(@"Handling of notification finished."); - contentHandler(bestAttemptContent); - return; - } - - COUNTLY_EXT_LOG(@"Attachment specified in Countly payload: %@", attachmentURL); - - [[NSURLSession.sharedSession downloadTaskWithURL:[NSURL URLWithString:attachmentURL] completionHandler:^(NSURL * location, NSURLResponse * response, NSError * error) - { - if (!error) - { - COUNTLY_EXT_LOG(@"Attachment download completed!"); - - NSString* attachmentFileName = [NSString stringWithFormat:@"%@-%@", notificationID, response.suggestedFilename ?: response.URL.absoluteString.lastPathComponent]; - - NSString* tempPath = [NSTemporaryDirectory() stringByAppendingPathComponent:attachmentFileName]; - - if (location && tempPath) - { - [NSFileManager.defaultManager moveItemAtPath:location.path toPath:tempPath error:nil]; - - NSError* attachmentError = nil; - UNNotificationAttachment* attachment = [UNNotificationAttachment attachmentWithIdentifier:attachmentFileName URL:[NSURL fileURLWithPath:tempPath] options:nil error:&attachmentError]; - - if (attachment && !attachmentError) - { - bestAttemptContent.attachments = @[attachment]; - - COUNTLY_EXT_LOG(@"Attachment added to notification!"); - } - else - { - COUNTLY_EXT_LOG(@"Attachment creation error: %@", attachmentError); - } - } - else - { - COUNTLY_EXT_LOG(@"Attachment `location` and/or `tempPath` is nil!"); - } - } - else - { - COUNTLY_EXT_LOG(@"Attachment download error: %@", error); - } - - COUNTLY_EXT_LOG(@"Handling of notification finished."); - contentHandler(bestAttemptContent); - }] resume]; -} -#endif -@end diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.m.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.m.meta deleted file mode 100644 index fc8c1066d..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyNotificationService.m.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 72326c29947eb4e6199ffc8686933e35 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: - AddToEmbeddedBinaries: false - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.h b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.h deleted file mode 100644 index 27a0720d0..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.h +++ /dev/null @@ -1,14 +0,0 @@ - -#import - -#import - -@interface UIApplication(SupressWarnings) - -- (void)application:(UIApplication *)application countlydidRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings; -- (void)application:(UIApplication *)application countlydidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken; -- (void)application:(UIApplication *)application countlydidFailToRegisterForRemoteNotificationsWithError:(NSError *)err; -- (void)application:(UIApplication *)application countlydidReceiveRemoteNotification:(NSDictionary *)userInfo; - -- (BOOL)application:(UIApplication *)application countlydidFinishLaunchingWithOptions:(NSDictionary *)launchOptions; -@end diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.h.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.h.meta deleted file mode 100644 index 8bb7581df..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.h.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 157e082c4af974fada8300a38b2a9460 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: - AddToEmbeddedBinaries: false - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.m b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.m deleted file mode 100644 index 62af3051e..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.m +++ /dev/null @@ -1,348 +0,0 @@ -#import -#import "CountlyPushHandlerInternal.h" -#import - -NSString* const kCountlyPNKeyCountlyPayload = @"c"; -NSString* const kCountlyPNKeyNotificationID = @"i"; -NSString* const kCountlyPNKeyButtons = @"b"; -NSString* const kCountlyPNKeyDefaultURL = @"l"; -NSString* const kCountlyPNKeyAttachment = @"a"; -NSString* const kCountlyPNKeyActionButtonIndex = @"b"; -NSString* const kCountlyPNKeyActionButtonTitle = @"t"; -NSString* const kCountlyPNKeyActionButtonURL = @"l"; -NSString* const kCountlySavedPayload = @"saved_payload"; -NSString* const kCountlyActionIdentifier = @"CountlyActionIdentifier"; -NSString* const kCountlyCategoryIdentifier = @"CountlyCategoryIdentifier"; - - -@interface UIApplication(countlyPushHandlerInternal) - -@end - -char * listenerGameObject = "[iOS] Bridge"; - -void registerForRemoteNotifications() -{ - UIApplication *application = [UIApplication sharedApplication]; - // Register for Push Notitications, if running on iOS >= 8 - if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) - { - UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | - UIUserNotificationTypeBadge | - UIUserNotificationTypeSound); - UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes - categories:nil]; - [application registerUserNotificationSettings:settings]; - [application registerForRemoteNotifications]; - } - else - { - // Register for Push Notifications, if running iOS version < 8 - [application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | - UIRemoteNotificationTypeAlert | - UIRemoteNotificationTypeSound)]; - } - - // If App opened with Notification - NSString *savedPayload = [[NSUserDefaults standardUserDefaults] - stringForKey:kCountlySavedPayload]; - if (savedPayload != nil) { - [[NSUserDefaults standardUserDefaults] removeObjectForKey:kCountlySavedPayload]; - const char * payload = [savedPayload UTF8String]; - UnitySendMessage(listenerGameObject, "OnPushNotificationsClicked", payload); - } -} - -@implementation UIApplication(countlyPushHandlerInternal) - -+(void)load -{ - NSLog(@"%s",__FUNCTION__); - method_exchangeImplementations(class_getInstanceMethod(self, @selector(setDelegate:)), class_getInstanceMethod(self, @selector(setcountlyDelegate:))); -} - -BOOL countlyRunTimeDidFinishLaunching(id self, SEL _cmd, id application, id launchOptions) -{ - BOOL result = YES; - - if ([self respondsToSelector:@selector(application:countlydidFinishLaunchingWithOptions:)]) - { - result = (BOOL) [self application:application countlydidFinishLaunchingWithOptions:launchOptions]; - } - else - { - [self applicationDidFinishLaunching:application]; - result = YES; - } - - NSDictionary *notification =[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; - if (notification) { - NSError *error; - NSDictionary * payload = notification[kCountlyPNKeyCountlyPayload]; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:payload - options:NSJSONWritingPrettyPrinted - error:&error]; - if (jsonData != nil) - { - NSString *jsonString = nil; - jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - NSString *valueToSave = jsonString; - [[NSUserDefaults standardUserDefaults] setObject:valueToSave forKey:kCountlySavedPayload]; - [[NSUserDefaults standardUserDefaults] synchronize]; - } - } - - return result; -} - -void countlyRunTimeDidRegisterUserNotificationSettings(id self, SEL _cmd, id application, id notificationSettings) -{ - if ([self respondsToSelector:@selector(application:countlydidRegisterUserNotificationSettings:)]) - { - [self application:application countlydidRegisterUserNotificationSettings:notificationSettings]; - } - NSString *setting = @"DidRegisterUserNotificationSettings successfully"; - const char * str = [setting UTF8String]; - - UnitySendMessage(listenerGameObject, "OnDidRegisterUserNotificationSettings", str); -} - -void countlyRunTimeDidRegisterForRemoteNotificationsWithDeviceToken(id self, SEL _cmd, id application, id devToken) -{ - if ([self respondsToSelector:@selector(application:countlydidRegisterForRemoteNotificationsWithDeviceToken:)]) - { - [self application:application countlydidRegisterForRemoteNotificationsWithDeviceToken:devToken]; - } - - NSData * deviceToken = devToken; - const char* bytes = [devToken bytes]; - NSMutableString *token = NSMutableString.new; - for (NSUInteger i = 0; i < deviceToken.length; i++) - { - [token appendFormat:@"%02hhx", bytes[i]]; - } - - const char * str = [token UTF8String]; - UnitySendMessage(listenerGameObject, "OnDidRegisterForRemoteNotificationsWithDeviceToken", str); -} - -void countlyRunTimeDidFailToRegisterForRemoteNotificationsWithError(id self, SEL _cmd, id application, id error) -{ - if ([self respondsToSelector:@selector(application:countlydidFailToRegisterForRemoteNotificationsWithError:)]) - { - [self application:application countlydidFailToRegisterForRemoteNotificationsWithError:error]; - } - NSString *errorString = [error description]; - const char * str = [errorString UTF8String]; - UnitySendMessage(listenerGameObject, "OnDidFailToRegisterForRemoteNotificationsWithError", str); -} - -void countlyRunTimeDidReceiveRemoteNotification(id self, SEL _cmd, id application, id userInfo) -{ - if ([self respondsToSelector:@selector(application:countlydidReceiveRemoteNotification:)]) - { - [self application:application countlydidReceiveRemoteNotification:userInfo]; - } - - NSDictionary * notification = userInfo; - - id alert = notification[@"aps"][@"alert"]; - NSString* message = nil; - NSString* title = nil; - - if ([alert isKindOfClass:NSDictionary.class]) - { - message = alert[@"body"]; - title = alert[@"title"]; - } - else - { - message = (NSString*)alert; - title = [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"]; - } - - if (!message) - { - return; - } - - if (((UIApplication *)application).applicationState == UIApplicationStateActive) - { - // Nothing to do if applicationState is Inactive, the iOS already displayed an alert view. - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:message delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; - [alertView show]; - - } - - NSError *error; - NSDictionary* countlyPayload = userInfo[kCountlyPNKeyCountlyPayload]; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:countlyPayload - options:NSJSONWritingPrettyPrinted - error:&error]; - NSString *jsonString = nil; - if (! jsonData) - { - NSLog(@"Got an error: %@", error); - return; - } - - jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - const char * str = [jsonString UTF8String]; - UnitySendMessage(listenerGameObject, "OnPushNotificationsReceived", str); -} - - - -static void exchangeMethodImplementations(Class class, SEL oldMethod, SEL newMethod, IMP impl, const char * signature) -{ - Method method = nil; - //Check whether method exists in the class - method = class_getInstanceMethod(class, oldMethod); - - if (method) - { - //if method exists add a new method - class_addMethod(class, newMethod, impl, signature); - //and then exchange with original method implementation - method_exchangeImplementations(class_getInstanceMethod(class, oldMethod), class_getInstanceMethod(class, newMethod)); - } - else - { - //if method does not exist, simply add as orignal method - class_addMethod(class, oldMethod, impl, signature); - } -} - -- (void) setcountlyDelegate:(id)delegate -{ - - static Class delegateClass = nil; - - if(delegateClass == [delegate class]) - { - [self setcountlyDelegate:delegate]; - return; - } - - delegateClass = [delegate class]; - - - - exchangeMethodImplementations(delegateClass, @selector(application:didFinishLaunchingWithOptions:), - @selector(application:countlydidFinishLaunchingWithOptions:), (IMP)countlyRunTimeDidFinishLaunching, "v@:::"); - - exchangeMethodImplementations(delegateClass, @selector(application:didRegisterUserNotificationSettings:), - @selector(application:countlydidRegisterUserNotificationSettings:), (IMP)countlyRunTimeDidRegisterUserNotificationSettings, "v@:::"); - - exchangeMethodImplementations(delegateClass, @selector(application:didRegisterForRemoteNotificationsWithDeviceToken:), - @selector(application:countlydidRegisterForRemoteNotificationsWithDeviceToken:), (IMP)countlyRunTimeDidRegisterForRemoteNotificationsWithDeviceToken, "v@:::"); - - exchangeMethodImplementations(delegateClass, @selector(application:didFailToRegisterForRemoteNotificationsWithError:), - @selector(application:countlydidFailToRegisterForRemoteNotificationsWithError:), (IMP)countlyRunTimeDidFailToRegisterForRemoteNotificationsWithError, "v@:::"); - - exchangeMethodImplementations(delegateClass, @selector(application:didReceiveRemoteNotification:), - @selector(application:countlydidReceiveRemoteNotification:), (IMP)countlyRunTimeDidReceiveRemoteNotification, "v@:::"); - - if (@available(iOS 10.0, macOS 10.14, *)) - UNUserNotificationCenter.currentNotificationCenter.delegate = self; - [self setcountlyDelegate:delegate]; -} - -- (const char *)payloadToJsonString:(NSDictionary*)payload -{ - NSError *error; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:payload - options:NSJSONWritingPrettyPrinted - error:&error]; - NSString *jsonString = nil; - if (! jsonData) - { - NSLog(@"Got an error: %@", error); - return NULL; - } - - jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - const char * str = [jsonString UTF8String]; - - return str; -} - -- (void)onNotificationReceived:(NSDictionary*)payload -{ - const char * str = [self payloadToJsonString:payload]; - UnitySendMessage(listenerGameObject, "OnPushNotificationsReceived", str); -} - -- (void)onNotificationClick:(NSDictionary*)payload -{ - const char * str = [self payloadToJsonString:payload]; - UnitySendMessage(listenerGameObject, "OnPushNotificationsClicked", str); -} - -- (void)openUrl:(NSString *)URLString -{ - if (!URLString) - return; - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^ - { - [self openURL:[NSURL URLWithString:URLString]]; - }); -} - -- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler API_AVAILABLE(ios(10.0), macos(10.14)) -{ - NSDictionary* userInfo = notification.request.content.userInfo; - NSDictionary* countlyPayload = notification.request.content.userInfo[kCountlyPNKeyCountlyPayload]; - NSString* notificationID = countlyPayload[kCountlyPNKeyNotificationID]; - - if (notificationID) - completionHandler(UNNotificationPresentationOptionAlert); - - id appDelegate = (id)UIApplication.sharedApplication.delegate; - - if ([appDelegate respondsToSelector:@selector(userNotificationCenter:willPresentNotification:withCompletionHandler:)]) - [appDelegate userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler]; - else - completionHandler(UNNotificationPresentationOptionNone); - - [self onNotificationReceived:userInfo]; -} - -- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler API_AVAILABLE(ios(10.0), macos(10.14)) -{ - NSDictionary* userInfo = response.notification.request.content.userInfo; - NSDictionary* countlyPayload = userInfo[kCountlyPNKeyCountlyPayload]; - NSString* notificationID = countlyPayload[kCountlyPNKeyNotificationID]; - - if (notificationID) - { - int buttonIndex = 0; - NSString* URL = nil; - - if ([response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier]) - { - URL = countlyPayload[kCountlyPNKeyDefaultURL]; - } - else if ([response.actionIdentifier hasPrefix:kCountlyActionIdentifier]) - { - buttonIndex = [[response.actionIdentifier stringByReplacingOccurrencesOfString:kCountlyActionIdentifier withString:@""] intValue]; - URL = countlyPayload[kCountlyPNKeyButtons][buttonIndex - 1][kCountlyPNKeyActionButtonURL]; - } - - NSMutableDictionary *mutablePayload = [userInfo mutableCopy]; - - [mutablePayload setObject:[NSNumber numberWithInt:buttonIndex] forKey:@"action_index"]; - - [self onNotificationClick:mutablePayload]; - [self openUrl:URL]; - } - - id appDelegate = (id)UIApplication.sharedApplication.delegate; - - if ([appDelegate respondsToSelector:@selector(userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:)]) - [appDelegate userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler]; - else - completionHandler(); -} -@end diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.m.meta b/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.m.meta deleted file mode 100644 index 5a15629c8..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Plugins/Countly SDK/Plugins/iOS/CountlyPushHandlerInternal.m.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 59eb895887ba84d27afa48e1197514f2 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: - AddToEmbeddedBinaries: false - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/CountlyAnalytics.cs b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/CountlyAnalytics.cs deleted file mode 100644 index 2bd88b611..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/CountlyAnalytics.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; -using ChainSafe.Gaming.Web3.Core.Chains; -using Plugins.CountlySDK; -using Plugins.CountlySDK.Models; - -public class CountlyAnalytics : IAnalyticsClient -{ - private const string AppKey = "4d2f30cecf1b7e2b8cd909103c1fac971872aa3f"; - private const string ServerUrl = "https://chainsafe-40aca7b26551e.flex.countly.com"; - - private readonly IChainManager _chainManager; - - public async void CaptureEvent(AnalyticsEvent eventData) - { - await Countly.Instance.Events.RecordEventAsync(eventData.EventName); - } - - public string AnalyticsVersion => "2.6"; - public IChainConfig ChainConfig => _chainManager.Current; - - public CountlyAnalytics(IChainConfigSet chainConfigSet, IChainManager chainManager) - { - Countly.Instance.Init(new CountlyConfiguration(AppKey, ServerUrl)); - - _chainManager = chainManager; - - IChainConfig chainConfig = chainConfigSet.Configs.First(); - - var userDetails = new Dictionary - { - { "chainId", chainConfig.ChainId }, - { "rpc", chainConfig.Rpc }, - { "network", chainConfig.Network }, - { "analyticsVersion", AnalyticsVersion } - }; - - Countly.Instance.UserDetails.SetCustomUserDetails(userDetails); - } - -} diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/CountlyAnalytics.cs.meta b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/CountlyAnalytics.cs.meta deleted file mode 100644 index 981f09fed..000000000 --- a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/CountlyAnalytics.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 89910fdb76db9fc438737628295e62e0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigScriptableObject_Deprecated.cs b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigScriptableObject_Deprecated.cs index fc5541f92..4c849234e 100644 --- a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigScriptableObject_Deprecated.cs +++ b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigScriptableObject_Deprecated.cs @@ -13,7 +13,6 @@ public class ProjectConfigScriptableObject_Deprecated : ScriptableObject [SerializeField] private string rpc; [SerializeField] private string ws; [SerializeField] private string blockExplorerUrl; - [SerializeField] private bool enableAnalytics; public string Symbol { @@ -69,10 +68,6 @@ public string BlockExplorerUrl set => blockExplorerUrl = value; } - public bool EnableAnalytics - { - get => enableAnalytics; - set => enableAnalytics = value; - } + } } \ No newline at end of file diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigUtilities.cs b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigUtilities.cs index 5dd8f9a52..1672fb58e 100644 --- a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigUtilities.cs +++ b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/ProjectConfigUtilities.cs @@ -18,7 +18,7 @@ public static Web3ConfigAsset Load() return Create( "11155111", "Anvil", "Sepolia", "Seth", isWindowsEditor ? "http://127.0.0.1:8545" : "http://172.17.0.1:8545", - "https://sepolia.etherscan.io/", false, isWindowsEditor ? "ws://127.0.0.1:8545" : "ws://172.17.0.1:8545"); + "https://sepolia.etherscan.io/", isWindowsEditor ? "ws://127.0.0.1:8545" : "ws://172.17.0.1:8545"); } var projectConfig = Resources.Load(AssetName); @@ -26,11 +26,10 @@ public static Web3ConfigAsset Load() } public static Web3ConfigAsset Create(string chainId, string chain, string network, - string symbol, string rpc, string blockExplorerUrl, bool enableAnalytics, string ws = "") + string symbol, string rpc, string blockExplorerUrl, string ws = "") { var projectConfig = ScriptableObject.CreateInstance(); - projectConfig.EnableAnalytics = enableAnalytics; projectConfig.ChainConfigs = new List { new() diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/UnityEnvironmentExtension.cs b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/UnityEnvironmentExtension.cs index 103629d99..cb4776bde 100644 --- a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/UnityEnvironmentExtension.cs +++ b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/UnityEnvironmentExtension.cs @@ -1,5 +1,4 @@ using ChainSafe.Gaming.Unity; -using ChainSafe.Gaming.Web3.Analytics; using ChainSafe.Gaming.Web3.Build; using ChainSafe.Gaming.Web3.Core.Unity; using ChainSafe.Gaming.Web3.Environment; @@ -21,11 +20,6 @@ public static IWeb3ServiceCollection UseUnityEnvironment(this IWeb3ServiceCollec services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); -#if ENABLE_ANALYTICS - services.AddSingleton(); -#else - services.DisableAnalytics(); -#endif return services; } } diff --git a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Web3ConfigAsset.cs b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Web3ConfigAsset.cs index 7e470935c..fb7ec6c9a 100644 --- a/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Web3ConfigAsset.cs +++ b/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Web3ConfigAsset.cs @@ -8,7 +8,6 @@ namespace ChainSafe.Gaming [CreateAssetMenu(menuName = "ChainSafe/Project Configuration", fileName = "Web3Config", order = -100)] public class Web3ConfigAsset : ScriptableObject, IChainConfigSet { - [field: SerializeField] public bool EnableAnalytics { get; set; } = true; [field: SerializeField] public List ChainConfigs { get; set; } = new(); IEnumerable IChainConfigSet.Configs => ChainConfigs; diff --git a/src/ChainSafe.Gaming.Gelato/Gelato.cs b/src/ChainSafe.Gaming.Gelato/Gelato.cs index 0674b8b9e..d333d3da3 100644 --- a/src/ChainSafe.Gaming.Gelato/Gelato.cs +++ b/src/ChainSafe.Gaming.Gelato/Gelato.cs @@ -5,7 +5,6 @@ using ChainSafe.Gaming.Evm.Contracts; using ChainSafe.Gaming.Evm.Signers; using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; using ChainSafe.Gaming.Web3.Core; using ChainSafe.Gaming.Web3.Core.Chains; using ChainSafe.Gaming.Web3.Core.Evm; @@ -23,23 +22,21 @@ public class Gelato : IGelato, ILifecycleParticipant, IChainSwitchHandler private readonly ISigner signer; private readonly GelatoConfig config; private readonly IChainConfig chainConfig; - private readonly IAnalyticsClient analyticsClient; private bool gelatoDisabled; - public Gelato(IHttpClient httpClient, IChainConfig chainConfig, GelatoConfig config, ISigner signer, IContractBuilder contractBuilder, IAnalyticsClient analyticsClient) + public Gelato(IHttpClient httpClient, IChainConfig chainConfig, GelatoConfig config, ISigner signer, IContractBuilder contractBuilder) { - gelatoClient = new GelatoClient(httpClient, config, analyticsClient, chainConfig); + gelatoClient = new GelatoClient(httpClient, config, chainConfig); this.signer = signer; this.config = config; this.chainConfig = chainConfig; this.contractBuilder = contractBuilder; - this.analyticsClient = analyticsClient; } - public Gelato(IHttpClient httpClient, IChainConfig chainConfig, GelatoConfig config, IContractBuilder contractBuilder, IAnalyticsClient analyticsClient) + public Gelato(IHttpClient httpClient, IChainConfig chainConfig, GelatoConfig config, IContractBuilder contractBuilder) { - gelatoClient = new GelatoClient(httpClient, config, analyticsClient, chainConfig); + gelatoClient = new GelatoClient(httpClient, config, chainConfig); this.config = config; this.chainConfig = chainConfig; this.contractBuilder = contractBuilder; @@ -51,12 +48,6 @@ public async ValueTask WillStartAsync() { return; } - - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = "Gelato initialized", - PackageName = "io.chainsafe.web3-unity", - }); } public ValueTask WillStopAsync() => new(Task.CompletedTask); @@ -67,12 +58,6 @@ public async Task HandleChainSwitching() { return; } - - analyticsClient.CaptureEvent(new AnalyticsEvent - { - EventName = "Gelato reinitialized during chain switching", - PackageName = "io.chainsafe.web3-unity", - }); } public bool GetGelatoDisabled() => gelatoDisabled; diff --git a/src/ChainSafe.Gaming.Gelato/GelatoClient.cs b/src/ChainSafe.Gaming.Gelato/GelatoClient.cs index 757dd9f22..24d970134 100644 --- a/src/ChainSafe.Gaming.Gelato/GelatoClient.cs +++ b/src/ChainSafe.Gaming.Gelato/GelatoClient.cs @@ -1,7 +1,6 @@ using System; using System.Threading.Tasks; using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; using ChainSafe.Gaming.Web3.Core; using ChainSafe.Gaming.Web3.Environment; using ChainSafe.GamingSdk.Gelato.Dto; @@ -18,14 +17,12 @@ public class GelatoClient public const int DefaultDeadlineGap = 86_400; // 24H private readonly IHttpClient httpClient; private readonly GelatoConfig config; - private readonly IAnalyticsClient analyticsClient; private readonly IChainConfig chainConfig; - public GelatoClient(IHttpClient httpClient, GelatoConfig config, IAnalyticsClient analyticsClient, IChainConfig chainConfig) + public GelatoClient(IHttpClient httpClient, GelatoConfig config, IChainConfig chainConfig) { this.httpClient = httpClient; this.config = config; - this.analyticsClient = analyticsClient; this.chainConfig = chainConfig; } @@ -48,12 +45,6 @@ public async Task Post(RelayCall relayCall, TReq RelayCall.SponsoredCallErc2771 => $"{config.Url}/relays/v2/sponsored-call-erc2771", _ => throw new Web3Exception("relayCall option not found") }; - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = $"{relayCall}", - PackageName = "io.chainsafe.web3-unity", - }); - return (await httpClient.Post(url, request)).AssertSuccess(); } diff --git a/src/ChainSafe.Gaming.Lootboxes.Chainlink/LootboxService.cs b/src/ChainSafe.Gaming.Lootboxes.Chainlink/LootboxService.cs index e4ceb118c..21f94473d 100644 --- a/src/ChainSafe.Gaming.Lootboxes.Chainlink/LootboxService.cs +++ b/src/ChainSafe.Gaming.Lootboxes.Chainlink/LootboxService.cs @@ -9,7 +9,7 @@ using ChainSafe.Gaming.Evm.Signers; using ChainSafe.Gaming.Evm.Transactions; using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; + using ChainSafe.Gaming.Web3.Core; using ChainSafe.Gaming.Web3.Core.Debug; using ChainSafe.Gaming.Web3.Environment; @@ -28,7 +28,6 @@ public class LootboxService : ILootboxService, ILifecycleParticipant private readonly LootboxServiceConfig config; private readonly ISigner signer; private readonly IRpcProvider rpcProvider; - private readonly IAnalyticsClient analyticsClient; private Contract contract; private Dictionary rewardTypeByTokenAddress; @@ -36,11 +35,9 @@ public class LootboxService : ILootboxService, ILifecycleParticipant public LootboxService( LootboxServiceConfig config, IContractBuilder contractBuilder, - IRpcProvider rpcProvider, - IAnalyticsClient analyticsClient) + IRpcProvider rpcProvider) { this.rpcProvider = rpcProvider; - this.analyticsClient = analyticsClient; this.config = config; this.contractBuilder = contractBuilder; } @@ -49,9 +46,8 @@ public LootboxService( LootboxServiceConfig config, IContractBuilder contractBuilder, IRpcProvider rpcProvider, - ISigner signer, - IAnalyticsClient analyticsClient) - : this(config, contractBuilder, rpcProvider, analyticsClient) + ISigner signer) + : this(config, contractBuilder, rpcProvider) { this.signer = signer; } @@ -61,12 +57,6 @@ async ValueTask ILifecycleParticipant.WillStartAsync() var contractAbi = this.config.ContractAbi.AssertNotNull(nameof(this.config.ContractAbi)); var contractAddress = this.config.ContractAddress.AssertNotNull(nameof(this.config.ContractAddress)); - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = "Lootboxes Initialized", - PackageName = "io.chainsafe.web3-unity.lootboxes", - }); - // todo check if contract is correct this.contract = this.contractBuilder.Build(contractAbi, contractAddress); diff --git a/src/ChainSafe.Gaming.NetCore/NetCoreEnvironmentExtensions.cs b/src/ChainSafe.Gaming.NetCore/NetCoreEnvironmentExtensions.cs index 1deb59707..6b88be6df 100644 --- a/src/ChainSafe.Gaming.NetCore/NetCoreEnvironmentExtensions.cs +++ b/src/ChainSafe.Gaming.NetCore/NetCoreEnvironmentExtensions.cs @@ -1,5 +1,4 @@ -using ChainSafe.Gaming.Web3.Analytics; -using ChainSafe.Gaming.Web3.Build; +using ChainSafe.Gaming.Web3.Build; using ChainSafe.Gaming.Web3.Environment; using Microsoft.Extensions.DependencyInjection; @@ -18,7 +17,6 @@ public static class NetCoreEnvironmentExtensions /// The same service collection that was passed in. This enables fluent style. public static IWeb3ServiceCollection UseNetCoreEnvironment(this IWeb3ServiceCollection services) { - services.UseApiAnalytics(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); diff --git a/src/ChainSafe.Gaming.SygmaClient/SygmaClient.cs b/src/ChainSafe.Gaming.SygmaClient/SygmaClient.cs index 61e98822e..7a86b5708 100644 --- a/src/ChainSafe.Gaming.SygmaClient/SygmaClient.cs +++ b/src/ChainSafe.Gaming.SygmaClient/SygmaClient.cs @@ -13,7 +13,6 @@ using ChainSafe.Gaming.SygmaClient.Dto; using ChainSafe.Gaming.SygmaClient.Types; using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; using ChainSafe.Gaming.Web3.Core; using ChainSafe.Gaming.Web3.Environment; using Nethereum.ABI; @@ -31,18 +30,16 @@ public class SygmaClient : ISygmaClient, ILifecycleParticipant // todo handle ch private readonly ISigner signer; private readonly IChainConfig sourceChainConfig; private readonly IChainConfig destinationChainConfig; - private readonly IAnalyticsClient analyticsClient; private readonly Config clientConfiguration; private readonly IHttpClient httpClient; private readonly ILogWriter logWriter; - public SygmaClient(ILogWriter logWriter, IHttpClient httpClient, IChainConfig sourceChainConfig, IChainConfig destinationChainConfig, ISigner signer, IContractBuilder contractBuilder, IAnalyticsClient analyticsClient) + public SygmaClient(ILogWriter logWriter, IHttpClient httpClient, IChainConfig sourceChainConfig, IChainConfig destinationChainConfig, ISigner signer, IContractBuilder contractBuilder) { this.contractBuilder = contractBuilder; this.signer = signer; this.sourceChainConfig = sourceChainConfig; this.destinationChainConfig = destinationChainConfig; - this.analyticsClient = analyticsClient; clientConfiguration = new Config(httpClient, uint.Parse(sourceChainConfig.ChainId)); this.httpClient = httpClient; this.logWriter = logWriter; diff --git a/src/ChainSafe.Gaming.Tests/Core/StubAnalyticsClient.cs b/src/ChainSafe.Gaming.Tests/Core/StubAnalyticsClient.cs deleted file mode 100644 index 835f9ffa8..000000000 --- a/src/ChainSafe.Gaming.Tests/Core/StubAnalyticsClient.cs +++ /dev/null @@ -1,17 +0,0 @@ -using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; - -namespace ChainSafe.Gaming.Tests.Core -{ - public class StubAnalyticsClient : IAnalyticsClient - { - public string AnalyticsVersion => "TESTS_STUB"; - - public IChainConfig ChainConfig => null; - - public void CaptureEvent(AnalyticsEvent eventData) - { - // do nothing - } - } -} diff --git a/src/ChainSafe.Gaming.Tests/Core/StubWeb3EnvironmentExtensions.cs b/src/ChainSafe.Gaming.Tests/Core/StubWeb3EnvironmentExtensions.cs index 4cb271985..e83ca79fb 100644 --- a/src/ChainSafe.Gaming.Tests/Core/StubWeb3EnvironmentExtensions.cs +++ b/src/ChainSafe.Gaming.Tests/Core/StubWeb3EnvironmentExtensions.cs @@ -1,4 +1,3 @@ -using ChainSafe.Gaming.Web3.Analytics; using ChainSafe.Gaming.Web3.Build; using ChainSafe.Gaming.Web3.Environment; using Microsoft.Extensions.DependencyInjection; @@ -11,13 +10,11 @@ public static IWeb3ServiceCollection UseStubWeb3Environment( this IWeb3ServiceCollection services, IHttpClient httpClient = null, ILogWriter logWriter = null, - IAnalyticsClient analyticsClient = null, IOperatingSystemMediator operatingSystemMediator = null) { services.AddSingleton(); services.AddSingleton(httpClient ?? new StubHttpClient()); services.AddSingleton(logWriter ?? new TestLogWriter()); - services.AddSingleton(analyticsClient ?? new StubAnalyticsClient()); services.AddSingleton(operatingSystemMediator ?? new StubOperatingSystemMediator()); return services; } diff --git a/src/ChainSafe.Gaming.Unity.MetaMask/MetaMaskProvider.cs b/src/ChainSafe.Gaming.Unity.MetaMask/MetaMaskProvider.cs index 37a5ecbe2..2387b48da 100644 --- a/src/ChainSafe.Gaming.Unity.MetaMask/MetaMaskProvider.cs +++ b/src/ChainSafe.Gaming.Unity.MetaMask/MetaMaskProvider.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using ChainSafe.Gaming.Evm; using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; + using ChainSafe.Gaming.Web3.Environment; using ChainSafe.Gaming.Web3.Evm.Wallet; using UnityEngine; @@ -18,7 +18,6 @@ public class MetaMaskProvider : WalletProvider private readonly MetaMaskController metaMaskController; private readonly IChainConfig chainConfig; - private readonly IAnalyticsClient analyticsClient; private readonly ChainRegistryProvider chainRegistryProvider; /// @@ -32,7 +31,6 @@ public MetaMaskProvider(Web3Environment environment, IChainConfig chainConfig, C { logWriter = environment.LogWriter; this.chainConfig = chainConfig; - analyticsClient = environment.AnalyticsClient; this.chainRegistryProvider = chainRegistryProvider; if (Application.isEditor || Application.platform != RuntimePlatform.WebGLPlayer) @@ -78,11 +76,6 @@ public override async Task Connect() { logWriter.Log("Connecting from Metamask..."); - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = "Metamask WebGL Initialized", - PackageName = "io.chainsafe.web3-unity", - }); return await metaMaskController.Connect(chainConfig, chainRegistryProvider); } diff --git a/src/ChainSafe.Gaming.WalletConnect/WalletConnectProvider.cs b/src/ChainSafe.Gaming.WalletConnect/WalletConnectProvider.cs index 5366eebd1..6d8794fa6 100644 --- a/src/ChainSafe.Gaming.WalletConnect/WalletConnectProvider.cs +++ b/src/ChainSafe.Gaming.WalletConnect/WalletConnectProvider.cs @@ -9,7 +9,7 @@ using ChainSafe.Gaming.WalletConnect.Storage; using ChainSafe.Gaming.WalletConnect.Wallets; using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; + using ChainSafe.Gaming.Web3.Core; using ChainSafe.Gaming.Web3.Core.Debug; using ChainSafe.Gaming.Web3.Environment; @@ -45,7 +45,6 @@ public class WalletConnectProvider : WalletProvider, ILifecycleParticipant, ICon private readonly IWalletRegistry walletRegistry; private readonly RedirectionHandler redirection; private readonly IHttpClient httpClient; - private readonly IAnalyticsClient analyticsClient; private WalletConnectCore core; private WalletConnectSignClient signClient; @@ -65,7 +64,6 @@ public WalletConnectProvider( Web3Environment environment) : base(environment, chainConfig) { - analyticsClient = environment.AnalyticsClient; this.redirection = redirection; this.walletRegistry = walletRegistry; osMediator = environment.OperatingSystem; @@ -94,11 +92,6 @@ private async Task Initialize() return; } - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = "Wallet Connect Initialized", - PackageName = "io.chainsafe.web3-unity", - }); ValidateConfig(); diff --git a/src/ChainSafe.Gaming/RPC/Contracts/Contract.cs b/src/ChainSafe.Gaming/RPC/Contracts/Contract.cs index 89fcae790..8769d8d16 100644 --- a/src/ChainSafe.Gaming/RPC/Contracts/Contract.cs +++ b/src/ChainSafe.Gaming/RPC/Contracts/Contract.cs @@ -6,7 +6,6 @@ using ChainSafe.Gaming.Evm.Signers; using ChainSafe.Gaming.Evm.Transactions; using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; using ChainSafe.Gaming.Web3.Core; using ChainSafe.Gaming.Web3.Core.Evm; using Nethereum.ABI.Model; @@ -24,7 +23,6 @@ public class Contract : IContract private readonly ISigner signer; private readonly ContractAbiManager contractAbiManager; private readonly ITransactionExecutor transactionExecutor; - private readonly IAnalyticsClient analyticsClient; /// /// Initializes a new instance of the class. @@ -34,7 +32,7 @@ public class Contract : IContract /// The RPC provider. /// The signer. /// Transaction executor. - internal Contract(string abi, string address, IRpcProvider provider, ISigner signer = null, ITransactionExecutor transactionExecutor = null, IAnalyticsClient analyticsClient = null) + internal Contract(string abi, string address, IRpcProvider provider, ISigner signer = null, ITransactionExecutor transactionExecutor = null) { if (string.IsNullOrEmpty(abi)) { @@ -46,7 +44,6 @@ internal Contract(string abi, string address, IRpcProvider provider, ISigner sig this.provider = provider; this.signer = signer; this.transactionExecutor = transactionExecutor; - this.analyticsClient = analyticsClient; contractAbiManager = new ContractAbiManager(abi, address); } @@ -85,11 +82,6 @@ public async Task Call(string method, object[] parameters = null, Tran var txReq = await PrepareTransactionRequest(method, parameters, true, overwrite); var result = await provider.Call(txReq); - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = method, - PackageName = "io.chainsafe.web3.unity", - }); return Decode(method, result); } @@ -103,11 +95,6 @@ public async Task Call(string method, object[] parameters = null, Transact var txReq = await PrepareTransactionRequest(method, parameters, true, overwrite); var result = await provider.Call(txReq); - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = method, - PackageName = "io.chainsafe.web3.unity", - }); return contractAbiManager.GetFunctionBuilder(method).DecodeTypeOutput(result); } @@ -183,12 +170,6 @@ public async Task Send(string method, object[] parameters = null, Transact var output = function.DecodeOutput(tx.Data); var outputValues = output.Select(x => x.Result).ToArray(); - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = method, - PackageName = "io.chainsafe.web3.unity", - }); - return (outputValues, receipt); } @@ -214,19 +195,12 @@ public async Task Send(string method, object[] parameters = null, Transact var tx = await transactionExecutor.SendTransaction(txReq); var receipt = await provider.WaitForTransactionReceipt(tx.Hash); - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = method, - PackageName = "io.chainsafe.web3.unity", - }); - if (tx.Data == null) { return (default, receipt); } var outputValues = contractAbiManager.GetFunctionBuilder(method).DecodeTypeOutput(tx.Data); - return (outputValues, receipt); } @@ -284,12 +258,6 @@ public string Calldata(string method, object[] parameters = null) #endif var function = contractAbiManager.GetFunctionBuilder(method); - analyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = method, - PackageName = "io.chainsafe.web3.unity", - }); - return function.GetData(parameters); } diff --git a/src/ChainSafe.Gaming/RPC/Contracts/ContractBuilder.cs b/src/ChainSafe.Gaming/RPC/Contracts/ContractBuilder.cs index 7d50d4263..98744208d 100644 --- a/src/ChainSafe.Gaming/RPC/Contracts/ContractBuilder.cs +++ b/src/ChainSafe.Gaming/RPC/Contracts/ContractBuilder.cs @@ -6,7 +6,6 @@ using ChainSafe.Gaming.Evm.Signers; using ChainSafe.Gaming.RPC.Events; using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; using ChainSafe.Gaming.Web3.Core; using ChainSafe.Gaming.Web3.Core.Evm; using ChainSafe.Gaming.Web3.Environment; @@ -19,31 +18,30 @@ public class ContractBuilder : IContractBuilder, ILifecycleParticipant private readonly IRpcProvider rpcProvider; private readonly ISigner signer; private readonly ITransactionExecutor transactionExecutor; - private readonly IAnalyticsClient analyticsClient; // Added analytics client private readonly ILogWriter logWriter; private readonly IEventManager eventManager; - public ContractBuilder(IRpcProvider rpcProvider, IAnalyticsClient analyticsClient, ILogWriter logWriter, IEventManager eventManager = null) - : this(new(), rpcProvider, null, null, analyticsClient, logWriter, eventManager) + public ContractBuilder(IRpcProvider rpcProvider, ILogWriter logWriter, IEventManager eventManager = null) + : this(new(), rpcProvider, null, null, logWriter, eventManager) { } - public ContractBuilder(IRpcProvider rpcProvider, ISigner signer, IAnalyticsClient analyticsClient, ILogWriter logWriter, IEventManager eventManager = null) - : this(new(), rpcProvider, signer, null, analyticsClient, logWriter, eventManager) + public ContractBuilder(IRpcProvider rpcProvider, ISigner signer, ILogWriter logWriter, IEventManager eventManager = null) + : this(new(), rpcProvider, signer, null, logWriter, eventManager) { } - public ContractBuilder(ContractBuilderConfig config, IRpcProvider rpcProvider, ISigner signer, IAnalyticsClient analyticsClient, ILogWriter logWriter, IEventManager eventManager = null) - : this(config, rpcProvider, signer, null, analyticsClient, logWriter, eventManager) + public ContractBuilder(ContractBuilderConfig config, IRpcProvider rpcProvider, ISigner signer, ILogWriter logWriter, IEventManager eventManager = null) + : this(config, rpcProvider, signer, null, logWriter, eventManager) { } - public ContractBuilder(IRpcProvider rpcProvider, ISigner signer, ITransactionExecutor transactionExecutor, IAnalyticsClient analyticsClient, ILogWriter logWriter, IEventManager eventManager = null) - : this(new(), rpcProvider, signer, transactionExecutor, analyticsClient, logWriter, eventManager) + public ContractBuilder(IRpcProvider rpcProvider, ISigner signer, ITransactionExecutor transactionExecutor, ILogWriter logWriter, IEventManager eventManager = null) + : this(new(), rpcProvider, signer, transactionExecutor, logWriter, eventManager) { } - public ContractBuilder(ContractBuilderConfig config, IRpcProvider rpcProvider, ISigner signer, ITransactionExecutor transactionExecutor, IAnalyticsClient analyticsClient, ILogWriter logWriter, IEventManager eventManager = null) + public ContractBuilder(ContractBuilderConfig config, IRpcProvider rpcProvider, ISigner signer, ITransactionExecutor transactionExecutor, ILogWriter logWriter, IEventManager eventManager = null) { try { @@ -57,7 +55,6 @@ public ContractBuilder(ContractBuilderConfig config, IRpcProvider rpcProvider, I this.rpcProvider = rpcProvider; this.signer = signer; this.transactionExecutor = transactionExecutor; - this.analyticsClient = analyticsClient; // Initialize analytics client this.logWriter = logWriter; this.eventManager = eventManager; BasicContracts = new Dictionary(); @@ -75,7 +72,7 @@ public Contract Build(string name) throw new Web3Exception($"Contract with name '{name}' was not registered."); } - return new Contract(data.Abi, data.Address, rpcProvider, signer, transactionExecutor, analyticsClient); // Pass analytics client to Contract + return new Contract(data.Abi, data.Address, rpcProvider, signer, transactionExecutor); } public Contract Build(string abi, string address) @@ -85,7 +82,7 @@ public Contract Build(string abi, string address) return value; } - var contract = new Contract(abi, address, rpcProvider, signer, transactionExecutor, analyticsClient); // Pass analytics client to Contract + var contract = new Contract(abi, address, rpcProvider, signer, transactionExecutor); BasicContracts.Add(address, contract); return contract; } diff --git a/src/ChainSafe.Gaming/Web3/Core/Analytics/AnalyticsEvent.cs b/src/ChainSafe.Gaming/Web3/Core/Analytics/AnalyticsEvent.cs deleted file mode 100644 index 83e9d3636..000000000 --- a/src/ChainSafe.Gaming/Web3/Core/Analytics/AnalyticsEvent.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Newtonsoft.Json; - -namespace ChainSafe.Gaming.Web3.Analytics -{ - public class AnalyticsEvent - { - [JsonProperty(PropertyName = "gameData", NullValueHandling = NullValueHandling.Ignore)] - public AnalyticsGameData GameData { get; set; } - - [JsonProperty(PropertyName = "eventName", NullValueHandling = NullValueHandling.Ignore)] - public string EventName { get; set; } - - [JsonProperty(PropertyName = "packageName", NullValueHandling = NullValueHandling.Ignore)] - public string PackageName { get; set; } - } -} \ No newline at end of file diff --git a/src/ChainSafe.Gaming/Web3/Core/Analytics/AnalyticsGameData.cs b/src/ChainSafe.Gaming/Web3/Core/Analytics/AnalyticsGameData.cs deleted file mode 100644 index 0ff5d20c5..000000000 --- a/src/ChainSafe.Gaming/Web3/Core/Analytics/AnalyticsGameData.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections.Generic; -using Newtonsoft.Json; - -namespace ChainSafe.Gaming.Web3.Analytics -{ - public class AnalyticsGameData - { - [JsonProperty(PropertyName = "client", NullValueHandling = NullValueHandling.Ignore)] - public string Client { get; set; } - - [JsonProperty(PropertyName = "player", NullValueHandling = NullValueHandling.Ignore)] - public string Player { get; set; } - - [JsonProperty(PropertyName = "to", NullValueHandling = NullValueHandling.Ignore)] - public string To { get; set; } - - [JsonProperty(PropertyName = "value", NullValueHandling = NullValueHandling.Ignore)] - public string Value { get; set; } - - [JsonProperty(PropertyName = "gas_limit", NullValueHandling = NullValueHandling.Ignore)] - public string GasLimit { get; set; } - - [JsonProperty(PropertyName = "gas_price", NullValueHandling = NullValueHandling.Ignore)] - public string GasPrice { get; set; } - - [JsonProperty(PropertyName = "custom", NullValueHandling = NullValueHandling.Ignore)] - public Dictionary CustomProperties { get; set; } - - [JsonProperty(PropertyName = "params", NullValueHandling = NullValueHandling.Ignore)] - public object[] Params { get; set; } - } -} \ No newline at end of file diff --git a/src/ChainSafe.Gaming/Web3/Core/Analytics/ApiAnalyticsClient.cs b/src/ChainSafe.Gaming/Web3/Core/Analytics/ApiAnalyticsClient.cs deleted file mode 100644 index 98753aef2..000000000 --- a/src/ChainSafe.Gaming/Web3/Core/Analytics/ApiAnalyticsClient.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Threading.Tasks; -using ChainSafe.Gaming.Web3.Core.Chains; -using ChainSafe.Gaming.Web3.Environment; -using Newtonsoft.Json; - -namespace ChainSafe.Gaming.Web3.Analytics -{ - internal class ApiAnalyticsClient : IAnalyticsClient - { - private const string LoggingUrl = "https://api.gaming.chainsafe.io/logging/logEvent"; - - private readonly IHttpClient httpClient; - private readonly IChainManager chainManager; - - public ApiAnalyticsClient(IChainManager chainManager, IHttpClient httpClient) - { - this.httpClient = httpClient; - this.chainManager = chainManager; - } - - public IChainConfig ChainConfig => chainManager.Current; - - public string AnalyticsVersion => "2.5.5"; - - public async void CaptureEvent(AnalyticsEvent eventData) - { - await httpClient.PostRaw(LoggingUrl, JsonConvert.SerializeObject(eventData), "application/json"); - } - } -} diff --git a/src/ChainSafe.Gaming/Web3/Core/Analytics/ApiAnalyticsClientExtensions.cs b/src/ChainSafe.Gaming/Web3/Core/Analytics/ApiAnalyticsClientExtensions.cs deleted file mode 100644 index 1b528b084..000000000 --- a/src/ChainSafe.Gaming/Web3/Core/Analytics/ApiAnalyticsClientExtensions.cs +++ /dev/null @@ -1,24 +0,0 @@ -using ChainSafe.Gaming.Web3.Build; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; - -namespace ChainSafe.Gaming.Web3.Analytics -{ - public static class ApiAnalyticsClientExtensions - { - /// - /// Binds thereby enabling analytics. - /// - /// Service collection to enable fluent syntax. - public static IWeb3ServiceCollection UseApiAnalytics(this IWeb3ServiceCollection serviceCollection) - { - if (serviceCollection.AnalyticsDisabled()) - { - return serviceCollection; - } - - serviceCollection.Replace(ServiceDescriptor.Singleton()); - return serviceCollection; - } - } -} \ No newline at end of file diff --git a/src/ChainSafe.Gaming/Web3/Core/Analytics/IAnalyticsClient.cs b/src/ChainSafe.Gaming/Web3/Core/Analytics/IAnalyticsClient.cs deleted file mode 100644 index ef933456f..000000000 --- a/src/ChainSafe.Gaming/Web3/Core/Analytics/IAnalyticsClient.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Threading.Tasks; - -namespace ChainSafe.Gaming.Web3.Analytics -{ - /// - /// Interface for the Analytics Client. - /// - public interface IAnalyticsClient - { - public string AnalyticsVersion { get; } - - IChainConfig ChainConfig { get; } - - /// - /// Captures an analytics event. - /// - /// The analytics event data. - void CaptureEvent(AnalyticsEvent eventData); - } -} diff --git a/src/ChainSafe.Gaming/Web3/Core/Analytics/NoOpAnalyticsClient.cs b/src/ChainSafe.Gaming/Web3/Core/Analytics/NoOpAnalyticsClient.cs deleted file mode 100644 index 5808bdbf2..000000000 --- a/src/ChainSafe.Gaming/Web3/Core/Analytics/NoOpAnalyticsClient.cs +++ /dev/null @@ -1,22 +0,0 @@ -using ChainSafe.Gaming.Web3.Core.Chains; - -namespace ChainSafe.Gaming.Web3.Analytics -{ - public class NoOpAnalyticsClient : IAnalyticsClient - { - private readonly IChainManager chainManager; - - public NoOpAnalyticsClient(IChainManager chainManager) - { - this.chainManager = chainManager; - } - - public string AnalyticsVersion => null; - - public IChainConfig ChainConfig => chainManager.Current; - - public void CaptureEvent(AnalyticsEvent eventData) - { - } - } -} diff --git a/src/ChainSafe.Gaming/Web3/Core/Analytics/NoOpAnalyticsClientExtensions.cs b/src/ChainSafe.Gaming/Web3/Core/Analytics/NoOpAnalyticsClientExtensions.cs deleted file mode 100644 index 2482d8e35..000000000 --- a/src/ChainSafe.Gaming/Web3/Core/Analytics/NoOpAnalyticsClientExtensions.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Linq; -using ChainSafe.Gaming.Web3.Build; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; - -namespace ChainSafe.Gaming.Web3.Analytics -{ - public static class NoOpAnalyticsClientExtensions - { - /// - /// Disables analytics for the instance. - /// - /// The Web3 service collection. - /// Service collection to enable fluent syntax. - public static IWeb3ServiceCollection DisableAnalytics(this IWeb3ServiceCollection serviceCollection) - { - serviceCollection.Replace(ServiceDescriptor.Singleton()); - return serviceCollection; - } - - /// - /// Returns true if analytics are disabled. - /// - /// The Web3 service collection. - /// True if analytics are disabled. - public static bool AnalyticsDisabled(this IWeb3ServiceCollection serviceCollection) - { - return serviceCollection.Any(d => - d.ServiceType == typeof(IAnalyticsClient) - && d.ImplementationType == typeof(NoOpAnalyticsClient)); - } - } -} \ No newline at end of file diff --git a/src/ChainSafe.Gaming/Web3/Core/Environment/Web3Environment.cs b/src/ChainSafe.Gaming/Web3/Core/Environment/Web3Environment.cs index d938cd672..364d8bf16 100644 --- a/src/ChainSafe.Gaming/Web3/Core/Environment/Web3Environment.cs +++ b/src/ChainSafe.Gaming/Web3/Core/Environment/Web3Environment.cs @@ -1,5 +1,3 @@ -using ChainSafe.Gaming.Web3.Analytics; - namespace ChainSafe.Gaming.Web3.Environment { /// @@ -7,20 +5,17 @@ namespace ChainSafe.Gaming.Web3.Environment /// public class Web3Environment { - public Web3Environment(IHttpClient httpClient, ILogWriter logWriter, IAnalyticsClient analyticsClient, IOperatingSystemMediator operatingSystem) + public Web3Environment(IHttpClient httpClient, ILogWriter logWriter, IOperatingSystemMediator operatingSystem) { OperatingSystem = operatingSystem; HttpClient = httpClient; LogWriter = logWriter; - AnalyticsClient = analyticsClient; } public IHttpClient HttpClient { get; } public ILogWriter LogWriter { get; } - public IAnalyticsClient AnalyticsClient { get; } - public IOperatingSystemMediator OperatingSystem { get; } } } \ No newline at end of file diff --git a/src/ChainSafe.Gaming/Web3/Evm/JsonRpc/RpcClientProvider.cs b/src/ChainSafe.Gaming/Web3/Evm/JsonRpc/RpcClientProvider.cs index 22b529ee1..ea10b7031 100644 --- a/src/ChainSafe.Gaming/Web3/Evm/JsonRpc/RpcClientProvider.cs +++ b/src/ChainSafe.Gaming/Web3/Evm/JsonRpc/RpcClientProvider.cs @@ -1,7 +1,6 @@ using System; using System.Threading.Tasks; using ChainSafe.Gaming.Web3; -using ChainSafe.Gaming.Web3.Analytics; using ChainSafe.Gaming.Web3.Environment; using Nethereum.JsonRpc.Client; using Nethereum.JsonRpc.Client.RpcMessages; @@ -43,18 +42,6 @@ public async Task Perform(string method, params object[] parameters) { throw new Web3Exception($"RPC method \"{method}\" threw an exception:" + response?.Error?.Message, ex); } - finally - { - environment.AnalyticsClient.CaptureEvent(new AnalyticsEvent() - { - EventName = $"{method}", - GameData = new AnalyticsGameData() - { - Params = parameters, - }, - PackageName = "io.chainsafe.web3-unity", - }); - } var serializer = JsonSerializer.Create(); return serializer.Deserialize(new JTokenReader(response.Result))!; diff --git a/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/3.0.6/Lootboxes Samples/Scripts/ChainlinkLootboxSampleLauncher.cs b/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/3.0.6/Lootboxes Samples/Scripts/ChainlinkLootboxSampleLauncher.cs index 9927f4a53..53799be2c 100644 --- a/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/3.0.6/Lootboxes Samples/Scripts/ChainlinkLootboxSampleLauncher.cs +++ b/src/UnitySampleProject/Assets/Samples/web3.unity SDK Lootboxes/3.0.6/Lootboxes Samples/Scripts/ChainlinkLootboxSampleLauncher.cs @@ -29,7 +29,6 @@ public class ChainlinkLootboxSampleLauncher : MonoBehaviour private class Web3Config : IChainConfigSet { - public bool EnableAnalytics => true; public IEnumerable Configs { get; } = new[] {