com.amanotes.gdk 0.2.81-alpha.8 → 0.2.84
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.
- package/CHANGELOG.md +20 -0
- package/Editor/Extra/SDKVersionTracking.cs +20 -1
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AutoEventQC.unitypackage +0 -0
- package/Extra/CheckDiskSpace.unitypackage +0 -0
- package/Extra/Consent.unitypackage +0 -0
- package/Extra/CrashlyticHook.unitypackage +0 -0
- package/Extra/ForceUpdate.unitypackage +0 -0
- package/Extra/LegacyGDKUpdateHelper.unitypackage +0 -0
- package/Extra/PostProcessor.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.PurchaseConnector.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/IronSourceAdapter.AdQuality.unitypackage +0 -0
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/MaxAdNetworkAdapter.unitypackage +0 -0
- package/Packages/RevenueCatAdapter.unitypackage +0 -0
- package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
- package/Runtime/Ad/AdLogic.cs +44 -41
- package/Runtime/Ad/AdModuleConfig.cs +3 -0
- package/Runtime/Ad/AmaGDK.Ads.cs +2 -1
- package/Runtime/AmaGDK.Analytics.cs +14 -7
- package/Runtime/AmaGDK.IAP.cs +35 -60
- package/Runtime/AmaGDK.RemoteConfig.cs +5 -5
- package/Runtime/AmaGDK.UserProfile.cs +2 -2
- package/Runtime/AmaGDK.asmdef +3 -1
- package/Runtime/AmaGDK.cs +1 -1
- package/Runtime/Consent/AmaGDK.Consent.cs +35 -59
- package/Runtime/Core/GDKDebug.cs +43 -24
- package/Runtime/Internal/AmaGDK.Utils.cs +1 -1
- package/Runtime/Internal/ForceQuitMonitor.cs +1 -1
- package/Runtime/Utils/GDKFileUtils.cs +240 -104
- package/Runtime/Utils/GDKUtils.cs +33 -0
- package/package.json +30 -18
- package/Runtime/Consent/GDKPrivacyButton.cs +0 -25
- package/Runtime/Consent/GDKPrivacyButton.cs.meta +0 -3
|
@@ -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
|
-
|
|
91
|
+
if (_config.autoGetConsent)
|
|
77
92
|
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
|
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
|
|
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.
|
|
134
|
+
onComplete?.Invoke(data.canRequestAds);
|
|
116
135
|
return;
|
|
117
136
|
}
|
|
118
|
-
ConsentHook.ShowConsentFormIfRequired(
|
|
137
|
+
ConsentHook.ShowConsentFormIfRequired(canRequestAds =>
|
|
119
138
|
{
|
|
120
|
-
data.
|
|
139
|
+
data.canRequestAds = canRequestAds;
|
|
121
140
|
data.consentAlreadyShown = true;
|
|
122
|
-
data.SaveJsonToFile();
|
|
123
|
-
onComplete?.Invoke(
|
|
141
|
+
data.SaveJsonToFile(false);
|
|
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
|
-
|
|
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
|
-
[
|
|
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/Runtime/Core/GDKDebug.cs
CHANGED
|
@@ -11,11 +11,12 @@ namespace Amanotes.Core
|
|
|
11
11
|
Warning,
|
|
12
12
|
Verbose
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
|
|
15
|
+
#if GDK_REMOVE_STACKTRACE
|
|
16
|
+
internal readonly struct NoStackTrace : IDisposable
|
|
16
17
|
{
|
|
17
|
-
internal LogType logType;
|
|
18
|
-
internal StackTraceLogType stackTraceType;
|
|
18
|
+
internal readonly LogType logType;
|
|
19
|
+
internal readonly StackTraceLogType stackTraceType;
|
|
19
20
|
|
|
20
21
|
internal NoStackTrace(LogType logType)
|
|
21
22
|
{
|
|
@@ -34,8 +35,21 @@ namespace Amanotes.Core
|
|
|
34
35
|
public static NoStackTrace Log => new NoStackTrace(LogType.Log);
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
internal readonly struct NoStackTraceNull: IDisposable
|
|
39
|
+
{
|
|
40
|
+
public void Dispose()
|
|
41
|
+
{
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
#endif
|
|
46
|
+
|
|
37
47
|
public class GDKDebug
|
|
38
48
|
{
|
|
49
|
+
#if GDK_REMOVE_STACKTRACE
|
|
50
|
+
internal static readonly IDisposable NoStackTraceNull = new NoStackTraceNull();
|
|
51
|
+
#endif
|
|
52
|
+
|
|
39
53
|
public static Action<string> logNonfatalErrorHook = null;
|
|
40
54
|
private static readonly HashSet<string> nonFatalDict = new HashSet<string>();
|
|
41
55
|
private static readonly HashSet<string> logWarningDict = new HashSet<string>();
|
|
@@ -49,7 +63,9 @@ namespace Amanotes.Core
|
|
|
49
63
|
if (!logWarningDict.Add(key)) return;
|
|
50
64
|
}
|
|
51
65
|
|
|
52
|
-
|
|
66
|
+
#if GDK_REMOVE_STACKTRACE
|
|
67
|
+
using (GDKUtils.isOnMainThread ? NoStackTrace.Warning: NoStackTraceNull)
|
|
68
|
+
#endif
|
|
53
69
|
{
|
|
54
70
|
Debug.LogWarning($"AmaGDK {message}");
|
|
55
71
|
}
|
|
@@ -57,45 +73,46 @@ namespace Amanotes.Core
|
|
|
57
73
|
public static void LogWarning(string message)
|
|
58
74
|
{
|
|
59
75
|
if (AmaGDK.logLevel < LogLevel.Warning) return;
|
|
60
|
-
|
|
76
|
+
#if GDK_REMOVE_STACKTRACE
|
|
77
|
+
using (GDKUtils.isOnMainThread ? NoStackTrace.Warning: NoStackTraceNull)
|
|
78
|
+
#endif
|
|
61
79
|
{
|
|
62
|
-
Debug.LogWarning($"AmaGDK {message}");
|
|
80
|
+
Debug.LogWarning($"AmaGDK {message}");
|
|
63
81
|
}
|
|
64
82
|
}
|
|
65
83
|
public static void LogError(string message)
|
|
66
84
|
{
|
|
67
85
|
if (AmaGDK.logLevel < LogLevel.Error) return;
|
|
68
|
-
|
|
86
|
+
#if GDK_REMOVE_STACKTRACE
|
|
87
|
+
using (GDKUtils.isOnMainThread ? NoStackTrace.Error: NoStackTraceNull)
|
|
88
|
+
#endif
|
|
69
89
|
{
|
|
70
|
-
Debug.LogError($"AmaGDK {message}");
|
|
90
|
+
Debug.LogError($"AmaGDK {message}");
|
|
71
91
|
}
|
|
72
92
|
|
|
73
93
|
if (logNonfatalErrorHook == null) return;
|
|
74
94
|
|
|
75
95
|
if (GDKUtils.isOnMainThread) // Most of the time
|
|
76
96
|
{
|
|
77
|
-
|
|
78
|
-
{
|
|
79
|
-
if (!nonFatalDict.Add(message)) return;
|
|
80
|
-
}
|
|
81
|
-
logNonfatalErrorHook(message);
|
|
97
|
+
LogNonFatalOnMainThread(message);
|
|
82
98
|
return;
|
|
83
99
|
}
|
|
84
100
|
|
|
85
|
-
GDKUtils.DoOnMainThread(() =>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
101
|
+
GDKUtils.DoOnMainThread(() => { LogNonFatalOnMainThread(message); });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private static void LogNonFatalOnMainThread(string message)
|
|
105
|
+
{
|
|
106
|
+
if (!nonFatalDict.Add(message)) return;
|
|
107
|
+
logNonfatalErrorHook(message);
|
|
93
108
|
}
|
|
94
109
|
|
|
95
110
|
public static void Log(string message)
|
|
96
111
|
{
|
|
97
112
|
if (AmaGDK.logLevel < LogLevel.Verbose) return;
|
|
98
|
-
|
|
113
|
+
#if GDK_REMOVE_STACKTRACE
|
|
114
|
+
using (GDKUtils.isOnMainThread ? NoStackTrace.Log: NoStackTraceNull)
|
|
115
|
+
#endif
|
|
99
116
|
{
|
|
100
117
|
Debug.Log($"AmaGDK {message}");
|
|
101
118
|
}
|
|
@@ -103,7 +120,9 @@ namespace Amanotes.Core
|
|
|
103
120
|
|
|
104
121
|
public static void ForceLog(string message)
|
|
105
122
|
{
|
|
106
|
-
|
|
123
|
+
#if GDK_REMOVE_STACKTRACE
|
|
124
|
+
using (GDKUtils.isOnMainThread ? NoStackTrace.Log: NoStackTraceNull)
|
|
125
|
+
#endif
|
|
107
126
|
{
|
|
108
127
|
Debug.Log($"AmaGDK {message}");
|
|
109
128
|
}
|
|
@@ -200,7 +200,7 @@ namespace Amanotes.Core.Internal
|
|
|
200
200
|
return GDKFileUtils.LoadJsonFromFile(instance);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
internal static void SaveJsonToFile<T>(this T instance, bool immediately
|
|
203
|
+
internal static void SaveJsonToFile<T>(this T instance, bool immediately) where T: IJsonFile
|
|
204
204
|
{
|
|
205
205
|
GDKFileUtils.SaveJsonToFile(instance, immediately);
|
|
206
206
|
}
|