com.amanotes.gdk 0.2.65-5 → 0.2.66-1

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 (49) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/Editor/Extra/GDKAutoUpdateAdapter.cs +67 -0
  3. package/Editor/Extra/GDKAutoUpdateAdapter.cs.meta +11 -0
  4. package/Editor/Extra/SDKVersionTracking.cs +68 -0
  5. package/Extra/AmaGDKInstaller.unitypackage +0 -0
  6. package/Extra/CheckDiskSpace.unitypackage +0 -0
  7. package/Extra/ForceUpdate.unitypackage +0 -0
  8. package/Extra/GoogleCMP.unitypackage +0 -0
  9. package/Extra/LegacyGDKUpdateHelper.unitypackage +0 -0
  10. package/Extra/LegacyGDKUpdateHelper.unitypackage.meta +7 -0
  11. package/Extra/PostProcessor.unitypackage +0 -0
  12. package/Packages/AmaGDKConfig.unitypackage +0 -0
  13. package/Packages/AmaGDKExample.unitypackage +0 -0
  14. package/Packages/AmaGDKTest.unitypackage +0 -0
  15. package/Packages/AppsFlyerAdapter.PurchaseConnector.unitypackage +0 -0
  16. package/Packages/AppsFlyerAdapter.unitypackage +0 -0
  17. package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
  18. package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
  19. package/Packages/IronSourceAdapter.unitypackage +0 -0
  20. package/Packages/RevenueCatAdapter.unitypackage +0 -0
  21. package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
  22. package/Runtime/Ad/AdExtension.cs +111 -0
  23. package/Runtime/Ad/AdExtension.cs.meta +3 -0
  24. package/Runtime/Ad/AdLogic.cs +531 -0
  25. package/Runtime/Ad/AdLogic.cs.meta +3 -0
  26. package/Runtime/Ad/AdModuleConfig.cs +39 -0
  27. package/Runtime/Ad/AdModuleConfig.cs.meta +3 -0
  28. package/Runtime/Ad/AdShowContext.cs +43 -0
  29. package/Runtime/Ad/AdShowContext.cs.meta +3 -0
  30. package/Runtime/Ad/AmaGDK.Ads.cs +383 -0
  31. package/Runtime/Ad.meta +8 -0
  32. package/Runtime/AmaGDK.Analytics.cs +37 -16
  33. package/Runtime/AmaGDK.Device.cs +105 -0
  34. package/Runtime/AmaGDK.Device.cs.meta +3 -0
  35. package/Runtime/AmaGDK.cs +1 -1
  36. package/Runtime/AudioToolkit/Plugins/Android/{AudioDeviceDetector.java → GDKAudioDeviceDetector.java} +1 -1
  37. package/Runtime/AudioToolkit/Plugins/AudioDeviceDetector.cs +1 -1
  38. package/Runtime/Core/GDKPool.cs +37 -0
  39. package/Runtime/Core/GDKPool.cs.meta +3 -0
  40. package/Runtime/Core/GDKRoutine.cs +41 -17
  41. package/Runtime/Internal/AmaGDK.Utils.cs +0 -26
  42. package/package.json +1 -1
  43. package/Editor/Extra/SDKVersionTracking.AirTable.cs +0 -73
  44. package/Editor/Extra/SDKVersionTracking.AirTable.cs.meta +0 -3
  45. package/Runtime/AmaGDK.Ads.cs +0 -1077
  46. /package/Runtime/{AmaGDK.Ads.cs.meta → Ad/AmaGDK.Ads.cs.meta} +0 -0
  47. /package/Runtime/AudioToolkit/Plugins/Android/{AudioDeviceDetector.java.meta → GDKAudioDeviceDetector.java.meta} +0 -0
  48. /package/Runtime/AudioToolkit/Plugins/iOS/{AudioDeviceDetector.mm → GDKAudioDeviceDetector.mm} +0 -0
  49. /package/Runtime/AudioToolkit/Plugins/iOS/{AudioDeviceDetector.mm.meta → GDKAudioDeviceDetector.mm.meta} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.66 - 2024-06-25]
4
+ - [Dev] Verify all fields are reset in Init EventParams
5
+ - [Dev] Add try catch to prevent coroutines to stop silently
6
+ - [Fix] Reset 'isLoggedImmediately' for every new EventParams
7
+ - [Dev] Update Audio native plugin name
8
+
9
+ ## [0.2.65-6 - 2024-06-20]
10
+ - [Dev] Improve SDK Version Tracking
11
+ - [Klavar] improve enum converter
12
+ - [Fix] Turn off Google CMP on Editor
13
+
3
14
  ## [0.2.65-5 - 2024-06-17]
