com.amanotes.gdk 0.2.54 → 0.2.56

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.56 - 2024-04-03]
4
+ - Release AmaGDK v0.2.56
5
+
6
+ ## [0.2.55 - 2024-03-28]
7
+ - Send af_inters_displayed & af_rewarded_displayed to AppsFlyer
8
+ - Use Sqlite for analytics
9
+ - Fix IRS callback for RW not working properly in Editor
10
+ - Split google sheet name by platform for SDK version tracking
11
+ - Track version of ACM, Facebook, Build number, build time
12
+
3
13
  ## [0.2.54 - 2024-03-20]
4
14
  - Update temp total count after accumulated count change
5
15
  - Update FirebaseHook
@@ -18,6 +18,11 @@ namespace Amanotes.Editor
18
18
  {
19
19
  dicThirdParty.Add(adapter.name, adapter.version);
20
20
  }
21
+
22
+ dicThirdParty["AdQuality"] = ExtractVersion.IronSourceAdQuality();
23
+ dicThirdParty["AdRevenue"] = ExtractVersion.AppsFlyerAdRevenue();
24
+ dicThirdParty["ACM"] = ExtractVersion.Acm();
25
+ dicThirdParty["FacebookSDK"] = ExtractVersion.Facebook();
21
26
 
22
27
  return dicThirdParty;
23
28
  }
@@ -131,16 +131,19 @@ namespace Amanotes.Editor
131
131
 
132
132
  static string GetPackageVersion(string packageName)
133
133
  {
134
- #if UNITY_2021_1_OR_NEWER
135
- foreach (var package in UnityEditor.PackageManager.PackageInfo.GetAllRegisteredPackages())
134
+ try
136
135
  {
137
- if(package.name != packageName) continue;
138
- return package.version;
139
- }
140
-
136
+ #if UNITY_2021_1_OR_NEWER
137
+ UnityEditor.PackageManager.PackageInfo[] packages = UnityEditor.PackageManager.PackageInfo.GetAllRegisteredPackages();
138
+ foreach (var package in packages)
139
+ {
140
+ if(package.name != packageName) continue;
141
+ return package.version;
142
+ }
143
+
141
144
  #else
142
145
  if (listRequest == null || !listRequest.IsCompleted) return "";
143
-
146
+
144
147
  if (listRequest.Status != StatusCode.Success)
145
148
  {
146
149
  Debug.LogWarning($"Failed to list packages: {listRequest.Error.message}");
@@ -156,10 +159,15 @@ namespace Amanotes.Editor
156
159
  foreach (var package in listRequest.Result)
157
160
  {
158
161
  if(package.name != packageName) continue;
159
-
162
+
160
163
  return package.version;
161
164
  }
162
165
  #endif
166
+ }
167
+ catch (Exception exception)
168
+ {
169
+ Debug.LogWarning($"Can not get package version of {packageName}, error: {exception.Message}");
170
+ }
163
171
  return "";
164
172
  }
165
173
 
@@ -227,26 +235,18 @@ namespace Amanotes.Editor
227
235
 
228
236
  internal static string AppsFlyer()
229
237
  {
230
- var version = "";
231
- List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
232
- foreach (var assembly in assemblies)
233
- {
234
- foreach (var oType in assembly.GetTypes())
235
- {
236
- if (oType.Name.Equals("AppsFlyer"))
237
- {
238
- version = oType.GetField("kAppsFlyerPluginVersion").GetValue(null).ToString();
239
- }
240
- }
241
- }
238
+ return GetVersionFromAssembly("AppsFlyer", "kAppsFlyerPluginVersion");
239
+ }
242
240
 
243
- return version.Trim();
241
+ internal static string AppsFlyerAdRevenue()
242
+ {
243
+ return GetVersionFromAssembly("AppsFlyerAdRevenue", "kAppsFlyerAdRevenueVersion");
244
244
  }
245
245
 
246
246
  internal static string Adjust()
