com.amanotes.gdk 0.2.81-alpha.14 → 0.2.81-alpha.15

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
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 = "v0.2.81-alpha.14";
30
+ public const string VERSION = "v0.2.81-alpha.15";
31
31
 
32
32
  internal static Status _status = Status.None;
33
33
  internal static ConfigAsset _config = null;
@@ -1,6 +1,7 @@
1
1
  using System;
2
2
  using Amanotes.Core.Internal;
3
3
  using UnityEngine;
4
+ using UnityEngine.Serialization;
4
5
  using static Amanotes.Core.GDKDebug;
5
6
 
6
7
  namespace Amanotes.Core
@@ -10,6 +11,8 @@ namespace Amanotes.Core
10
11
  public static partial class Consent //Public
11
12
  {
12
13
  private static readonly GDKTaskTracker _allConsentTaskTracker = new GDKTaskTracker();
14
+
15
+ public static void OnAllConsentsCompleted(Action onComplete) => _allConsentTaskTracker.RegisterOnCompleteCallback(onComplete);
13
16
  public static void RequestAllConsents(Action onComplete)
14
17
  {
15
18
  _allConsentTaskTracker.RegisterOnCompleteCallback(onComplete);
@@ -72,21 +75,37 @@ namespace Amanotes.Core
72
75
  onComplete?.Invoke(false);
73
76
  return;
74
77
  }
78
+
79
+ void RequestATT()
80
+ {
81
+ ConsentHook.ATTRequest(
82
+ isAllowed =>
83
+ {
84
+ data.att = isAllowed ? Status.Allowed : Status.NotAllowed;
85
+ data.SaveJsonToFile(false);
86
+ onComplete?.Invoke(allowedATT);
87
+ }
88
+ );
89
+ }
75
90
 
76
- ConsentHook.ATTRequest(isAllowed =>
91
+ if (_config.autoGetConsent)
77
92
  {
78
- data.att = isAllowed ? Status.Allowed : Status.NotAllowed;
79
- data.SaveJsonToFile(false);
80
- onComplete?.Invoke(allowedATT);
81
- });
93
+ // Delay 1s due to iOS issue, ATT popup will not show if we request soon at app launch
94
+ GDKUtils.DelayCall(1f, RequestATT);
95
+ }
96
+ else
97
+ {
98
+ RequestATT();
99
+ }
82
100
  }
83
101
  }
84
-
85
102
  }
86
103
 
87
104
  public static partial class Consent //CMP
88
105
  {
89
- public static class CMP
106
+ public static readonly CMPConsent CMP = new CMPConsent();
107
+
108
+ public class CMPConsent
90
109
  {
91
110
  /// <summary>
92
111
  /// Determines if a consent popup should be shown to the user and displays it if required.
@@ -101,7 +120,7 @@ namespace Amanotes.Core
101
120
  /// </param>
102
121
  /// <param name="onError">Callback invoked with an error message if the consent
103
122
  /// form could not be loaded or shown.</param>
104
- public static void ShowConsentFormIfRequired(Action<bool> onComplete, Action<string> onError)
123
+ public void ShowConsentFormIfRequired(Action<bool> onComplete, Action<string> onError)
105
124
  {
106
125
  if (ConsentHook.ShowConsentFormIfRequired == null)
107
126
  {
@@ -112,59 +131,17 @@ namespace Amanotes.Core
112
131
  if (data.consentAlreadyShown)
113
132
  {
114
133
  Log("[Consent] Consent form has already been shown");
115
- onComplete?.Invoke(data.canShowAds);
134
+ onComplete?.Invoke(data.canRequestAds);
116
135
  return;
117
136
  }
118
- ConsentHook.ShowConsentFormIfRequired(canShowAd =>
137
+ ConsentHook.ShowConsentFormIfRequired(canRequestAds =>
119
138
  {
120
- data.canShowAds = canShowAd;
139
+ data.canRequestAds = canRequestAds;
121
140
  data.consentAlreadyShown = true;
122
141
  data.SaveJsonToFile(false);
123
- onComplete?.Invoke(canShowAd);
142
+ onComplete?.Invoke(canRequestAds);
124
143
  }, onError);
125
144
  }
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
145
  }
169
146
  }
170
147
 
@@ -177,7 +154,7 @@ namespace Amanotes.Core
177
154
  internal static bool checkedATT => data.att >= Status.Allowed;
178
155
  internal static bool allowedATT => data.att == Status.Allowed;
179
156
 
180
- internal enum Status
157
+ public enum Status
181
158
  {
182
159
  None,
183
160
  NotRequired,
@@ -201,14 +178,13 @@ namespace Amanotes.Core
201
178
  {
202
179
  [SerializeField] internal AmaGDK.Consent.Status att;
203
180
  [SerializeField] internal bool consentAlreadyShown;
204
- [SerializeField] internal bool canShowAds;
181
+ [FormerlySerializedAs("canShowAds")]
182
+ [SerializeField] internal bool canRequestAds;
205
183
  }
206
184
 
207
185
  public static class ConsentHook
208
186
  {
209
187
  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
188
  public static Action<Action<bool>> ATTRequest;
213
189
  }
214
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.81-alpha.14",
3
+ "version": "0.2.81-alpha.15",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",
@@ -1,25 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 23184a9779a949419e702ce599a0dcc5
3
- timeCreated: 1733448516