4
15
  - [Dev] Update for GDKTest Unity 2022.3 project
5
16
  - [Dev] Update for GDKTest Unity 2021.3 project
@@ -12,6 +23,22 @@
12
23
  - [Dev] Degrade GDKDev project to Unity 2020
13
24
  - [Dev] Audio module supports Unity 2020
14
25
 
26
+ ## [0.2.65-4 - 2024-06-14]
27
+ - [Dev] Audio module supports Unity 2020
28
+ - [Dev] Degrade GDKDev project to Unity 2020
29
+
30
+ ## [0.2.65-3 - 2024-06-14]
31
+ - [Dev] Simplify LocalBuild + Minor editor fixes for GDK Analytics
32
+ - [Dev] fix PostBuild unity 2020
33
+ - [Dev] Audio Device Detector and Bluetooth Audio Latency
34
+ - [Dev] Update SDK configs
35
+
36
+ ## [0.2.65-2 - 2024-06-13]
37
+ - [Feature] Implement analytics event correction for force kill app
38
+ - [Feature] Upload version tracking to Airtable
39
+ - [Fix] Unity 2020 compatible
40
+ - [Fix] Wrong condition check for first time remote config
41
+
15
42
  ## [0.2.65 - 2024-06-13]
16
43
  - [Dev] Add GDKRoutine
17
44
  - [Dev] Add option to preload banners