247
247
  {
248
248
  var version = "";
249
- List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
249
+ Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
250
250
  foreach (var assembly in assemblies)
251
251
  {
252
252
  foreach (var oType in assembly.GetTypes())
@@ -275,6 +275,28 @@ namespace Amanotes.Editor
275
275
  return version?.Trim();
276
276
  }
277
277
 
278
+ internal static string IronSourceAdQuality()
279
+ {
280
+ var version = "";
281
+ try
282
+ {
283
+ string[] adQualityXmls = Directory.GetFiles("Assets", "IronSourceAdQualityDependencies.xml",
284
+ SearchOption.AllDirectories);
285
+ if (adQualityXmls.Length <= 0) return version.Trim();
286
+
287
+ var xmlDocument = new XmlDocument();
288
+ xmlDocument.Load(adQualityXmls[0]);
289
+ var root = xmlDocument.DocumentElement;
290
+ var dataVersion = root?.SelectSingleNode("unityversion");
291
+ version = dataVersion?.InnerText;
292
+ }
293
+ catch(Exception exception)
294
+ {
295
+ Debug.LogWarning($"Can not get IronSource AdQuality Version : {exception.Message}");
296
+ }
297
+ return version?.Trim();
298
+ }
299
+
278
300
  internal static string RevenueCat()
279
301
  {
280
302
  string[] files = Directory.GetFiles("Assets", "PurchasesWrapper.java", SearchOption.AllDirectories);
@@ -330,5 +352,42 @@ namespace Amanotes.Editor
330
352
 
331
353
  return listAdapter;
332
354
  }
355
+
356
+ internal static string Acm()
357
+ {
358
+ return GetVersionFromAssembly("ACMVersion", "VERSION");
359
+ }
360
+
361
+ internal static string Facebook()
362
+ {
363
+ return GetVersionFromAssembly("FacebookSdkVersion", "Build");
364
+ }
365
+
366
+ private static string GetVersionFromAssembly(string assemblyType, string versionName)
367
+ {
368
+ var version = "";
369
+ try
370
+ {
371
+ Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
372
+ version = assemblies
373
+ .SelectMany(assembly => assembly.GetTypes())
374
+ .Where(type => type.Name.Equals(assemblyType))
375
+ .Select(type =>
376
+ {
377
+ var extractVersion = type.GetField(versionName)?.GetValue(null).ToString();
378
+ if (string.IsNullOrEmpty(extractVersion))
379
+ {
380
+ extractVersion = type.GetProperty(versionName)?.GetValue(null, null).ToString();
381
+ }
382
+ return extractVersion;
383
+ })
384
+ .FirstOrDefault(value => !string.IsNullOrEmpty(value));
385
+ }
386
+ catch (Exception exception)
387
+ {
388
+ Debug.LogWarning($"Can not get {assemblyType} Version by {versionName}, Exception: {exception.Message}");
389
+ }
390
+ return version;
391
+ }
333
392
  }
334
393
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 668c7755be4bf44fab65894fe05f82fa
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -196,10 +196,10 @@ namespace Amanotes.Core
196
196
  // internal use
197
197
  internal static readonly AdsData localData = new AdsData().LoadJsonFromFile();
198
198
 
199
- protected internal static AdShowContext context;
200
- protected internal static AdAdapter _adapter;
201
- protected internal static float _savedVolume = -1;
202
- protected internal static float _savedTimeScale = -1;
199
+ internal protected static AdShowContext context;
200
+ internal protected static AdAdapter _adapter;
201
+ internal protected static float _savedVolume = -1;
202
+ internal protected static float _savedTimeScale = -1;
203
203
 
204
204
  public static void OnInter_Request(Action callback)
