diff --git a/source/Assets/Plugins/Didomi/Scripts/UnityEditor/UnityEditorDidomi.cs b/source/Assets/Plugins/Didomi/Scripts/UnityEditor/UnityEditorDidomi.cs index 2af8323..6252085 100644 --- a/source/Assets/Plugins/Didomi/Scripts/UnityEditor/UnityEditorDidomi.cs +++ b/source/Assets/Plugins/Didomi/Scripts/UnityEditor/UnityEditorDidomi.cs @@ -1,4 +1,4 @@ -using IO.Didomi.SDK.Events; +using IO.Didomi.SDK.Events; using IO.Didomi.SDK.Interfaces; using System; using System.Collections.Generic; @@ -7,27 +7,34 @@ namespace IO.Didomi.SDK.UnityEditor { /// - /// Mock implementation of IDidomi interface that is called when the app is run on Unity. + /// Stub implementation of IDidomi interface that is called when the app is run in Unity Editor. + /// Returns empty/default values for all methods. /// public class UnityEditorDidomi : IDidomi { + private const string StubTag = "[Didomi Stub]"; private bool _isInitialized = false; private bool _disableMockUI = false; private Action _onReadyAction = null; + private void LogStub(string methodName) + { + Debug.Log($"{StubTag} {methodName} called - returning stub value (Unity Editor)"); + } + public void AddEventListener(DidomiEventListener eventListener) { - throw new NotImplementedException(); + LogStub("AddEventListener"); } public void AddVendorStatusListener(string vendorId, DidomiVendorStatusListener vendorStatusListener) { - throw new NotImplementedException(); + LogStub("AddVendorStatusListener"); } public void RemoveVendorStatusListener(string vendorId) { - throw new NotImplementedException(); + LogStub("RemoveVendorStatusListener"); } /// @@ -40,52 +47,62 @@ public void DisableMockUI(bool disable) public string GetJavaScriptForWebView() { - throw new NotImplementedException(); + LogStub("GetJavaScriptForWebView"); + return ""; } public Purpose GetPurpose(string purposeId) { - throw new NotImplementedException(); + LogStub("GetPurpose"); + return new Purpose("", "", ""); } public ISet GetRequiredPurposeIds() { - throw new NotImplementedException(); + LogStub("GetRequiredPurposeIds"); + return new HashSet(); } public ISet GetRequiredPurposes() { - throw new NotImplementedException(); + LogStub("GetRequiredPurposes"); + return new HashSet(); } public ISet GetRequiredVendorIds() { - throw new NotImplementedException(); + LogStub("GetRequiredVendorIds"); + return new HashSet(); } public ISet GetRequiredVendors() { - throw new NotImplementedException(); + LogStub("GetRequiredVendors"); + return new HashSet(); } public IDictionary GetText(string key) { - throw new NotImplementedException(); + LogStub("GetText"); + return new Dictionary(); } public string GetTranslatedText(string key) { - throw new NotImplementedException(); + LogStub("GetTranslatedText"); + return ""; } public CurrentUserStatus GetCurrentUserStatus() { - throw new NotImplementedException(); + LogStub("GetCurrentUserStatus"); + return new CurrentUserStatus(); } public bool SetCurrentUserStatus(CurrentUserStatus status) { - throw new NotImplementedException(); + LogStub("SetCurrentUserStatus"); + return false; } public bool CommitCurrentUserStatusTransaction( @@ -95,47 +112,66 @@ public bool CommitCurrentUserStatusTransaction( ISet disabledPurposes ) { - throw new NotImplementedException(); + LogStub("CommitCurrentUserStatusTransaction"); + return false; } public UserStatus GetUserStatus() { - throw new NotImplementedException(); + LogStub("GetUserStatus"); + return new UserStatus(); } public string GetApplicableRegulation() { - throw new NotImplementedException(); + LogStub("GetApplicableRegulation"); + return ""; } public Vendor GetVendor(string vendorId) { - throw new NotImplementedException(); + LogStub("GetVendor"); + return new Vendor( + "", + "", + null, + null, + new List(), + new List(), + new List(), + new List(), + new List(), + new List(), + null + ); } public int GetTotalVendorCount() { - throw new NotImplementedException(); + LogStub("GetTotalVendorCount"); + return 0; } public int GetIABVendorCount() { - throw new NotImplementedException(); + LogStub("GetIABVendorCount"); + return 0; } public int GetNonIABVendorCount() { - throw new NotImplementedException(); + LogStub("GetNonIABVendorCount"); + return 0; } public void HideNotice() { - throw new NotImplementedException(); + LogStub("HideNotice"); } public void HidePreferences() { - throw new NotImplementedException(); + LogStub("HidePreferences"); } public void Initialize(DidomiInitializeParameters parameters) @@ -152,17 +188,20 @@ public void Initialize(DidomiInitializeParameters parameters) public bool IsConsentRequired() { - throw new NotImplementedException(); + LogStub("IsConsentRequired"); + return false; } public bool IsNoticeVisible() { - throw new NotImplementedException(); + LogStub("IsNoticeVisible"); + return false; } public bool IsPreferencesVisible() { - throw new NotImplementedException(); + LogStub("IsPreferencesVisible"); + return false; } public bool IsReady() @@ -172,7 +211,7 @@ public bool IsReady() public void OnError(Action didomiCallable) { - throw new NotImplementedException(); + LogStub("OnError"); } public void OnReady(Action didomiCallable) @@ -207,31 +246,37 @@ public void ShowPreferences(Didomi.Views view) public bool IsUserConsentStatusPartial() { - throw new NotImplementedException(); + LogStub("IsUserConsentStatusPartial"); + return false; } public bool IsUserLegitimateInterestStatusPartial() { - throw new NotImplementedException(); + LogStub("IsUserLegitimateInterestStatusPartial"); + return false; } public bool IsUserStatusPartial() { - throw new NotImplementedException(); + LogStub("IsUserStatusPartial"); + return false; } public void Reset() { + LogStub("Reset"); } public bool SetUserAgreeToAll() { - throw new NotImplementedException(); + LogStub("SetUserAgreeToAll"); + return true; } public bool SetUserDisagreeToAll() { - throw new NotImplementedException(); + LogStub("SetUserDisagreeToAll"); + return true; } public bool SetUserStatus( @@ -244,7 +289,8 @@ public bool SetUserStatus( ISet enabledLIVendorIds, ISet disabledLIVendorIds) { - throw new NotImplementedException(); + LogStub("SetUserStatus"); + return true; } public bool SetUserStatus( @@ -253,17 +299,20 @@ public bool SetUserStatus( bool vendorsConsentStatus, bool vendorsLIStatus) { - throw new NotImplementedException(); + LogStub("SetUserStatus"); + return true; } public bool ShouldConsentBeCollected() { - throw new NotImplementedException(); + LogStub("ShouldConsentBeCollected"); + return false; } public bool ShouldUserStatusBeCollected() { - throw new NotImplementedException(); + LogStub("ShouldUserStatusBeCollected"); + return false; } public void ShowNotice() @@ -294,22 +343,22 @@ private UnityEditorMockUI GetMockUIScript() public void UpdateSelectedLanguage(string languageCode) { - throw new NotImplementedException(); + LogStub("UpdateSelectedLanguage"); } public void SetUser(DidomiUserParameters userParameters) { - throw new NotImplementedException(); + LogStub("SetUser"); } public void SetUserAndSetupUI(DidomiUserParameters userParameters) { - throw new NotImplementedException(); + LogStub("SetUserAndSetupUI"); } public void ClearUser() { - throw new NotImplementedException(); + LogStub("ClearUser"); } } }