1- using IO . Didomi . SDK . Events ;
1+ using IO . Didomi . SDK . Events ;
22using IO . Didomi . SDK . Interfaces ;
33using System ;
44using System . Collections . Generic ;
77namespace IO . Didomi . SDK . UnityEditor
88{
99 /// <summary>
10- /// Mock implementation of IDidomi interface that is called when the app is run on Unity.
10+ /// Stub implementation of IDidomi interface that is called when the app is run in Unity Editor.
11+ /// Returns empty/default values for all methods.
1112 /// </summary>
1213 public class UnityEditorDidomi : IDidomi
1314 {
15+ private const string StubTag = "[Didomi Stub]" ;
1416 private bool _isInitialized = false ;
1517 private bool _disableMockUI = false ;
1618 private Action _onReadyAction = null ;
1719
20+ private void LogStub ( string methodName )
21+ {
22+ Debug . Log ( $ "{ StubTag } { methodName } called - returning stub value (Unity Editor)") ;
23+ }
24+
1825 public void AddEventListener ( DidomiEventListener eventListener )
1926 {
20- throw new NotImplementedException ( ) ;
27+ LogStub ( "AddEventListener" ) ;
2128 }
2229
2330 public void AddVendorStatusListener ( string vendorId , DidomiVendorStatusListener vendorStatusListener )
2431 {
25- throw new NotImplementedException ( ) ;
32+ LogStub ( "AddVendorStatusListener" ) ;
2633 }
2734
2835 public void RemoveVendorStatusListener ( string vendorId )
2936 {
30- throw new NotImplementedException ( ) ;
37+ LogStub ( "RemoveVendorStatusListener" ) ;
3138 }
3239
3340 /// <summary>
@@ -40,52 +47,62 @@ public void DisableMockUI(bool disable)
4047
4148 public string GetJavaScriptForWebView ( )
4249 {
43- throw new NotImplementedException ( ) ;
50+ LogStub ( "GetJavaScriptForWebView" ) ;
51+ return "" ;
4452 }
4553
4654 public Purpose GetPurpose ( string purposeId )
4755 {
48- throw new NotImplementedException ( ) ;
56+ LogStub ( "GetPurpose" ) ;
57+ return new Purpose ( "" , "" , "" ) ;
4958 }
5059
5160 public ISet < string > GetRequiredPurposeIds ( )
5261 {
53- throw new NotImplementedException ( ) ;
62+ LogStub ( "GetRequiredPurposeIds" ) ;
63+ return new HashSet < string > ( ) ;
5464 }
5565
5666 public ISet < Purpose > GetRequiredPurposes ( )
5767 {
58- throw new NotImplementedException ( ) ;
68+ LogStub ( "GetRequiredPurposes" ) ;
69+ return new HashSet < Purpose > ( ) ;
5970 }
6071
6172 public ISet < string > GetRequiredVendorIds ( )
6273 {
63- throw new NotImplementedException ( ) ;
74+ LogStub ( "GetRequiredVendorIds" ) ;
75+ return new HashSet < string > ( ) ;
6476 }
6577
6678 public ISet < Vendor > GetRequiredVendors ( )
6779 {
68- throw new NotImplementedException ( ) ;
80+ LogStub ( "GetRequiredVendors" ) ;
81+ return new HashSet < Vendor > ( ) ;
6982 }
7083
7184 public IDictionary < string , string > GetText ( string key )
7285 {
73- throw new NotImplementedException ( ) ;
86+ LogStub ( "GetText" ) ;
87+ return new Dictionary < string , string > ( ) ;
7488 }
7589
7690 public string GetTranslatedText ( string key )
7791 {
78- throw new NotImplementedException ( ) ;
92+ LogStub ( "GetTranslatedText" ) ;
93+ return "" ;
7994 }
8095
8196 public CurrentUserStatus GetCurrentUserStatus ( )
8297 {
83- throw new NotImplementedException ( ) ;
98+ LogStub ( "GetCurrentUserStatus" ) ;
99+ return new CurrentUserStatus ( ) ;
84100 }
85101
86102 public bool SetCurrentUserStatus ( CurrentUserStatus status )
87103 {
88- throw new NotImplementedException ( ) ;
104+ LogStub ( "SetCurrentUserStatus" ) ;
105+ return false ;
89106 }
90107
91108 public bool CommitCurrentUserStatusTransaction (
@@ -95,47 +112,66 @@ public bool CommitCurrentUserStatusTransaction(
95112 ISet < string > disabledPurposes
96113 )
97114 {
98- throw new NotImplementedException ( ) ;
115+ LogStub ( "CommitCurrentUserStatusTransaction" ) ;
116+ return false ;
99117 }
100118
101119 public UserStatus GetUserStatus ( )
102120 {
103- throw new NotImplementedException ( ) ;
121+ LogStub ( "GetUserStatus" ) ;
122+ return new UserStatus ( ) ;
104123 }
105124
106125 public string GetApplicableRegulation ( )
107126 {
108- throw new NotImplementedException ( ) ;
127+ LogStub ( "GetApplicableRegulation" ) ;
128+ return "" ;
109129 }
110130
111131 public Vendor GetVendor ( string vendorId )
112132 {
113- throw new NotImplementedException ( ) ;
133+ LogStub ( "GetVendor" ) ;
134+ return new Vendor (
135+ "" ,
136+ "" ,
137+ null ,
138+ null ,
139+ new List < string > ( ) ,
140+ new List < string > ( ) ,
141+ new List < string > ( ) ,
142+ new List < string > ( ) ,
143+ new List < string > ( ) ,
144+ new List < string > ( ) ,
145+ null
146+ ) ;
114147 }
115148
116149 public int GetTotalVendorCount ( )
117150 {
118- throw new NotImplementedException ( ) ;
151+ LogStub ( "GetTotalVendorCount" ) ;
152+ return 0 ;
119153 }
120154
121155 public int GetIABVendorCount ( )
122156 {
123- throw new NotImplementedException ( ) ;
157+ LogStub ( "GetIABVendorCount" ) ;
158+ return 0 ;
124159 }
125160
126161 public int GetNonIABVendorCount ( )
127162 {
128- throw new NotImplementedException ( ) ;
163+ LogStub ( "GetNonIABVendorCount" ) ;
164+ return 0 ;
129165 }
130166
131167 public void HideNotice ( )
132168 {
133- throw new NotImplementedException ( ) ;
169+ LogStub ( "HideNotice" ) ;
134170 }
135171
136172 public void HidePreferences ( )
137173 {
138- throw new NotImplementedException ( ) ;
174+ LogStub ( "HidePreferences" ) ;
139175 }
140176
141177 public void Initialize ( DidomiInitializeParameters parameters )
@@ -152,17 +188,20 @@ public void Initialize(DidomiInitializeParameters parameters)
152188
153189 public bool IsConsentRequired ( )
154190 {
155- throw new NotImplementedException ( ) ;
191+ LogStub ( "IsConsentRequired" ) ;
192+ return false ;
156193 }
157194
158195 public bool IsNoticeVisible ( )
159196 {
160- throw new NotImplementedException ( ) ;
197+ LogStub ( "IsNoticeVisible" ) ;
198+ return false ;
161199 }
162200
163201 public bool IsPreferencesVisible ( )
164202 {
165- throw new NotImplementedException ( ) ;
203+ LogStub ( "IsPreferencesVisible" ) ;
204+ return false ;
166205 }
167206
168207 public bool IsReady ( )
@@ -172,7 +211,7 @@ public bool IsReady()
172211
173212 public void OnError ( Action didomiCallable )
174213 {
175- throw new NotImplementedException ( ) ;
214+ LogStub ( "OnError" ) ;
176215 }
177216
178217 public void OnReady ( Action didomiCallable )
@@ -207,31 +246,37 @@ public void ShowPreferences(Didomi.Views view)
207246
208247 public bool IsUserConsentStatusPartial ( )
209248 {
210- throw new NotImplementedException ( ) ;
249+ LogStub ( "IsUserConsentStatusPartial" ) ;
250+ return false ;
211251 }
212252
213253 public bool IsUserLegitimateInterestStatusPartial ( )
214254 {
215- throw new NotImplementedException ( ) ;
255+ LogStub ( "IsUserLegitimateInterestStatusPartial" ) ;
256+ return false ;
216257 }
217258
218259 public bool IsUserStatusPartial ( )
219260 {
220- throw new NotImplementedException ( ) ;
261+ LogStub ( "IsUserStatusPartial" ) ;
262+ return false ;
221263 }
222264
223265 public void Reset ( )
224266 {
267+ LogStub ( "Reset" ) ;
225268 }
226269
227270 public bool SetUserAgreeToAll ( )
228271 {
229- throw new NotImplementedException ( ) ;
272+ LogStub ( "SetUserAgreeToAll" ) ;
273+ return true ;
230274 }
231275
232276 public bool SetUserDisagreeToAll ( )
233277 {
234- throw new NotImplementedException ( ) ;
278+ LogStub ( "SetUserDisagreeToAll" ) ;
279+ return true ;
235280 }
236281
237282 public bool SetUserStatus (
@@ -244,7 +289,8 @@ public bool SetUserStatus(
244289 ISet < string > enabledLIVendorIds ,
245290 ISet < string > disabledLIVendorIds )
246291 {
247- throw new NotImplementedException ( ) ;
292+ LogStub ( "SetUserStatus" ) ;
293+ return true ;
248294 }
249295
250296 public bool SetUserStatus (
@@ -253,17 +299,20 @@ public bool SetUserStatus(
253299 bool vendorsConsentStatus ,
254300 bool vendorsLIStatus )
255301 {
256- throw new NotImplementedException ( ) ;
302+ LogStub ( "SetUserStatus" ) ;
303+ return true ;
257304 }
258305
259306 public bool ShouldConsentBeCollected ( )
260307 {
261- throw new NotImplementedException ( ) ;
308+ LogStub ( "ShouldConsentBeCollected" ) ;
309+ return false ;
262310 }
263311
264312 public bool ShouldUserStatusBeCollected ( )
265313 {
266- throw new NotImplementedException ( ) ;
314+ LogStub ( "ShouldUserStatusBeCollected" ) ;
315+ return false ;
267316 }
268317
269318 public void ShowNotice ( )
@@ -294,22 +343,22 @@ private UnityEditorMockUI GetMockUIScript()
294343
295344 public void UpdateSelectedLanguage ( string languageCode )
296345 {
297- throw new NotImplementedException ( ) ;
346+ LogStub ( "UpdateSelectedLanguage" ) ;
298347 }
299348
300349 public void SetUser ( DidomiUserParameters userParameters )
301350 {
302- throw new NotImplementedException ( ) ;
351+ LogStub ( "SetUser" ) ;
303352 }
304353
305354 public void SetUserAndSetupUI ( DidomiUserParameters userParameters )
306355 {
307- throw new NotImplementedException ( ) ;
356+ LogStub ( "SetUserAndSetupUI" ) ;
308357 }
309358
310359 public void ClearUser ( )
311360 {
312- throw new NotImplementedException ( ) ;
361+ LogStub ( "ClearUser" ) ;
313362 }
314363 }
315364}
0 commit comments