com.usercentrics.sdk.static 0.0.0-stage → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/Documentation/LICENSE +2 -0
  2. package/Documentation/LICENSE.meta +7 -0
  3. package/Documentation/README +169 -0
  4. package/Documentation/README.meta +7 -0
  5. package/Documentation.meta +8 -0
  6. package/Editor/ATTLocalizationMessageDrawer.cs +92 -0
  7. package/Editor/ATTLocalizationMessageDrawer.cs.meta +11 -0
  8. package/Editor/AssemblyInfo.cs +4 -0
  9. package/Editor/AssemblyInfo.cs.meta +11 -0
  10. package/Editor/Unity.UsercentricsEditor.asmdef +18 -0
  11. package/Editor/Unity.UsercentricsEditor.asmdef.meta +7 -0
  12. package/Editor/UsercentricsATTPostProcessor.cs +125 -0
  13. package/Editor/UsercentricsATTPostProcessor.cs.meta +11 -0
  14. package/Editor/UsercentricsAndroidPostBuild.cs +45 -0
  15. package/Editor/UsercentricsAndroidPostBuild.cs.meta +11 -0
  16. package/Editor/UsercentricsAndroidSdkCheck.cs +29 -0
  17. package/Editor/UsercentricsAndroidSdkCheck.cs.meta +11 -0
  18. package/Editor/UsercentricsDependencies.xml +18 -0
  19. package/Editor/UsercentricsDependencies.xml.meta +7 -0
  20. package/Editor/UsercentricsExternalDependencyManagerBuildCheck.cs +56 -0
  21. package/Editor/UsercentricsExternalDependencyManagerBuildCheck.cs.meta +11 -0
  22. package/Editor/UsercentricsExternalDependencyManagerCheck.cs +34 -0
  23. package/Editor/UsercentricsExternalDependencyManagerCheck.cs.meta +11 -0
  24. package/Editor/UsercentricsIOSBuildFixes.cs +171 -0
  25. package/Editor/UsercentricsIOSBuildFixes.cs.meta +11 -0
  26. package/Editor/UsercentricsPBXProjectExtensions.cs +281 -0
  27. package/Editor/UsercentricsPBXProjectExtensions.cs.meta +11 -0
  28. package/Editor/UsercentricsPodfilePatches.cs +116 -0
  29. package/Editor/UsercentricsPodfilePatches.cs.meta +11 -0
  30. package/Editor/UsercentricsSentryExcludePostBuild.cs +77 -0
  31. package/Editor/UsercentricsSentryExcludePostBuild.cs.meta +11 -0
  32. package/Editor/UsercentricsSentryGradleExclude.cs +189 -0
  33. package/Editor/UsercentricsSentryGradleExclude.cs.meta +11 -0
  34. package/Editor/UsercentricsWelcomeDialog.cs +76 -0
  35. package/Editor/UsercentricsWelcomeDialog.cs.meta +11 -0
  36. package/Editor.meta +8 -0
  37. package/Prefabs/ATTManager.prefab +47 -0
  38. package/Prefabs/ATTManager.prefab.meta +7 -0
  39. package/Prefabs/Usercentrics.prefab +74 -0
  40. package/Prefabs/Usercentrics.prefab.meta +7 -0
  41. package/Prefabs.meta +8 -0
  42. package/Scripts/AppTrackingTransparency/AppTrackingTransparencyManager.cs +59 -0
  43. package/Scripts/AppTrackingTransparency/AppTrackingTransparencyManager.cs.meta +11 -0
  44. package/Scripts/AppTrackingTransparency/Model/ATTLocalizationMessage.cs +15 -0
  45. package/Scripts/AppTrackingTransparency/Model/ATTLocalizationMessage.cs.meta +11 -0
  46. package/Scripts/AppTrackingTransparency/Model/AuthorizationStatus.cs +10 -0
  47. package/Scripts/AppTrackingTransparency/Model/AuthorizationStatus.cs.meta +11 -0
  48. package/Scripts/AppTrackingTransparency/Model/Language.cs +136 -0
  49. package/Scripts/AppTrackingTransparency/Model/Language.cs.meta +11 -0
  50. package/Scripts/AppTrackingTransparency/Model.meta +8 -0
  51. package/Scripts/AppTrackingTransparency.cs +60 -0
  52. package/Scripts/AppTrackingTransparency.cs.meta +11 -0
  53. package/Scripts/AppTrackingTransparency.meta +8 -0
  54. package/Scripts/Internal/AssemblyInfo.cs +3 -0
  55. package/Scripts/Internal/AssemblyInfo.cs.meta +11 -0
  56. package/Scripts/Internal/AutoInitialize.cs +42 -0
  57. package/Scripts/Internal/AutoInitialize.cs.meta +11 -0
  58. package/Scripts/Internal/BannerSettings.cs +165 -0
  59. package/Scripts/Internal/BannerSettings.cs.meta +11 -0
  60. package/Scripts/Internal/ConsentUpdateSubscriptionCoordinator.cs +42 -0
  61. package/Scripts/Internal/ConsentUpdateSubscriptionCoordinator.cs.meta +11 -0
  62. package/Scripts/Internal/Data.cs +960 -0
  63. package/Scripts/Internal/Data.cs.meta +11 -0
  64. package/Scripts/Internal/Errors.cs +22 -0
  65. package/Scripts/Internal/Errors.cs.meta +11 -0
  66. package/Scripts/Internal/FirstLayerStyleSettings.cs +248 -0
  67. package/Scripts/Internal/FirstLayerStyleSettings.cs.meta +11 -0
  68. package/Scripts/Internal/IUsercentrics.cs +45 -0
  69. package/Scripts/Internal/IUsercentrics.cs.meta +11 -0
  70. package/Scripts/Internal/InspectorLink.cs +27 -0
  71. package/Scripts/Internal/InspectorLink.cs.meta +11 -0
  72. package/Scripts/Internal/Singleton.cs +68 -0
  73. package/Scripts/Internal/Singleton.cs.meta +11 -0
  74. package/Scripts/Internal/StringParser.cs +41 -0
  75. package/Scripts/Internal/StringParser.cs.meta +11 -0
  76. package/Scripts/Internal/UCConstants.cs +13 -0
  77. package/Scripts/Internal/UCConstants.cs.meta +11 -0
  78. package/Scripts/Internal/UnityConsentModeAdapter.cs +78 -0
  79. package/Scripts/Internal/UnityConsentModeAdapter.cs.meta +11 -0
  80. package/Scripts/Internal/UsercentricsAndroid.cs +210 -0
  81. package/Scripts/Internal/UsercentricsAndroid.cs.meta +11 -0
  82. package/Scripts/Internal/UsercentricsIOS.cs +307 -0
  83. package/Scripts/Internal/UsercentricsIOS.cs.meta +11 -0
  84. package/Scripts/Internal.meta +8 -0
  85. package/Scripts/Unity.Usercentrics.asmdef +14 -0
  86. package/Scripts/Unity.Usercentrics.asmdef.meta +7 -0
  87. package/Scripts/Usercentrics.cs +1160 -0
  88. package/Scripts/Usercentrics.cs.meta +11 -0
  89. package/Scripts.meta +8 -0
  90. package/UsercentricsInstallGuard/Usercentrics.InstallGuard.Static.asmdef +16 -0
  91. package/UsercentricsInstallGuard/Usercentrics.InstallGuard.Static.asmdef.meta +7 -0
  92. package/UsercentricsInstallGuard/UsercentricsInstallGuard.cs +82 -0
  93. package/UsercentricsInstallGuard/UsercentricsInstallGuard.cs.meta +11 -0
  94. package/UsercentricsInstallGuard.meta +8 -0
  95. package/iOS/TrackingTransparencyManager.h +13 -0
  96. package/iOS/TrackingTransparencyManager.h.meta +27 -0
  97. package/iOS/TrackingTransparencyManager.mm +99 -0
  98. package/iOS/TrackingTransparencyManager.mm.meta +37 -0
  99. package/iOS/Usercentrics.mm +228 -0
  100. package/iOS/Usercentrics.mm.meta +37 -0
  101. package/iOS/UsercentricsATTManager.mm +21 -0
  102. package/iOS/UsercentricsATTManager.mm.meta +37 -0
  103. package/iOS.meta +8 -0
  104. package/link.xml +24 -0
  105. package/link.xml.meta +7 -0
  106. package/package.json +10 -4
  107. package/package.json.meta +7 -0
  108. package/README.md +0 -3
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: dc76ef85fe2cf4ba9bb2972ef411df6d
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,22 @@
1
+ using System;
2
+
3
+ namespace Unity.Usercentrics
4
+ {
5
+ internal class Errors
6
+ {
7
+ public const string NOT_INITIALIZED_MSG = "Usercentrics is not initialized";
8
+ public const string PLATFORM_NOT_SUPPORTED_MSG = "Usercentrics does not " +
9
+ "support this platform. " +
10
+ "See the docs: https://usercentrics.com/docs/games/intro/";
11
+ }
12
+
13
+ public class NotInitializedException : Exception
14
+ {
15
+ public NotInitializedException() : base(Errors.NOT_INITIALIZED_MSG) { }
16
+ }
17
+
18
+ public class PlatformSupportException : Exception
19
+ {
20
+ public PlatformSupportException() : base(Errors.PLATFORM_NOT_SUPPORTED_MSG) { }
21
+ }
22
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 945a0522f20794dd98948889e9595227
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,248 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+
4
+ namespace Unity.Usercentrics
5
+ {
6
+ [Serializable]
7
+ public class FirstLayerStyleSettings
8
+ {
9
+ public UsercentricsLayout layout;
10
+ public HeaderImageSettings headerImage;
11
+ public TitleSettings title;
12
+ public MessageSettings message;
13
+ public ButtonLayout buttonLayout;
14
+ public string backgroundColor;
15
+ public float cornerRadius;
16
+ public string overlayColor;
17
+ public float overlayAlpha;
18
+
19
+ public FirstLayerStyleSettings(UsercentricsLayout layout)
20
+ {
21
+ this.layout = layout;
22
+ }
23
+
24
+ public FirstLayerStyleSettings(UsercentricsLayout layout,
25
+ HeaderImageSettings headerImage = null,
26
+ TitleSettings title = null,
27
+ MessageSettings message = null,
28
+ ButtonLayout buttonLayout = null,
29
+ string backgroundColor = "",
30
+ float cornerRadius = 0,
31
+ string overlayColor = "",
32
+ float overlayAlpha = 1f)
33
+ {
34
+ this.layout = layout;
35
+ this.headerImage = headerImage;
36
+ this.title = title;
37
+ this.message = message;
38
+ this.buttonLayout = buttonLayout;
39
+ this.backgroundColor = backgroundColor;
40
+ this.cornerRadius = cornerRadius;
41
+ this.overlayColor = overlayColor;
42
+ this.overlayAlpha = overlayAlpha;
43
+ }
44
+ }
45
+
46
+ [Serializable]
47
+ public enum UsercentricsLayout
48
+ {
49
+ Undefined,
50
+ Full,
51
+ Sheet,
52
+ PopupBottom,
53
+ PopupCenter
54
+ }
55
+
56
+ [Serializable]
57
+ public class HeaderImageSettings
58
+ {
59
+ public HeaderImageType imageType;
60
+ public string imageUrl;
61
+ public SectionAlignment alignment;
62
+ public float height;
63
+
64
+ public static HeaderImageSettings Undefined()
65
+ {
66
+ return new HeaderImageSettings(imageType: HeaderImageType.Undefined);
67
+ }
68
+
69
+ public static HeaderImageSettings Extended(string imageUrl)
70
+ {
71
+ return new HeaderImageSettings(imageType: HeaderImageType.Extended, imageUrl: imageUrl);
72
+ }
73
+
74
+ public static HeaderImageSettings Hidden()
75
+ {
76
+ return new HeaderImageSettings(imageType: HeaderImageType.Hidden);
77
+ }
78
+
79
+ public static HeaderImageSettings Custom(string imageUrl, SectionAlignment alignment, float height = 0f)
80
+ {
81
+ return new HeaderImageSettings(imageType: HeaderImageType.Custom, imageUrl: imageUrl, alignment: alignment, height: height);
82
+ }
83
+
84
+ private HeaderImageSettings(HeaderImageType imageType, string imageUrl = "")
85
+ {
86
+ this.imageType = imageType;
87
+ this.imageUrl = imageUrl;
88
+ }
89
+
90
+ private HeaderImageSettings(HeaderImageType imageType, string imageUrl, SectionAlignment alignment, float height = 0f)
91
+ {
92
+ this.imageType = imageType;
93
+ this.imageUrl = imageUrl;
94
+ this.alignment = alignment;
95
+ this.height = height;
96
+ }
97
+ }
98
+
99
+ [Serializable]
100
+ public enum HeaderImageType
101
+ {
102
+ Undefined,
103
+ Extended,
104
+ Custom,
105
+ Hidden
106
+ }
107
+
108
+ [Serializable]
109
+ public class TitleSettings
110
+ {
111
+ // public Typeface font;
112
+ public SectionAlignment alignment;
113
+ public float textSize;
114
+ public string textColor;
115
+
116
+ public TitleSettings(SectionAlignment alignment, float textSize = 0f, string textColor = "")
117
+ {
118
+ this.alignment = alignment;
119
+ this.textSize = textSize;
120
+ this.textColor = textColor;
121
+ }
122
+ }
123
+
124
+ [Serializable]
125
+ public class MessageSettings
126
+ {
127
+ // public Typeface font;
128
+ public float textSize;
129
+ public SectionAlignment alignment;
130
+ public string textColor;
131
+ public string linkTextColor;
132
+ public bool underlineLink;
133
+
134
+ public MessageSettings(float textSize, SectionAlignment alignment, string textColor, string linkTextColor, bool underlineLink)
135
+ {
136
+ this.textSize = textSize;
137
+ this.alignment = alignment;
138
+ this.textColor = textColor;
139
+ this.linkTextColor = linkTextColor;
140
+ this.underlineLink = underlineLink;
141
+ }
142
+ }
143
+
144
+ [Serializable]
145
+ public enum SectionAlignment
146
+ {
147
+ Undefined,
148
+ Start,
149
+ Center,
150
+ End
151
+ }
152
+
153
+ [Serializable]
154
+ public class ButtonLayout
155
+ {
156
+ public ButtonLayoutType type;
157
+ public List<ButtonSettings> buttons;
158
+ public List<ButtonSettingsRow> gridButtons;
159
+
160
+ public static ButtonLayout Undefined()
161
+ {
162
+ return new ButtonLayout(type: ButtonLayoutType.Undefined, buttons: new List<ButtonSettings>());
163
+ }
164
+
165
+ public static ButtonLayout Grid(List<ButtonSettingsRow> buttons)
166
+ {
167
+ return new ButtonLayout(gridButtons: buttons);
168
+ }
169
+
170
+ public static ButtonLayout Column(List<ButtonSettings> buttons)
171
+ {
172
+ return new ButtonLayout(type: ButtonLayoutType.Column, buttons: buttons);
173
+ }
174
+
175
+ public static ButtonLayout Row(List<ButtonSettings> buttons)
176
+ {
177
+ return new ButtonLayout(type: ButtonLayoutType.Row, buttons: buttons);
178
+ }
179
+
180
+ private ButtonLayout(ButtonLayoutType type, List<ButtonSettings> buttons)
181
+ {
182
+ this.type = type;
183
+ this.buttons = buttons;
184
+ }
185
+
186
+ private ButtonLayout(List<ButtonSettingsRow> gridButtons)
187
+ {
188
+ this.type = ButtonLayoutType.Grid;
189
+ this.gridButtons = gridButtons;
190
+ }
191
+ }
192
+
193
+ [Serializable]
194
+ public enum ButtonLayoutType
195
+ {
196
+ Undefined,
197
+ Column,
198
+ Row,
199
+ Grid
200
+ }
201
+
202
+ [Serializable]
203
+ public class ButtonSettingsRow
204
+ {
205
+ public List<ButtonSettings> buttons;
206
+
207
+ public ButtonSettingsRow(List<ButtonSettings> buttons)
208
+ {
209
+ this.buttons = buttons;
210
+ }
211
+ }
212
+
213
+
214
+ [Serializable]
215
+ public class ButtonSettings
216
+ {
217
+ public ButtonType type;
218
+ // public Typeface font;
219
+ public float textSize;
220
+ public string textColor;
221
+ public string backgroundColor;
222
+ public float cornerRadius;
223
+ public bool isAllCaps;
224
+
225
+ public ButtonSettings(ButtonType type)
226
+ {
227
+ this.type = type;
228
+ }
229
+
230
+ public ButtonSettings(ButtonType type, float textSize = 0f, string textColor = "", string backgroundColor = "", float cornerRadius = 0, bool isAllCaps = false)
231
+ {
232
+ this.type = type;
233
+ this.textSize = textSize;
234
+ this.textColor = textColor;
235
+ this.backgroundColor = backgroundColor;
236
+ this.cornerRadius = cornerRadius;
237
+ this.isAllCaps = isAllCaps;
238
+ }
239
+ }
240
+
241
+ [Serializable]
242
+ public enum ButtonType {
243
+ AcceptAll,
244
+ DenyAll,
245
+ More,
246
+ Save
247
+ }
248
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 5f032ebf77db84f778424c7d5cb68ddf
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,45 @@
1
+ using System.Collections.Generic;
2
+
3
+ namespace Unity.Usercentrics
4
+ {
5
+ internal interface IUsercentricsPlatform
6
+ {
7
+ void Initialize(string initArgsJson);
8
+ void ShowFirstLayer(string bannerSettingsJson);
9
+ void ShowSecondLayer(string bannerSettingsJson);
10
+ void ShowSecondLayer(string bannerSettingsJson, string tab);
11
+ string GetControllerID();
12
+ void GetTCFData();
13
+ void RestoreUserSession(string controllerId);
14
+ void SubscribeOnConsentUpdated();
15
+ void DisposeOnConsentUpdatedSubscription();
16
+ string GetUSPData();
17
+ string GetFirstLayerSettings();
18
+ void AcceptAll();
19
+ void DenyAll(string unsavedPurposeLIDecisions = null, string unsavedVendorLIDecisions = null);
20
+ void AcceptAllForGDPR();
21
+ void DenyAllForGDPR();
22
+ void Track(int eventType);
23
+ void SetCmpId(int cmpId);
24
+ string GetCmpData();
25
+ void SetABTestingVariant(string variant);
26
+ string GetABTestingVariant();
27
+ void SubscribeOnConsentMediation();
28
+ void DisposeOnConsentMediationSubscription();
29
+ string GetAdditionalConsentModeData();
30
+ string GetConsents();
31
+ void ClearUserSession();
32
+ void NotifyLoginSuccess();
33
+ void NotifySubscribeSuccess();
34
+ void NotifySubscriptionLapsed();
35
+ string SaveDecisionsForGDPR(string decisions);
36
+ string GetDpsMetadata(string templateId);
37
+ string GetGPPData();
38
+ string GetGPPString();
39
+ void SetGPPConsent(string args);
40
+ void SubscribeOnGppSectionChange();
41
+ void DisposeOnGppSectionChangeSubscription();
42
+ void ChangeLanguage(string language);
43
+ void SetAgeSignal(string signalJson);
44
+ }
45
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0b45361b595ab4bb3842f1368410e95b
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,27 @@
1
+ #if UNITY_EDITOR
2
+ using UnityEngine;
3
+ using UnityEditor;
4
+
5
+ namespace Unity.Usercentrics
6
+ {
7
+ internal class InspectorLinkAttribute : PropertyAttribute { }
8
+
9
+ [CustomPropertyDrawer(typeof(InspectorLinkAttribute))]
10
+ internal class InspectorLinkDrawer : PropertyDrawer
11
+ {
12
+ public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
13
+ {
14
+ var linkUrl = prop.stringValue;
15
+ EditorGUI.LabelField(position, label.text, linkUrl);
16
+
17
+ bool linkClicked = Event.current.rawType == EventType.MouseDown &&
18
+ Event.current.button == 0 &&
19
+ position.Contains(Event.current.mousePosition);
20
+ if (linkClicked)
21
+ {
22
+ Help.BrowseURL(linkUrl);
23
+ }
24
+ }
25
+ }
26
+ }
27
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 72a273385a3044233990ee22f301109a
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,68 @@
1
+ using UnityEngine;
2
+
3
+ /// <summary>
4
+ /// Inherit from this base class to create a singleton.
5
+ /// e.g. public class MyClassName : Singleton<MyClassName> {}
6
+ /// </summary>
7
+ namespace Unity.Usercentrics
8
+ {
9
+ public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
10
+ {
11
+ // Check to see if we're about to be destroyed.
12
+ private static bool m_ShuttingDown = false;
13
+ private static object m_Lock = new object();
14
+ private static T m_Instance;
15
+
16
+ /// <summary>
17
+ /// Access singleton instance through this propriety.
18
+ /// </summary>
19
+ public static T Instance
20
+ {
21
+ get
22
+ {
23
+ if (m_ShuttingDown)
24
+ {
25
+ Debug.LogWarning("[Singleton] Instance '" + typeof(T) +
26
+ "' already destroyed. Returning null.");
27
+ return null;
28
+ }
29
+
30
+ lock (m_Lock)
31
+ {
32
+ if (m_Instance == null)
33
+ {
34
+ // Search for existing instance.
35
+ #if UNITY_2023_1_OR_NEWER
36
+ m_Instance = (T)FindAnyObjectByType(typeof(T));
37
+ #else
38
+ m_Instance = (T)FindObjectOfType(typeof(T));
39
+ #endif
40
+
41
+ // Create new instance if one doesn't already exist.
42
+ if (m_Instance == null)
43
+ {
44
+ // Need to create a new GameObject to attach the singleton to.
45
+ var singletonObject = new GameObject();
46
+ m_Instance = singletonObject.AddComponent<T>();
47
+ singletonObject.name = typeof(T).ToString() + " (Singleton)";
48
+ }
49
+ }
50
+
51
+ return m_Instance;
52
+ }
53
+ }
54
+ }
55
+
56
+
57
+ private void OnApplicationQuit()
58
+ {
59
+ m_ShuttingDown = true;
60
+ }
61
+
62
+
63
+ private void OnDestroy()
64
+ {
65
+ m_ShuttingDown = true;
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: b85d1a24913c743159eceb5b7ade6789
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,41 @@
1
+ using System.Globalization;
2
+
3
+ namespace Unity.Usercentrics
4
+ {
5
+ internal class StringParser
6
+ {
7
+ public static bool? ToBool(string input)
8
+ {
9
+ if (input == "true")
10
+ {
11
+ return true;
12
+ }
13
+ else if (input == "false")
14
+ {
15
+ return false;
16
+ }
17
+ return null;
18
+ }
19
+
20
+ public static int? ToInt(string input)
21
+ {
22
+ if (input == "null") return null;
23
+ return int.TryParse(input, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)
24
+ ? result : (int?)null;
25
+ }
26
+
27
+ public static double? ToDouble(string input)
28
+ {
29
+ if (input == "null") return null;
30
+ return double.TryParse(input, NumberStyles.Float | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out var result)
31
+ ? result : (double?)null;
32
+ }
33
+
34
+ public static long? ToLong(string input)
35
+ {
36
+ if (input == "null") return null;
37
+ return long.TryParse(input, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)
38
+ ? result : (long?)null;
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 40f80ed9c4c2343cfa1f84d121b88dd8
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,13 @@
1
+ 
2
+ namespace Unity.Usercentrics
3
+ {
4
+ public class UCConstants
5
+ {
6
+ public static readonly string REQUIREMENTS_URL = "https://usercentrics.com/docs/games/intro/";
7
+ public static readonly string UNITY_EDITOR_MESSAGE = "Usercentrics does not support the Unity Editor. Please use an iOS or Android simulator or device.";
8
+
9
+ // The native SDK delivers its callbacks with UnitySendMessage and picks the target GameObject name
10
+ // itself, on both Android and iOS. The prefab instance has to keep this name.
11
+ public static readonly string GAME_OBJECT_NAME = "Usercentrics";
12
+ }
13
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: c2fb721d035f84aa2a65cc6d94f90841
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,78 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Linq;
4
+ using UnityEngine;
5
+ #if ENABLE_UNITY_CONSENT
6
+ using UnityEngine.UnityConsent;
7
+ #endif
8
+
9
+ namespace Unity.Usercentrics
10
+ {
11
+ /// <summary>
12
+ /// Maps Usercentrics consent decisions onto Unity's End-User Consent Mode API
13
+ /// (Unity Vector), calling EndUserConsent.SetConsentState with AnalyticsIntent
14
+ /// and AdsIntent derived from the current UC consent state.
15
+ ///
16
+ /// This adapter is Unity-local: it is not part of the native MediationSDK
17
+ /// pipeline and never touches the legacy Unity Ads privacy.consent/gdpr.consent
18
+ /// MetaData calls, which remain handled natively and unaffected.
19
+ /// </summary>
20
+ internal class UnityConsentModeAdapter
21
+ {
22
+ private readonly UnityConsentModeOptions options;
23
+ private readonly Action<string> logDebug;
24
+
25
+ // UnityEngine.UnityConsent.EndUserConsent is compiled into the Unity Engine itself
26
+ // (requires Unity 6.5+) rather than being an installable package, so ENABLE_UNITY_CONSENT
27
+ // is the Editor-provided compile-time signal for whether it's available - matching the
28
+ // guard pattern Unity's own com.unity.services.analytics package uses for this same API.
29
+ private bool hasWarnedUnsupported;
30
+
31
+ public UnityConsentModeAdapter(UnityConsentModeOptions options, Action<string> logDebug)
32
+ {
33
+ this.options = options;
34
+ this.logDebug = logDebug;
35
+ }
36
+
37
+ public void Apply(List<UsercentricsServiceConsent> consents)
38
+ {
39
+ if (options == null || !options.Enabled)
40
+ {
41
+ return;
42
+ }
43
+
44
+ #if ENABLE_UNITY_CONSENT
45
+ var analyticsGranted = ResolveIntent(consents, options.AnalyticsCategorySlugs);
46
+ var adsGranted = ResolveIntent(consents, options.AdsCategorySlugs);
47
+
48
+ var consentState = new ConsentState
49
+ {
50
+ AnalyticsIntent = analyticsGranted ? ConsentStatus.Granted : ConsentStatus.Denied,
51
+ AdsIntent = adsGranted ? ConsentStatus.Granted : ConsentStatus.Denied
52
+ };
53
+
54
+ EndUserConsent.SetConsentState(consentState);
55
+ logDebug?.Invoke($"UnityConsentMode: SetConsentState AnalyticsIntent={consentState.AnalyticsIntent} AdsIntent={consentState.AdsIntent}");
56
+ #else
57
+ if (!hasWarnedUnsupported)
58
+ {
59
+ hasWarnedUnsupported = true;
60
+ Debug.LogWarning("[USERCENTRICS] UnityConsentMode is enabled but this Unity Editor version does not support " +
61
+ "UnityEngine.UnityConsent.EndUserConsent (requires Unity 6.5+). SetConsentState will not be called.");
62
+ }
63
+ #endif
64
+ }
65
+
66
+ // A category is granted when at least one of its mapped services has been consented to.
67
+ // Accept-all/deny-all fall out of this naturally since every service's status moves together.
68
+ internal static bool ResolveIntent(List<UsercentricsServiceConsent> consents, List<string> categorySlugs)
69
+ {
70
+ if (consents == null || categorySlugs == null || categorySlugs.Count == 0)
71
+ {
72
+ return false;
73
+ }
74
+
75
+ return consents.Any(service => service.status && categorySlugs.Contains(service.category));
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: e4ea7f836cae421582fae095e843e31a
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: