com.amanotes.gdk 0.2.81-a4 → 0.2.81-alpha.11

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 (45) hide show
  1. package/CHANGELOG.md +0 -12
  2. package/Editor/Extra/GDKCIBuildCommand.cs +57 -55
  3. package/Extra/AmaGDKInstaller.unitypackage +0 -0
  4. package/Extra/AutoEventQC.unitypackage +0 -0
  5. package/Extra/CheckDiskSpace.unitypackage +0 -0
  6. package/Extra/Consent.unitypackage +0 -0
  7. package/Extra/CrashlyticHook.unitypackage +0 -0
  8. package/Extra/ForceUpdate.unitypackage +0 -0
  9. package/Extra/LegacyGDKUpdateHelper.unitypackage +0 -0
  10. package/Extra/PostProcessor.unitypackage +0 -0
  11. package/Packages/AmaGDKConfig.unitypackage +0 -0
  12. package/Packages/AmaGDKExample.unitypackage +0 -0
  13. package/Packages/AmaGDKTest.unitypackage +0 -0
  14. package/Packages/AppsFlyerAdapter.PurchaseConnector.unitypackage +0 -0
  15. package/Packages/AppsFlyerAdapter.unitypackage +0 -0
  16. package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
  17. package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
  18. package/Packages/IronSourceAdapter.AdQuality.unitypackage +0 -0
  19. package/Packages/IronSourceAdapter.unitypackage +0 -0
  20. package/Packages/MaxAdNetworkAdapter.unitypackage +0 -0
  21. package/Packages/RevenueCatAdapter.unitypackage +0 -0
  22. package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
  23. package/Runtime/Ad/AmaGDK.Ads.cs +2 -1
  24. package/Runtime/AmaGDK.Analytics.cs +3 -9
  25. package/Runtime/AmaGDK.IAP.cs +1 -1
  26. package/Runtime/AmaGDK.UserProfile.cs +2 -2
  27. package/Runtime/AmaGDK.cs +1 -1
  28. package/Runtime/Consent/AmaGDK.Consent.cs +224 -0
  29. package/Runtime/Consent/GDKPrivacyButton.cs +25 -0
  30. package/Runtime/Consent/GDKPrivacyButton.cs.meta +3 -0
  31. package/Runtime/Consent/GDKPrivacyButton.prefab +148 -0
  32. package/Runtime/Consent/GDKPrivacyButton.prefab.meta +7 -0
  33. package/Runtime/Consent.meta +3 -0
  34. package/Runtime/Core/GDKDebug.cs +31 -17
  35. package/Runtime/Core/GDKTaskTracker.cs +118 -0
  36. package/Runtime/Core/GDKTaskTracker.cs.meta +3 -0
  37. package/Runtime/GDKAudio/Plugins.meta +8 -0
  38. package/Runtime/GDKAudio.meta +8 -0
  39. package/Runtime/Internal/AmaGDK.Utils.cs +1 -1
  40. package/Runtime/Internal/ForceQuitMonitor.cs +1 -1
  41. package/Runtime/Utils/GDKFileUtils.cs +1 -1
  42. package/Runtime/Utils/GDKUtils.cs +8 -0
  43. package/package.json +4 -4
  44. package/Runtime/AmaGDK.Consent.cs +0 -256
  45. /package/Runtime/{AmaGDK.Consent.cs.meta → Consent/AmaGDK.Consent.cs.meta} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,14 +1,3 @@
1
- # Changelog
2
-
3
- ## [0.2.81-a4] - 2024-11-21
4
- - [Dev] Add GDKPostBuild for iOS
5
- - [Dev] Improve GDK editor experience before config asset imported
6
- - [Dev] Analytics save file in async
7
- - [Dev] Move GDKFileUtils to a separated file
8
- - [Dev] Update game ops model
9
- - [Dev] Add ABLab
10
- - [Dev] Move imported GDK Adapter from RawData to Modules
11
-
12
1
  ## [0.2.80] - 2024-11-13
13
2
  - [Dev] Don't use obsolete functions
14
3
  - [Dev] Add CrashlyticHook
@@ -23,7 +12,6 @@
23
12
  - [Dev] Track Adapters and Third-party packages used in games
24
13
 
25
14
  ## [0.2.77] - 2024-11-07
26
- - [Release] 0.2.76
27
15
  - [Dev] Remove GDKAudio
28
16
  - [Dev] Handle format exception in RemoteConfig
29
17
  - [Dev] Handle exception of FetchConfig
@@ -17,22 +17,27 @@ namespace Amanotes.Core
17
17
  private const string KEY_ALIAS_NAME = "KEY_ALIAS_NAME";
18
18
  private const string KEYSTORE = "keystore.keystore";
19
19
  private const string BUILD_OPTIONS_ENV_VAR = "BuildOptions";
20
- private const string ANDROID_BUNDLE_VERSION_CODE = "VERSION_BUILD_VAR";
21
20
  private const string ANDROID_APP_BUNDLE = "BUILD_APP_BUNDLE";
22
21
  private const string SCRIPTING_BACKEND_ENV_VAR = "SCRIPTING_BACKEND";
23
22
  private const string EXPORT_ANDROID_PROJECT = "EXPORT_ANDROID_PROJECT";
24
23
  private const string VERSION_NUMBER_VAR = "VERSION_NUMBER_VAR";
25
- private const string VERSION_iOS = "VERSION_BUILD_VAR";
24
+ private const string VERSION_BUILD_VAR = "VERSION_BUILD_VAR";
26
25
 
27
26
  public static void InstallPod(EventHandler processExit, string buildPath = null)
28
27
  {
29
28
  try
30
29
  {
31
- var arguments = $"-c \"/usr/local/bin/pod install --project-directory={buildPath}\"";
30
+ string arguments = "";
32
31
  if (Application.isBatchMode && TryGetEnv("CI_SCRIPT_DIR", out string scriptDir))
33
32
  {
34
33
  arguments = $"{scriptDir}/utils.sh pod-install";
35
34
  }
35
+ else if (!Application.isBatchMode)
36
+ {
37
+ string podPath = "/usr/local/bin/pod";
38
+ if (!File.Exists(podPath)) podPath = "/opt/homebrew/bin/pod";
39
+ arguments = $"-c \"{podPath} install --project-directory={buildPath}\"";
40
+ }
36
41
 
37
42
  // Configure process start info
38
43
  var startInfo = new ProcessStartInfo
@@ -57,12 +62,6 @@ namespace Amanotes.Core
57
62
  if (args.Data == null) return; // End of the stream
58
63
  Debug.Log(args.Data);
59
64
  };
60
-
61
- // proc.ErrorDataReceived += (sender, args) =>
62
- // {
63
- // if (args.Data == null) return; // End of the stream
64
- // Debug.LogError(args.Data);
65
- // };
66
65
 
67
66
  proc.Exited += processExit;
68
67
 
@@ -71,9 +70,6 @@ namespace Amanotes.Core
71
70
  proc.BeginOutputReadLine();
72
71
  proc.BeginErrorReadLine();
73
72
  proc.WaitForExit();
74
-
75
- // Log exit code
76
- // Debug.LogWarning("Process exited with code: " + proc.ExitCode);
77
73
  }
78
74
  catch (Exception e)
79
75
  {
@@ -245,20 +241,16 @@ namespace Amanotes.Core
245
241
  var buildTarget = GetBuildTarget();
246
242
 
247
243
  Console.WriteLine(":: Performing build");
248
- if (TryGetEnv(VERSION_NUMBER_VAR, out var bundleVersionNumber))
244
+ if (TryGetEnv(VERSION_NUMBER_VAR, out string bundleVersionNumber))
249
245
  {
250
- if (buildTarget == BuildTarget.iOS)
251
- {
252
- bundleVersionNumber = GetIosVersion();
253
- }
254
246
  Console.WriteLine($":: Setting bundleVersionNumber to '{bundleVersionNumber}' (Length: {bundleVersionNumber.Length})");
255
247
  PlayerSettings.bundleVersion = bundleVersionNumber;
256
248
  }
249
+ HandleBuildNumber(buildTarget);
257
250
 
258
251
  if (buildTarget == BuildTarget.Android)
259
252
  {
260
253
  HandleAndroidAppBundle();
261
- HandleAndroidBundleVersionCode();
262
254
  HandleAndroidKeystore();
263
255
  HandleDebugSymbols();
264
256
  HandleExportAndroidProject();
@@ -276,6 +268,7 @@ namespace Amanotes.Core
276
268
  if (buildReport.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
277
269
  throw new Exception($"Build ended with {buildReport.summary.result} status");
278
270
 
271
+ BuildMetadata.Save(buildPath, buildTarget);
279
272
  Console.WriteLine(":: Done with build");
280
273
  }
281
274
 
@@ -299,18 +292,24 @@ namespace Amanotes.Core
299
292
  }
300
293
  }
301
294
 
302
- private static void HandleAndroidBundleVersionCode()
295
+ private static void HandleBuildNumber(BuildTarget buildTarget)
303
296
  {
304
- if (TryGetEnv(ANDROID_BUNDLE_VERSION_CODE, out string value))
297
+ if (!TryGetEnv(VERSION_BUILD_VAR, out string value)) return;
298
+ if (int.TryParse(value, out int version))
305
299
  {
306
- if (int.TryParse(value, out int version))
300
+ if (buildTarget == BuildTarget.Android)
307
301
  {
308
- PlayerSettings.Android.bundleVersionCode = version;
309
- Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected, set the bundle version code to {value}.");
302
+ PlayerSettings.Android.bundleVersionCode = version;
310
303
  }
311
- else
312
- Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected but the version value \"{value}\" is not an integer.");
304
+ else if (buildTarget == BuildTarget.iOS)
305
+ {
306
+ PlayerSettings.iOS.buildNumber = version.ToString();
307
+ }
308
+
309
+ Console.WriteLine($":: {VERSION_BUILD_VAR} env var detected, set the bundle version code to {value}.");
313
310
  }
311
+ else
312
+ Console.WriteLine($":: {VERSION_BUILD_VAR} env var detected but the version value \"{value}\" is not an integer.");
314
313
  }
315
314
 
316
315
  private static void HandleExportAndroidProject()
@@ -323,22 +322,6 @@ namespace Amanotes.Core
323
322
  }
324
323
  }
325
324
 
326
- private static string GetIosVersion()
327
- {
328
- if (TryGetEnv(VERSION_iOS, out string value))
329
- {
330
- if (int.TryParse(value, out int version))
331
- {
332
- Console.WriteLine($":: {VERSION_iOS} env var detected, set the version to {value}.");
333
- return version.ToString();
334
- }
335
- else
336
- Console.WriteLine($":: {VERSION_iOS} env var detected but the version value \"{value}\" is not an integer.");
337
- }
338
-
339
- throw new ArgumentNullException(nameof(value), $":: Error finding {VERSION_iOS} env var");
340
- }
341
-
342
325
  private static void HandleAndroidKeystore()
343
326
  {
344
327
  #if UNITY_2019_1_OR_NEWER
@@ -394,6 +377,31 @@ namespace Amanotes.Core
394
377
  }
395
378
  }
396
379
 
380
+ [Serializable]
381
+ public class BuildMetadata
382
+ {
383
+ public string appVersion;
384
+ public string buildNumber;
385
+ public string buildTarget;
386
+
387
+ public static void Save(string buildPath, BuildTarget buildTarget)
388
+ {
389
+ string outputFile = Path.Combine(buildPath, "build_info.json");
390
+
391
+ var metadata = new BuildMetadata
392
+ {
393
+ appVersion = PlayerSettings.bundleVersion,
394
+ buildNumber = buildTarget == BuildTarget.Android ? PlayerSettings.Android.bundleVersionCode.ToString() : PlayerSettings.iOS.buildNumber,
395
+ buildTarget = buildTarget.ToString()
396
+ };
397
+
398
+ string json = JsonUtility.ToJson(metadata, prettyPrint: true);
399
+ File.WriteAllText(outputFile, json);
400
+
401
+ Console.WriteLine($":: Build information saved to {outputFile}");
402
+ }
403
+ }
404
+
397
405
  public class GDKPreProcessBuild: IPreprocessBuildWithReport
398
406
  {
399
407
  public int callbackOrder
@@ -402,20 +410,14 @@ namespace Amanotes.Core
402
410
  }
403
411
  public void OnPreprocessBuild(BuildReport report)
404
412
  {
405
- if (report.summary.platform == BuildTarget.Android)
406
- {
407
- // Change Gradle path when running in headless mode (CI Machine)
408
- if (Application.isBatchMode)
409
- {
410
- if (GDKCIBuildCommand.TryGetEnv("GRADLE_PATH", out string envGradlePath))
411
- {
412
- EditorPrefs.SetBool("GradleUseEmbedded", false);
413
- EditorPrefs.SetString("GradlePath", envGradlePath);
414
- Debug.Log("Update gradle path to: " + envGradlePath);
415
- }
416
- }
417
- }
418
-
413
+ if (report.summary.platform != BuildTarget.Android) return;
414
+ // Change Gradle path when running in headless mode (CI Machine)
415
+ if (!Application.isBatchMode) return;
416
+ if (!GDKCIBuildCommand.TryGetEnv("GRADLE_PATH", out string envGradlePath)) return;
417
+ EditorPrefs.SetBool("GradleUseEmbedded", false);
418
+ EditorPrefs.SetString("GradlePath", envGradlePath);
419
+ Debug.Log("Update gradle path to: " + envGradlePath);
420
+
419
421
  }
420
422
  }
421
423
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -93,7 +93,7 @@ namespace Amanotes.Core
93
93
 
94
94
  internal void Save()
95
95
  {
96
- this.SaveJsonToFile(false);
96
+ this.SaveJsonToFile();
97
97
  }
98
98
  }
99
99
 
@@ -345,6 +345,7 @@ namespace Amanotes.Core.Internal
345
345
  {
346
346
  protected AdShowContext context => Ads.context;
347
347
  protected AdModuleConfig moduleConfig => Config.ad;
348
+ public Dictionary<string, object> userData => context?.userData;
348
349
 
349
350
  // APIs
350
351
  internal protected abstract AdLogic interstitial { get; }
@@ -135,7 +135,7 @@ namespace Amanotes.Core
135
135
 
136
136
  if (!localData._dirty) return;
137
137
  localData._dirty = false;
138
- localData.SaveJsonToFile(true); // immediately = true
138
+ localData.SaveJsonToFile();
139
139
  }
140
140
 
141
141
  public static IEventParamsBuilder LogFunnelEvent(string eventName, string signature = "")
@@ -314,7 +314,7 @@ namespace Amanotes.Core
314
314
  internal static readonly GDKPool.Pool<EventParams> epPool = new GDKPool.Pool<EventParams>(1);
315
315
 
316
316
  private static readonly Lazy<AnalyticsData> _localData = new Lazy<AnalyticsData>(
317
- () => new AnalyticsData().ReloadDataFromLocal());
317
+ () => new AnalyticsData().LoadJsonFromFile().BuildCache());
318
318
  internal static AnalyticsData localData => _localData.Value;
319
319
 
320
320
  internal static readonly Dictionary<string, string> reservedPrefixes = new Dictionary<string, string>()
@@ -800,12 +800,6 @@ namespace Amanotes.Core
800
800
  return this;
801
801
  }
802
802
 
803
- public AnalyticsData ReloadDataFromLocal()
804
- {
805
- this.LoadJsonFromFile().BuildCache();
806
- return this;
807
- }
808
-
809
803
  internal EventDetail GetEventDetail(string eventName, bool autoNew = false)
810
804
  {
811
805
  if (string.IsNullOrEmpty(eventName)) return null;
@@ -849,7 +843,7 @@ namespace Amanotes.Core
849
843
  if (!Config.analytics.autoFlushEventDetail) return;
850
844
  if (!_dirty) return;
851
845
  _dirty = false;
852
- this.SaveJsonToFile(false);
846
+ this.SaveJsonToFile();
853
847
  }
854
848
 
855
849
  internal void UpdateMigrationLog()
@@ -306,7 +306,7 @@ namespace Amanotes.Core
306
306
  subscriptionExpiredDate = _subscriptionExpiredDate?.ToString(DATE_FORMAT);
307
307
  _unsubscribedDate = Adapter.GetUnsubscribedDate();
308
308
  unsubscribedDate = _unsubscribedDate?.ToString(DATE_FORMAT);
309
- this.SaveJsonToFile(false);
309
+ this.SaveJsonToFile();
310
310
  }
311
311
  }
312
312
  }
@@ -33,14 +33,14 @@ namespace Amanotes.Core
33
33
  private bool _dirty = false;
34
34
  private void Save()
35
35
  {
36
- this.SaveJsonToFile(false);
36
+ this.SaveJsonToFile();
37
37
  }
38
38
 
39
39
  private void SaveIfDirty()
40
40
  {
41
41
  if (!_dirty) return;
42
42
  _dirty = false;
43
- this.SaveJsonToFile(false);
43
+ this.SaveJsonToFile();
44
44
  }
45
45
  }
46
46
 