205
205
  {
@@ -248,8 +248,9 @@ namespace Amanotes.Core
248
248
  internal static void StartModule()
249
249
  {
250
250
  if (_adapter == null) return;
251
- _adapter.interstitial.StartLoadAd();
252
- _adapter.rewardVideo.StartLoadAd();
251
+
252
+ if (Config.ad.enableInterstitial) _adapter.interstitial.StartLoadAd();
253
+ if (Config.ad.enableRewarded) _adapter.rewardVideo.StartLoadAd();
253
254
 
254
255
  if (_isBannerShowing)
255
256
  {
@@ -445,7 +446,8 @@ namespace Amanotes.Core.Internal
445
446
  public enum BannerPosition
446
447
  {
447
448
  TOP = 1,
448
- BOTTOM = 2
449
+ BOTTOM = 2,
450
+ RECTANGLE = 3
449
451
  }
450
452
 
451
453
  public enum AdType
@@ -3,6 +3,7 @@ using System.Text.RegularExpressions;
3
3
  using Amanotes.Core.Internal;
4
4
  using System.Collections.Generic;
5
5
  using UnityEngine;
6
+ using UnityEngine.Serialization;
6
7
 
7
8
  namespace Amanotes.Core
8
9
  {
@@ -13,10 +14,19 @@ namespace Amanotes.Core
13
14
  [Serializable]
14
15
  public partial class UserProfile : IJsonFile
15
16
  {
17
+ [NonSerialized]
18
+ private bool _dirty = false;
16
19
  private void Save()
17
20
  {
18
21
  this.SaveJsonToFile();
19
22
  }
23
+
24
+ private void SaveIfDirty()
25
+ {
26
+ if (!_dirty) return;
27
+ _dirty = false;
28
+ this.SaveJsonToFile();
29
+ }
20
30
  }
21
31
 
22
32
  public partial class UserProfile //PUBLIC
@@ -105,6 +115,11 @@ namespace Amanotes.Core
105
115
  get => _installationId;
106
116
  set => _installationId = ValidateId(value, ALPHANUMERIC_PATTERN);
107
117
  }
118
+
119
+ public int Session
120
+ {
121
+ get => _session;
122
+ }
108
123
 
109
124
  public void UpdateUserId()
110
125
  {
@@ -184,6 +199,8 @@ namespace Amanotes.Core
184
199
  private string _appsFlyerId;
185
200
  [SerializeField]
186
201
  private string _installationId;
202
+ [SerializeField]
203
+ private int _session;
187
204
 
188
205
  private const string ALPHANUMERIC_HYPHEN_PATTERN = @"^(?=.*\d)(?=.*[a-zA-Z])(?=.*-).+$";
189
206
  private const string ALPHANUMERIC_PATTERN = @"^(?=.*\d)(?=.*[a-zA-Z])[a-zA-Z\d]+$";
@@ -202,6 +219,8 @@ namespace Amanotes.Core
202
219
  #endif
203
220
  GetAmaDeviceId();
204
221
  UpdateUserId();
222
+ _session = _session + 1;
223
+ _dirty = true;
205
224
  }
206
225
 
207
226
  internal void StartModule()
@@ -209,6 +228,8 @@ namespace Amanotes.Core
209
228
  // Always get the latest advertising id
210
229
  GetAdvertisingId();
211
230
  Logging.Log($"[UserProfile] user_id: {_userId}");
231
+ onFrameUpdate -= SaveIfDirty;
232
+ onFrameUpdate += SaveIfDirty;
212
233
  }
213
234
 
214
235
  private void SetAdvertisingID(string id)
package/Runtime/AmaGDK.cs CHANGED
@@ -17,7 +17,7 @@ namespace Amanotes.Core
17
17
  {
18
18
  public partial class AmaGDK : MonoBehaviour
19
19
  {
20
- public const string VERSION = "0.2.54";
20
+ public const string VERSION = "0.2.56";
21
21
 
22
22
  internal static AmaGDK _instance;
23
23
  internal static Status _status = Status.None;
@@ -142,7 +142,7 @@ namespace Amanotes.Core.Internal
142
142
  public static class GDKFileUtils
143
143
  {
144
144
  private static string _basePath;
145
- private static string basePath
145
+ public static string basePath
146
146
  {
147
147
  get
148
148
  {
@@ -405,7 +405,7 @@ namespace Amanotes.Core.Internal
405
405
  }
406
406
  }
407
407
 
408
- internal static class JsonUtils
408
+ public static class JsonUtils
409
409
  {
410
410
  public static string TupleToJson(params (string key, object value)[] parameters)
411
411
  {
@@ -0,0 +1,27 @@
1
+ using System;
2
+ using Amanotes.Core.Internal;
3
+ using UnityEngine;
4
+ using GUID = System.Guid;
5
+
6
+ namespace Amanotes.Core
7
+ {
8
+ public class KlavarContainer
9
+ {
10
+ public readonly string ctnUUID = GUID.NewGuid().ToString();
11
+ public string lastEventName;
12
+
13
+ public static void LogEventError(string message)
14
+ {
15
+ if (!Application.isBatchMode)
16
+ Logging.LogError(message);
17
+ throw new KlavarException(message);
18
+ }
19
+ }
20
+
21
+ public class KlavarException : Exception
22
+ {
23
+ public KlavarException() { }
24
+ public KlavarException(string message) : base(message) { }
25
+ }
26
+ }
27
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 9d36fe04b538e4580902f417f4cf88c6
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -11,6 +11,8 @@ namespace Amanotes.Core
11
11
  /// </summary>
12
12
  public abstract class KlavarEvent
13
13
  {
14
+ private Dictionary<string, object> additionalParameters = new Dictionary<string, object>();
15
+
14
16
  /// <summary>
15
17
  /// LogEvent
16
18
  /// </summary>
@@ -25,6 +27,12 @@ namespace Amanotes.Core
25
27
 
26
28
  var @params = this.ToDict();
27
29
  var eventName = eventNameAttr.name;
30
+
31
+ foreach (var kvp in additionalParameters)
32
+ {
33
+ @params[kvp.Key] = kvp.Value;
34
+ }
35
+
28
36
  AmaGDK.Analytics.LogEvent(eventName, @params);
29
37
  }
30
38
 
@@ -87,5 +95,17 @@ namespace Amanotes.Core
87
95
  field => Convert(field)
88
96
  );
89
97
  }
98
+
99
+ /// <summary>
100
+ /// AttachContainerParameters method attaches container parameters to the event.
101
+ /// </summary>
102
+ /// <param name="parameters">The container parameters to attach.</param>
103
+ public void AttachContainerParameters(Dictionary<string, object> parameters)
104
+ {
105
+ foreach (var kvp in parameters)
106
+ {
107
+ additionalParameters[kvp.Key] = kvp.Value;
108
+ }
109
+ }
90
110
  }
91
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.54",
3
+ "version": "0.2.56",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",