@@ -0,0 +1,67 @@
1
+ using Amanotes.Core.Internal;
2
+ using System;
3
+ using System.Collections.Generic;
4
+ using UnityEditor;
5
+ using UnityEngine;
6
+
7
+ namespace Amanotes.Editor
8
+ {
9
+ internal class GDKAutoUpdateAdapter: AssetPostprocessor
10
+ {
11
+ private static readonly Dictionary<string, string> packageMap = new Dictionary<string, string>()
12
+ {
13
+ { "AmaGDKConfigAsset", $"{Res.AMAGDK_CONFIG_PACKAGE}" },
14
+
15
+ // Adapters
16
+ { "AppsFlyerAdapter", $"{Res.PACKAGE_PATH}AppsFlyerAdapter.unitypackage" },
17
+ { "FirebaseAnalyticsAdapter", $"{Res.PACKAGE_PATH}FirebaseAnalyticsAdapter.unitypackage" },
18
+ { "FirebaseRemoteConfigAdapter", $"{Res.PACKAGE_PATH}FirebaseRemoteConfigAdapter.unitypackage" },
19
+ { "IronSourceAdapter", $"{Res.PACKAGE_PATH}IronSourceAdapter.unitypackage" },
20
+ { "RevenueCatAdapter", $"{Res.PACKAGE_PATH}RevenueCatAdapter.unitypackage" },
21
+ { "SqliteAnalyticsAdapter", $"{Res.PACKAGE_PATH}SqliteAnalyticsAdapter.unitypackage" },
22
+
23
+ // Extra packages
24
+ { "DiskSpacePopup", $"{Res.EXTRA_PATH}CheckDiskSpace.unitypackage" },
25
+ { "ForceUpdatePopup", $"{Res.EXTRA_PATH}ForceUpdate.unitypackage" },
26
+ { "GoogleCMPSupport", $"{Res.EXTRA_PATH}GoogleCMP.unitypackage" },
27
+ { "AndroidPostProcessor", $"{Res.EXTRA_PATH}PostProcessor.unitypackage" }
28
+ };
29
+
30
+ private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
31
+ {
32
+ if (importedAssets.Length == 0) return;
33
+ // Debug.LogWarning($"importedAssets: {string.Join("\n", importedAssets)}");
34
+
35
+ foreach (string path in importedAssets)
36
+ {
37
+ if (!path.EndsWith("AmaGDK.cs", StringComparison.InvariantCulture)) continue;
38
+ ImportAdapters();
39
+ break;
40
+ }
41
+ }
42
+
43
+ [MenuItem("Window/AmaGDK/Reimport Adapters")]
44
+ private static void ImportAdapters()
45
+ {
46
+ var packages = new List<string>();
47
+ foreach (KeyValuePair<string, string> kvp in packageMap)
48
+ {
49
+ string[] assets = AssetDatabase.FindAssets($"t:monoscript {kvp.Key}");
50
+ if (assets.Length == 0)
51
+ {
52
+ // Debug.LogWarning($"Not found: {kvp.Key}");
53
+ continue;
54
+ }
55
+
56
+ packages.Add(kvp.Value);
57
+ }
58
+
59
+ // import packages
60
+ for (var i = 0; i < packages.Count; i++)
61
+ {
62
+ Debug.Log($"Reimport: {packages[i]}");
63
+ AssetDatabase.ImportPackage(packages[i], false);
64
+ }
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0e051138a935049638e3e732edfe4a74
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -2,12 +2,16 @@ using System;
2
2
  using System.Collections.Generic;
3
3
  using System.IO;
4
4
  using System.Linq;
5
+ using System.Net.Http;
5
6
  using System.Text;
6
7
  using System.Xml;
8
+ using Amanotes.Core.Internal;
7
9
  using UnityEditor;
8
10
  using UnityEditor.Build;
9
11
  using UnityEditor.Build.Reporting;
10
12
  using UnityEngine;
13
+ using System.Threading.Tasks;
14
+ using UnityEditor.Callbacks;
11
15
 
12
16
  #if UNITY_IOS
13
17
  using UnityEditor.iOS.Xcode;
@@ -227,6 +231,70 @@ namespace Amanotes.Editor
227
231
 
228
232
  WriteToStreamingAssets();
229
233
  }
234
+ }
235
+
236
+ public partial class SDKVersionTracking
237
+ {
238
+ private const string AUTH_TOKEN = "pat1CmLr9XozLt6ZE";
239
+ private const string URL = "https://gdk.amanotes.io/gdkVersionTracking";
240
+
241
+ [PostProcessBuild(999)]
242
+ public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
243
+ {
244
+ var rawData = _dicThirdPartyVersion
245
+ .Concat(_dicExtraVersion)
246
+ .Concat(_dicIronSourceAdapterVersion.ToDictionary(kvp => kvp.Key, kvp => (object)("IS_" + kvp.Value)))
247
+ .ToDictionary(x => x.Key, x => x.Value);
248
+ rawData["UnityVersion"] = Application.unityVersion;
249
+ string platform = "";
250
+ #if UNITY_ANDROID
251
+ platform = "Android";
252
+ rawData["Permissions"] = GetAllAndroidPermissions();
253
+ rawData["APILevel"] = (int)PlayerSettings.Android.targetSdkVersion;
254
+ #elif UNITY_IOS
255
+ rawData["SKAdNetwork"] = GetSkAdNetworkCount($"{pathToBuiltProject}/Info.plist");
256
+ platform = "iOS";
257
+ #endif
258
+
259
+ var buildInfo = new Dictionary<string, object>
260
+ {
261
+ {"GameName", Application.productName},
262
+ {"BuildVersion", PlayerSettings.bundleVersion},
263
+ {"BuildNumber", GetBuildNumber()},
264
+ {"BuildTime", GetBuildTime()},
265
+ {"AppId", PlayerSettings.applicationIdentifier },
266
+ {"Platform", platform},
267
+ {"RawData", rawData }
268
+ };
269
+ string json = JsonUtils.DictionaryToJson(buildInfo, false, false);
270
+ Task.Run(()=>SendDataToAirTable(json));
271
+ }
230
272
 
273
+ private static async Task SendDataToAirTable(string payload)
274
+ {
275
+ try
276
+ {
277
+ var client = new HttpClient();
278
+ var request = new HttpRequestMessage(HttpMethod.Post, URL);
279
+ request.Headers.Add("Authorization", AUTH_TOKEN);
280
+ request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
281
+
282
+ var response = await client.SendAsync(request);
283
+ if (response.IsSuccessStatusCode)
284
+ {
285
+ string responseData = await response.Content.ReadAsStringAsync();
286
+ Debug.Log("AmaGDK | [SDKVersionTracking]: done " + responseData);
287
+ }
288
+ else
289
+ {
290
+ string errorData = await response.Content.ReadAsStringAsync();
291
+ Debug.LogError($"AmaGDK | [SDKVersionTracking] Status code {response.StatusCode} Error Response: {errorData}");
292
+ }
293
+ }
294
+ catch (HttpRequestException e)
295
+ {
296
+ Debug.LogError("AmaGDK | [SDKVersionTracking] Request Exception: " + e.Message);
297
+ }
298
+ }
231
299
  }
232
300
  }
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: c102aff69c45748fb9a44760cfb9b490
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,111 @@
1
+ using Amanotes.Core.Internal;
2
+ using System;
3
+ namespace Amanotes.Core
4
+ {
5
+ public static class AdExtension
6
+ {
7
+ /// <summary>
8
+ /// Invoke when ad view has opened
9
+ /// </summary>
10
+ public static IAdCallback OnAdOpened(this IAdCallback ad, Action callback)
11
+ {
12
+ if (!MakeSureAdNotNull(ad)) return null;
13
+ AmaGDK.Ads.context.onOpened -= callback;
14
+ AmaGDK.Ads.context.onOpened += callback;
15
+ return ad;
16
+ }
17
+ /// <summary>
18
+ /// The user finished watching the video, and should be rewarded.
19
+ /// </summary>
20
+ public static IAdCallback OnRewardReceived(this IAdCallback ad, Action callback)
21
+ {
22
+ if (!MakeSureAdNotNull(ad)) return null;
23
+ AmaGDK.Ads.context.onRewardReceived -= callback;
24
+ AmaGDK.Ads.context.onRewardReceived += callback;
25
+ return ad;
26
+ }
27
+ /// <summary>
28
+ /// Invoked when the video ad was clicked.
29
+ /// </summary>
30
+ public static IAdCallback OnAdClicked(this IAdCallback ad, Action callback)
31
+ {
32
+ if (!MakeSureAdNotNull(ad)) return null;
33
+ AmaGDK.Ads.context.onClicked -= callback;
34
+ AmaGDK.Ads.context.onClicked += callback;
35
+ return ad;
36
+ }
37
+ /// <summary>
38
+ /// Callback when the rewarded video ad was failed to show
39
+ /// </summary>
40
+ public static IAdCallback OnAdShowFailed(this IAdCallback ad, Action callback)
41
+ {
42
+ if (!MakeSureAdNotNull(ad)) return null;
43
+ AmaGDK.Ads.context.onShowFailed -= callback;
44
+ AmaGDK.Ads.context.onShowFailed += callback;
45
+ return ad;
46
+ }
47
+ /// <summary>
48
+ /// Invoked before OnAdOpened but is not reliable (not supported by all adNetworks)
49
+ /// </summary>
50
+ public static IAdCallback OnAdShowSuccess(this IAdCallback ad, Action callback)
51
+ {
52
+ if (!MakeSureAdNotNull(ad)) return null;
53
+ AmaGDK.Ads.context.onShowSuccess -= callback;
54
+ AmaGDK.Ads.context.onShowSuccess += callback;
55
+ return ad;
56
+ }
57
+ /// <summary>
58
+ /// Invoke when ad view is about to be closed
59
+ /// </summary>
60
+ public static IAdCallback OnAdClosed(this IAdCallback ad, Action callback)
61
+ {
62
+ if (!MakeSureAdNotNull(ad)) return null;
63
+ AmaGDK.Ads.context.onClosed -= callback;
64
+ AmaGDK.Ads.context.onClosed += callback;
65
+ return ad;
66
+ }
67
+ /// <summary>
68
+ /// This callback may invokes several times according to the AdShowReadyStatus
69
+ /// - When there is no ad cached (wifi disabled / no internet / wait4Ad / timeout)
70
+ /// - When the ad is cached & ready to show
71
+ /// </summary>
72
+ public static IAdCallback OnAdShowReadyStatus(this IAdCallback ad, Action<AdShowReadyStatus> callback)
73
+ {
74
+ if (!MakeSureAdNotNull(ad)) return null;
75
+ AmaGDK.Ads.context.onAdShowReadyStatus -= callback;
76
+ AmaGDK.Ads.context.onAdShowReadyStatus += callback;
77
+ return ad;
78
+ }
79
+ /// <summary>
80
+ /// The finalize callback that will always trigger to mark an end for the AdShowRoutine
81
+ ///
82
+ /// </summary>
83
+ public static IAdCallback OnAdResult(this IAdCallback ad, Action<bool> callback)
84
+ {
85
+ if (!MakeSureAdNotNull(ad)) return null;
86
+ AmaGDK.Ads.context.onAdResult -= callback;
87
+ AmaGDK.Ads.context.onAdResult += callback;
88
+ return ad;
89
+ }
90
+ /// <summary>
91
+ /// Call right before the ad actually open (that means Ad has already been cached & available to show).
92
+ /// This callback will not be triggered in case Ad is not available or no internet (in those case use OnAdShowReadyStatus callback)
93
+ /// </summary>
94
+ public static IAdCallback OnBeforeAdOpen(this IAdCallback ad, Action callback)
95
+ {
96
+ if (!MakeSureAdNotNull(ad)) return null;
97
+ AmaGDK.Ads.context.onBeforeAdOpen -= callback;
98
+ AmaGDK.Ads.context.onBeforeAdOpen += callback;
99
+ return ad;
100
+ }
101
+ private static bool MakeSureAdNotNull(IAdCallback ad)
102
+ {
103
+ bool isValid = (ad != null);
104
+ if (!isValid)
105
+ {
106
+ Logging.LogWarning("Something wrong:: no AdShowContext");
107
+ }
108
+ return isValid;
109
+ }
110
+ }
111
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: ea59d18629b44bd29b26316c9025f27e
3
+ timeCreated: 1719302222