package/Runtime/AmaGDK.cs CHANGED
@@ -27,7 +27,7 @@ namespace Amanotes.Core
27
27
  {
28
28
  public partial class AmaGDK : MonoBehaviour
29
29
  {
30
- public const string VERSION = "0.2.81-a4";
30
+ public const string VERSION = "v0.2.81-alpha.11";
31
31
 
32
32
  internal static Status _status = Status.None;
33
33
  internal static ConfigAsset _config = null;
@@ -0,0 +1,224 @@
1
+ using System;
2
+ using Amanotes.Core.Internal;
3
+ using UnityEngine;
4
+ using static Amanotes.Core.GDKDebug;
5
+
6
+ namespace Amanotes.Core
7
+ {
8
+ public partial class AmaGDK //Consent
9
+ {
10
+ public static partial class Consent //Public
11
+ {
12
+ private static readonly GDKTaskTracker _allConsentTaskTracker = new GDKTaskTracker();
13
+ public static void RequestAllConsents(Action onComplete)
14
+ {
15
+ _allConsentTaskTracker.RegisterOnCompleteCallback(onComplete);
16
+ if (_allConsentTaskTracker.HasStarted) return;
17
+
18
+ _allConsentTaskTracker.MarkStarted();
19
+
20
+ void CompleteRequestAllConsents()
21
+ {
22
+ _allConsentTaskTracker.MarkCompleted();
23
+ }
24
+ void ShowConsentIfRequired()
25
+ {
26
+ CMP.ShowConsentFormIfRequired(
27
+ _ => CompleteRequestAllConsents(),
28
+ _ => CompleteRequestAllConsents());
29
+ }
30
+ #if UNITY_IOS
31
+ ATT.Request(
32
+ allow =>
33
+ {
34
+ if (allow)
35
+ {
36
+ ShowConsentIfRequired();
37
+ return;
38
+ }
39
+ CompleteRequestAllConsents();
40
+ });
41
+ #else
42
+ ShowConsentIfRequired();
43
+ #endif
44
+ }
45
+ }
46
+
47
+ public static partial class Consent //ATT
48
+ {
49
+ public static class ATT
50
+ {
51
+ public static bool IsAllowed
52
+ {
53
+ get
54
+ {
55
+ if (checkedATT) return allowedATT;
56
+ LogWarning("[Consent] ATT has not completed yet");
57
+ return false;
58
+ }
59
+ }
60
+
61
+ public static void Request(Action<bool> onComplete)
62
+ {
63
+ if (checkedATT)
64
+ {
65
+ Log("[Consent] ATT has already completed");
66
+ onComplete?.Invoke(allowedATT);
67
+ return;
68
+ }
69
+ if (ConsentHook.ATTRequest == null)
70
+ {
71
+ LogWarning("[Consent] ConsentHook.ATTRequest is not implemented");
72
+ onComplete?.Invoke(false);
73
+ return;
74
+ }
75
+
76
+ ConsentHook.ATTRequest(isAllowed =>
77
+ {
78
+ data.att = isAllowed ? Status.Allowed : Status.NotAllowed;
79
+ data.SaveJsonToFile();
80
+ onComplete?.Invoke(allowedATT);
81
+ });
82
+ }
83
+ }
84
+
85
+ }
86
+
87
+ public static partial class Consent //CMP
88
+ {
89
+ public static class CMP
90
+ {
91
+ /// <summary>
92
+ /// Determines if a consent popup should be shown to the user and displays it if required.
93
+ /// The consent popup will be shown only once in the lifecycle of the app if this function is used.
94
+ /// </summary>
95
+ /// <remarks>
96
+ /// The consent popup is required in the European Economic Area (EEA) and
97
+ /// other countries that have implemented the General Data Protection Regulation (GDPR).
98
+ /// </remarks>
99
+ /// <param name="onComplete">Callback invoked with a boolean indicating the
100
+ /// ConsentInformation.CanRequestAds() result
101
+ /// </param>
102
+ /// <param name="onError">Callback invoked with an error message if the consent
103
+ /// form could not be loaded or shown.</param>
104
+ public static void ShowConsentFormIfRequired(Action<bool> onComplete, Action<string> onError)
105
+ {
106
+ if (ConsentHook.ShowConsentFormIfRequired == null)
107
+ {
108
+ LogWarning("[Consent] ConsentHook.ShowConsentFormIfRequired is not implemented");
109
+ onError?.Invoke("ShowPrivacyForm is not implemented");
110
+ return;
111
+ }
112
+ if (data.consentAlreadyShown)
113
+ {
114
+ Log("[Consent] Consent form has already been shown");
115
+ onComplete?.Invoke(data.canShowAds);
116
+ return;
117
+ }
118
+ ConsentHook.ShowConsentFormIfRequired(canShowAd =>
119
+ {
120
+ data.canShowAds = canShowAd;
121
+ data.consentAlreadyShown = true;
122
+ data.SaveJsonToFile();
123
+ onComplete?.Invoke(canShowAd);
124
+ }, onError);
125
+ }
126
+
127
+ /// <summary>
128
+ /// Forces the consent popup to be shown to the user, regardless of previous
129
+ /// consent status.
130
+ /// </summary>
131
+ /// <param name="onComplete">Callback invoked with a boolean indicating the
132
+ /// ConsentInformation.CanRequestAds() result
133
+ /// </param>
134
+ /// <param name="onError">Callback invoked with an error message if the consent
135
+ /// form could not be loaded or shown.</param>
136
+ public static void ShowPrivacyForm(Action<bool> onComplete, Action<string> onError)
137
+ {
138
+ if (ConsentHook.CheckPrivacyOptionsRequired == null)
139
+ {
140
+ LogWarning("[Consent] ConsentHook.ShowPrivacyForm is not implemented");
141
+ onError?.Invoke("ShowPrivacyForm is not implemented");
142
+ return;
143
+ }
144
+ ConsentHook.ShowPrivacyForm(onComplete, onError);
145
+ }
146
+
147
+ /// <summary>
148
+ /// Determines whether privacy options are required for the current user.
149
+ /// Updates the consent information before returning the result.
150
+ /// </summary>
151
+ /// <param name="onComplete">Callback invoked with `true` if privacy options are required, otherwise `false`.</param>
152
+ public static void CheckPrivacyOptionsRequired(Action<bool> onComplete)
153
+ {
154
+ if (ConsentHook.CheckPrivacyOptionsRequired == null)
155
+ {
156
+ LogWarning("[Consent] ConsentHook.CheckPrivacyOptionsRequired is not implemented");
157
+ onComplete?.Invoke(false);
158
+ return;
159
+ }
160
+ ConsentHook.CheckPrivacyOptionsRequired(onComplete);
161
+ }
162
+
163
+ [Obsolete("Use ShowPrivacyForm instead")]
164
+ public static void ForceShowPopup(Action<bool> onComplete)
165
+ {
166
+ ShowPrivacyForm(onComplete, s => onComplete?.Invoke(false));
167
+ }
168
+ }
169
+ }
170
+
171
+ public static partial class Consent //Internal
172
+ {
173
+ private static readonly Lazy<ConsentData> _data = new Lazy<ConsentData>(() => new ConsentData().LoadJsonFromFile());
174
+ private static ConsentData data => _data.Value;
175
+ private static Action _onConsentComplete;
176
+
177
+ internal static bool checkedATT => data.att >= Status.Allowed;
178
+ internal static bool allowedATT => data.att == Status.Allowed;
179
+
180
+ internal enum Status
181
+ {
182
+ None,
183
+ NotRequired,
184
+ Allowed,
185
+ NotAllowed
186
+ }
187
+
188
+ internal static bool InitModule()
189
+ {
190
+ if (_config.autoGetConsent)
191
+ {
192
+ RequestAllConsents(null);
193
+ }
194
+ return true;
195
+ }
196
+ }
197
+ }
198
+
199
+ [Serializable]
200
+ public class ConsentData : IJsonFile
201
+ {
202
+ [SerializeField] internal AmaGDK.Consent.Status att;
203
+ [SerializeField] internal bool consentAlreadyShown;
204
+ [SerializeField] internal bool canShowAds;
205
+ }
206
+
207
+ public static class ConsentHook
208
+ {
209
+ public static Action<Action<bool>, Action<string>> ShowConsentFormIfRequired;
210
+ public static Action<Action<bool>, Action<string>> ShowPrivacyForm;
211
+ public static Action<Action<bool>> CheckPrivacyOptionsRequired;
212
+ public static Action<Action<bool>> ATTRequest;
213
+ }
214
+ }
215
+
216
+ namespace Amanotes.Core.Internal
217
+ {
218
+ public partial class ConfigAsset
219
+ {
220
+ [SerializeField]
221
+ [Tooltip("Auto pop-up ATT and CMP form")]
222
+ public bool autoGetConsent = true;
223
+ }
224
+ }
@@ -0,0 +1,25 @@
1
+ using System;
2
+ using UnityEngine;
3
+ using UnityEngine.UI;
4
+ namespace Amanotes.Core
5
+ {
6
+ public class GDKPrivacyButton: MonoBehaviour
7
+ {
8
+ public Button button;
9
+ private void Start()
10
+ {
11
+ gameObject.SetActive(false);
12
+ UpdateUI();
13
+ }
14
+
15
+ public void OnButtonClick()
16
+ {
17
+ AmaGDK.Consent.CMP.ShowPrivacyForm(canShowAd => UpdateUI(), GDKDebug.LogWarning);
18
+ }
19
+
20
+ private void UpdateUI()
21
+ {
22
+ AmaGDK.Consent.CMP.CheckPrivacyOptionsRequired(required => button.interactable = required);
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 23184a9779a949419e702ce599a0dcc5
3
+ timeCreated: 1733448516