com.amanotes.gdk 0.2.75 → 0.2.78
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 +48 -0
- package/Editor/AmaGDKEditor.cs +24 -15
- package/Editor/Extra/SDKVersionTracking.cs +29 -0
- package/Editor/Utils/GDKPackageInstaller.cs +116 -0
- package/Editor/Utils/GDKPackageInstaller.cs.meta +11 -0
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AutoEventQC.unitypackage +0 -0
- package/{Runtime/GDKAudio/Plugins/iOS.meta → Extra/AutoEventQC.unitypackage.meta} +1 -2
- package/Extra/CheckDiskSpace.unitypackage +0 -0
- package/Extra/Consent.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.AdRevenue.AF6.14AndOlder.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/{Runtime/GDKAudio/Plugins/macOS.meta → Packages/IronSourceAdapter.AdQuality.unitypackage.meta} +1 -2
- 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 +52 -55
- package/Runtime/Ad/AdShowContext.cs +1 -1
- package/Runtime/AmaGDK.Adapters.cs +2 -2
- package/Runtime/AmaGDK.Analytics.cs +18 -15
- package/Runtime/AmaGDK.Consent.cs +3 -8
- package/Runtime/AmaGDK.Mono.cs +1 -1
- package/Runtime/AmaGDK.RemoteConfig.cs +12 -2
- package/Runtime/AmaGDK.UserProfile.cs +31 -23
- package/Runtime/AmaGDK.cs +140 -41
- package/Runtime/Core/GDKDebug.cs +12 -5
- package/Runtime/Core/GDKPrefabPool.cs +571 -0
- package/Runtime/Core/GDKPrefabPool.cs.meta +11 -0
- package/Runtime/Core/GDKRoutine.cs +48 -2
- package/Runtime/Internal/AmaGDK.Internal.cs +1 -1
- package/Runtime/Internal/AmaGDK.Utils.cs +38 -0
- package/Runtime/UI/ScrollView/Editor/GDKScrollViewEditor.cs +50 -0
- package/Runtime/UI/ScrollView/Editor/GDKScrollViewEditor.cs.meta +11 -0
- package/Runtime/{GDKAudio/Resources.meta → UI/ScrollView/Editor.meta} +1 -1
- package/Runtime/UI/ScrollView/GDKScrollView.cs +702 -0
- package/Runtime/UI/ScrollView/GDKScrollView.cs.meta +12 -0
- package/Runtime/UI/ScrollView.meta +9 -0
- package/Runtime/UI/ScrollableText/GDKScrollableText.cs +68 -0
- package/Runtime/UI/ScrollableText/GDKScrollableText.cs.meta +3 -0
- package/Runtime/UI/ScrollableText/GDKScrollableText.prefab +806 -0
- package/Runtime/UI/ScrollableText/GDKScrollableText.prefab.meta +7 -0
- package/Runtime/UI/ScrollableText.meta +3 -0
- package/Runtime/{GDKAudio/Plugins.meta → UI.meta} +1 -1
- package/Runtime/Utils/GDKUtils.cs +18 -0
- package/package.json +1 -1
- package/Packages/AppsFlyerAdapter.AdRevenue.unitypackage +0 -0
- package/Runtime/GDKAudio/GDKAudio.cs +0 -483
- package/Runtime/GDKAudio/GDKAudio.cs.meta +0 -3
- package/Runtime/GDKAudio/Plugins/Android/atensor-release.aar +0 -0
- package/Runtime/GDKAudio/Plugins/Android/atensor-release.aar.meta +0 -32
- package/Runtime/GDKAudio/Plugins/Android.meta +0 -3
- package/Runtime/GDKAudio/Plugins/iOS/libatensor.a +0 -0
- package/Runtime/GDKAudio/Plugins/iOS/libatensor.a.meta +0 -68
- package/Runtime/GDKAudio/Plugins/iOS/libcrypto.a +0 -0
- package/Runtime/GDKAudio/Plugins/iOS/libcrypto.a.meta +0 -68
- package/Runtime/GDKAudio/Plugins/iOS/libssl.a +0 -0
- package/Runtime/GDKAudio/Plugins/iOS/libssl.a.meta +0 -68
- package/Runtime/GDKAudio/Plugins/macOS/libatensor.dylib +0 -0
- package/Runtime/GDKAudio/Plugins/macOS/libatensor.dylib.meta +0 -81
- package/Runtime/GDKAudio/Resources/GDKAudioMixer.mixer +0 -133
- package/Runtime/GDKAudio/Resources/GDKAudioMixer.mixer.meta +0 -8
- package/Runtime/GDKAudio.meta +0 -3
- /package/Packages/{AppsFlyerAdapter.AdRevenue.unitypackage.meta → AppsFlyerAdapter.AdRevenue.AF6.14AndOlder.unitypackage.meta} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.78] - 2024-11-11
|
|
4
|
+
- [Dev] Add iOS and Android ad unit configuration for MAX
|
|
5
|
+
- [Dev] Track Adapters and Third-party packages used in games
|
|
6
|
+
|
|
7
|
+
## [0.2.77] - 2024-11-07
|
|
8
|
+
- [Release] 0.2.76
|
|
9
|
+
- [Dev] Remove GDKAudio
|
|
10
|
+
- [Dev] Handle format exception in RemoteConfig
|
|
11
|
+
- [Dev] Handle exception of FetchConfig
|
|
12
|
+
- [Fix] Corrected handling of events after LogImmediately()
|
|
13
|
+
- [Dev] Convert value with invariant culture in Remote Config
|
|
14
|
+
- [Feature] Support AppsFlyer 6.15.x by default
|
|
15
|
+
- [Dev] GameOpsSDK
|
|
16
|
+
- [Dev] Fix bug missing ads callback on iOS
|
|
17
|
+
- [Dev] Add OnAdReady logging
|
|
18
|
+
- [Dev] Add more params to impressionData
|
|
19
|
+
- [CI] Update pipeline
|
|
20
|
+
- [Dev] Rework GDK_Example
|
|
21
|
+
- [Dev] Early validate IDFA, GAId and update pattern of AmaDeviceId
|
|
22
|
+
- [Dev] Add device memory info to gdk_init
|
|
23
|
+
- [Dev] Do not use Dispatcher in Init phase (optimize for performance)
|
|
24
|
+
- [Dev] Reduce calls to DoOnMainThread for start stop GDKRoutine
|
|
25
|
+
- [Dev] Minor clean up
|
|
26
|
+
- [Dev] Add memory profiler
|
|
27
|
+
- [CI] Enable cache
|
|
28
|
+
- [Dev] Add Package Installer
|
|
29
|
+
- [Dev] Add Klavar event alias
|
|
30
|
+
- [CI] Disable CI cache temporarily
|
|
31
|
+
- [Dev] Use Array.Fill instead of loop
|
|
32
|
+
- [Fix] Clear cached audio buffer when not playing
|
|
33
|
+
- Revert "[Dev] Upgrade api level 34 for GDKDev"
|
|
34
|
+
- This reverts commit 6ea19dec18c3f2cb0a8000ae746bc58f0b3f3dc2.
|
|
35
|
+
- [Dev] Decouple IronSource AdQuality
|
|
36
|
+
- [Dev] Upgrade api level 34 for GDKDev
|
|
37
|
+
- [Dev] Improve GDKConfig
|
|
38
|
+
- [Dev] Upload test result as artifact
|
|
39
|
+
- [Dev] Add default-manifest for integration test project
|
|
40
|
+
- [CI] Enhance error handling in integration_test.sh
|
|
41
|
+
- [CI] update export-android job to wait for export-ios completion
|
|
42
|
+
- [Dev] Activate Unity license once during integration tests
|
|
43
|
+
- [Dev] Export Packages
|
|
44
|
+
- [Dev] Add AutoEventQC extra package
|
|
45
|
+
- [Dev] Integration test
|
|
46
|
+
- [Dev] Show consent config on Inspector
|
|
47
|
+
- [Dev] Ignore LevelPlay to keep the hard link locally
|
|
48
|
+
|
|
49
|
+
## [0.2.76] - 2024-11-07
|
|
50
|
+
|
|
3
51
|
## [0.2.75] - 2024-09-20
|
|
4
52
|
- [Dev] Use GDKUtils.StartCoroutine to capture exceptions
|
|
5
53
|
- [Fix] Initialize modules lazily to fix AmaGDK serialization layout mismatch
|
package/Editor/AmaGDKEditor.cs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
using System;
|
|
1
|
+
using System;
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using System.IO;
|
|
4
4
|
using System.Linq;
|
|
@@ -24,11 +24,11 @@ namespace Amanotes.Editor
|
|
|
24
24
|
private static readonly Color ORANGE = new Color32(0xFF, 0xC0, 0x00, 0xFF);
|
|
25
25
|
|
|
26
26
|
[NonSerialized] private static AmaGDK sdk;
|
|
27
|
-
[NonSerialized] private static ConfigAsset configAsset;
|
|
28
27
|
[NonSerialized] private static UnityObject invalidConfigAsset;
|
|
29
28
|
[NonSerialized] private static SerializedObject configSO;
|
|
30
29
|
[NonSerialized] private static UnityEditor.Editor editor;
|
|
31
30
|
|
|
31
|
+
private static ConfigAsset configAsset => AmaGDK.Config;
|
|
32
32
|
private static bool showIRSAdapter;
|
|
33
33
|
private static bool showConfigDetail;
|
|
34
34
|
private static bool showAdapterInstaller;
|
|
@@ -62,7 +62,7 @@ namespace Amanotes.Editor
|
|
|
62
62
|
|
|
63
63
|
SDKStatus.ClearCache();
|
|
64
64
|
RefreshConfigStatus();
|
|
65
|
-
|
|
65
|
+
RefreshListAdapters();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
internal enum ConfigAssetStatus
|
|
@@ -92,7 +92,6 @@ namespace Amanotes.Editor
|
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
configAsset = Resources.Load<ConfigAsset>("AmaGDKConfig");
|
|
96
95
|
cfgStatus = configAsset != null ? ConfigAssetStatus.AssetOk : ConfigAssetStatus.AssetIsInvalid;
|
|
97
96
|
if (cfgStatus == ConfigAssetStatus.AssetOk) adapterScanned = false;
|
|
98
97
|
}
|
|
@@ -277,12 +276,7 @@ namespace Amanotes.Editor
|
|
|
277
276
|
{
|
|
278
277
|
if (AmaGUI.BigButton("CREATE", 40f, BLUE))
|
|
279
278
|
{
|
|
280
|
-
|
|
281
|
-
var resourcePath = "Assets/AmaGDK/Resources";
|
|
282
|
-
Directory.CreateDirectory(resourcePath);
|
|
283
|
-
|
|
284
|
-
AssetDatabase.CreateAsset(config, Path.Combine(resourcePath, "AmaGDKConfig.asset"));
|
|
285
|
-
AssetDatabase.SaveAssets();
|
|
279
|
+
CreateGDKConfig();
|
|
286
280
|
RefreshConfigStatus();
|
|
287
281
|
}
|
|
288
282
|
|
|
@@ -308,6 +302,16 @@ namespace Amanotes.Editor
|
|
|
308
302
|
GUILayout.ExpandWidth(true));
|
|
309
303
|
}
|
|
310
304
|
|
|
305
|
+
internal static void CreateGDKConfig()
|
|
306
|
+
{
|
|
307
|
+
ScriptableObject config = CreateInstance("Amanotes.Core.AmaGDKConfigAsset");
|
|
308
|
+
var resourcePath = "Assets/AmaGDK/Resources";
|
|
309
|
+
Directory.CreateDirectory(resourcePath);
|
|
310
|
+
|
|
311
|
+
AssetDatabase.CreateAsset(config, Path.Combine(resourcePath, "AmaGDKConfig.asset"));
|
|
312
|
+
AssetDatabase.SaveAssets();
|
|
313
|
+
}
|
|
314
|
+
|
|
311
315
|
public override void OnInspectorGUI()
|
|
312
316
|
{
|
|
313
317
|
Profiler.BeginSample("GDKEditor.OnInspectorGUI()");
|
|
@@ -359,6 +363,7 @@ namespace Amanotes.Editor
|
|
|
359
363
|
DrawProperty(configSO, "enableAudioModule", false);
|
|
360
364
|
DrawProperty(configSO, "enableServerTime", false);
|
|
361
365
|
DrawProperty(configSO, "enableGeoLocation", false);
|
|
366
|
+
DrawProperty(configSO, "autoGetConsent", false);
|
|
362
367
|
GUILayout.Space(8f);
|
|
363
368
|
|
|
364
369
|
for (var i = 0; i < allAdapters.Count; i++)
|
|
@@ -378,6 +383,13 @@ namespace Amanotes.Editor
|
|
|
378
383
|
GDKAutoUpdateAdapter.ImportAdapters();
|
|
379
384
|
}
|
|
380
385
|
|
|
386
|
+
// Always apply changes to the config asset, but only save to disk if not in play mode
|
|
387
|
+
if (configSO.ApplyModifiedProperties() && !Application.isPlaying)
|
|
388
|
+
{
|
|
389
|
+
EditorUtility.SetDirty(configAsset);
|
|
390
|
+
AssetDatabase.SaveAssets();
|
|
391
|
+
}
|
|
392
|
+
|
|
381
393
|
Profiler.EndSample();
|
|
382
394
|
}
|
|
383
395
|
|
|
@@ -553,7 +565,6 @@ namespace Amanotes.Editor
|
|
|
553
565
|
if (adapter is RemoteConfigAdapter) EditorGUILayout.PropertyField(configSO.FindProperty("remoteConfig"), new GUIContent("Shared settings for Remote Config Modules"));
|
|
554
566
|
GUI.contentColor = c;
|
|
555
567
|
}
|
|
556
|
-
configSO.ApplyModifiedProperties();
|
|
557
568
|
}
|
|
558
569
|
EditorGUIUtility.labelWidth -= 70;
|
|
559
570
|
EditorGUI.EndDisabledGroup();
|
|
@@ -578,11 +589,9 @@ namespace Amanotes.Editor
|
|
|
578
589
|
while (property.NextVisible(first))
|
|
579
590
|
{
|
|
580
591
|
first = false;
|
|
581
|
-
if (!property.propertyPath.Contains(basePath)) break;
|
|
582
|
-
EditorGUILayout.PropertyField(property);
|
|
592
|
+
if (!property.propertyPath.Contains(basePath)) break;
|
|
593
|
+
EditorGUILayout.PropertyField(property);
|
|
583
594
|
}
|
|
584
|
-
|
|
585
|
-
so.ApplyModifiedProperties();
|
|
586
595
|
}
|
|
587
596
|
|
|
588
597
|
private static Adapter2 GetAdapter(string id)
|
|
@@ -12,6 +12,8 @@ using UnityEditor.Build.Reporting;
|
|
|
12
12
|
using UnityEngine;
|
|
13
13
|
using System.Threading.Tasks;
|
|
14
14
|
using UnityEditor.Callbacks;
|
|
15
|
+
using System.Reflection;
|
|
16
|
+
|
|
15
17
|
|
|
16
18
|
#if UNITY_IOS
|
|
17
19
|
using UnityEditor.iOS.Xcode;
|
|
@@ -43,6 +45,7 @@ namespace Amanotes.Editor
|
|
|
43
45
|
|
|
44
46
|
private const int MAX_VERSION_KEY_LENGTH = 30;
|
|
45
47
|
private static Dictionary<string, object> _dicThirdPartyVersion = new Dictionary<string, object>();
|
|
48
|
+
private static Dictionary<string, object> _dicImportedGDKAdapter = new Dictionary<string, object>();
|
|
46
49
|
private static Dictionary<string, object> _dicExtraVersion = new Dictionary<string, object>();
|
|
47
50
|
private static Dictionary<string, object> _dicIronSourceAdapterVersion = new Dictionary<string, object>();
|
|
48
51
|
|
|
@@ -192,6 +195,29 @@ namespace Amanotes.Editor
|
|
|
192
195
|
};
|
|
193
196
|
}
|
|
194
197
|
|
|
198
|
+
public static Dictionary<string, object> GetImportedGDKAdapter()
|
|
199
|
+
{
|
|
200
|
+
var dicGDKAdapters = new Dictionary<string, object>();
|
|
201
|
+
var config = Resources.Load<ConfigAsset>("AmaGDKConfig");
|
|
202
|
+
foreach (var field in config
|
|
203
|
+
.GetType()
|
|
204
|
+
.GetFields(BindingFlags.Instance | BindingFlags.NonPublic))
|
|
205
|
+
{
|
|
206
|
+
var fieldValue = field.GetValue(config);
|
|
207
|
+
if (fieldValue is Adapter2 adapter)
|
|
208
|
+
{
|
|
209
|
+
string gdkAdapterName = field.Name + "Adapter";
|
|
210
|
+
dicGDKAdapters[gdkAdapterName] = adapter.enabled? "Enabled" : "Disabled";
|
|
211
|
+
}
|
|
212
|
+
else
|
|
213
|
+
{
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return dicGDKAdapters;
|
|
219
|
+
}
|
|
220
|
+
|
|
195
221
|
private static void WriteToStreamingAssets()
|
|
196
222
|
{
|
|
197
223
|
try
|
|
@@ -201,6 +227,7 @@ namespace Amanotes.Editor
|
|
|
201
227
|
|
|
202
228
|
AppendVersion(sb, "BUILD INFO", GetBuildInfo());
|
|
203
229
|
AppendVersion(sb, "THIRD PARTY", _dicThirdPartyVersion);
|
|
230
|
+
AppendVersion(sb, "IMPORTED GDK ADAPTERS", _dicImportedGDKAdapter);
|
|
204
231
|
AppendVersion(sb, "IS ADAPTER", _dicIronSourceAdapterVersion);
|
|
205
232
|
AppendVersion(sb, "EXTRA", _dicExtraVersion);
|
|
206
233
|
|
|
@@ -226,6 +253,7 @@ namespace Amanotes.Editor
|
|
|
226
253
|
public void OnPreprocessBuild(BuildReport report)
|
|
227
254
|
{
|
|
228
255
|
_dicThirdPartyVersion = AmaGDKExtra.GetThirdPartyVersions();
|
|
256
|
+
_dicImportedGDKAdapter = GetImportedGDKAdapter();
|
|
229
257
|
_dicIronSourceAdapterVersion = AmaGDKExtra.GetIronSourceAdapterVersions();
|
|
230
258
|
_dicExtraVersion = _getExtraSDKVersion?.Invoke() ?? _dicExtraVersion;
|
|
231
259
|
|
|
@@ -242,6 +270,7 @@ namespace Amanotes.Editor
|
|
|
242
270
|
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
|
|
243
271
|
{
|
|
244
272
|
var rawData = _dicThirdPartyVersion
|
|
273
|
+
.Concat(_dicImportedGDKAdapter)
|
|
245
274
|
.Concat(_dicExtraVersion)
|
|
246
275
|
.Concat(_dicIronSourceAdapterVersion.ToDictionary(kvp => kvp.Key, kvp => (object)("IS_" + kvp.Value)))
|
|
247
276
|
.ToDictionary(x => x.Key, x => x.Value);
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.IO;
|
|
3
|
+
using System.Linq;
|
|
4
|
+
using System.Text.RegularExpressions;
|
|
5
|
+
using Amanotes.Core;
|
|
6
|
+
using UnityEditor;
|
|
7
|
+
using UnityEditor.PackageManager;
|
|
8
|
+
using UnityEditor.PackageManager.Requests;
|
|
9
|
+
using UnityEngine;
|
|
10
|
+
|
|
11
|
+
namespace Amanotes.Editor
|
|
12
|
+
{
|
|
13
|
+
[System.Serializable]
|
|
14
|
+
internal class ScopedRegistry
|
|
15
|
+
{
|
|
16
|
+
public string name;
|
|
17
|
+
public string url;
|
|
18
|
+
public string[] scopes;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[System.Serializable]
|
|
22
|
+
internal class ScopedRegistries
|
|
23
|
+
{
|
|
24
|
+
public ScopedRegistry[] scopedRegistries;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
internal class GDKPackageInstaller
|
|
28
|
+
{
|
|
29
|
+
private static AddRequest _addRequest;
|
|
30
|
+
private static Action _onAddRequestCompleted;
|
|
31
|
+
|
|
32
|
+
internal static void AddScope(string name, string url, string[] scopes)
|
|
33
|
+
{
|
|
34
|
+
try
|
|
35
|
+
{
|
|
36
|
+
const string manifestPath = "Packages/manifest.json";
|
|
37
|
+
var manifestJson = File.ReadAllText(manifestPath);
|
|
38
|
+
|
|
39
|
+
var registries = JsonUtility.FromJson<ScopedRegistries>(manifestJson);
|
|
40
|
+
var scopedRegistry = registries.scopedRegistries;
|
|
41
|
+
|
|
42
|
+
if (scopedRegistry != null)
|
|
43
|
+
{
|
|
44
|
+
if(IsScopesExist(scopes, scopedRegistry))
|
|
45
|
+
return;
|
|
46
|
+
Array.Resize(ref registries.scopedRegistries, scopedRegistry.Length + 1);
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
{
|
|
50
|
+
registries.scopedRegistries = new ScopedRegistry[1];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
registries.scopedRegistries[registries.scopedRegistries.Length - 1] = new ScopedRegistry
|
|
54
|
+
{
|
|
55
|
+
name = name,
|
|
56
|
+
scopes = scopes,
|
|
57
|
+
url = url
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const string pattern = "\"dependencies\"\\s*:\\s*\\{(.+?)\\}";
|
|
61
|
+
Match match = Regex.Match(manifestJson, pattern, RegexOptions.Singleline);
|
|
62
|
+
manifestJson = "{" + $"{match.Value},{JsonUtility.ToJson(registries).Remove(0, 1)}";
|
|
63
|
+
File.WriteAllText(manifestPath, manifestJson);
|
|
64
|
+
|
|
65
|
+
// Double check
|
|
66
|
+
manifestJson = File.ReadAllText(manifestPath);
|
|
67
|
+
registries = JsonUtility.FromJson<ScopedRegistries>(manifestJson);
|
|
68
|
+
scopedRegistry = registries.scopedRegistries;
|
|
69
|
+
|
|
70
|
+
if (scopedRegistry == null || IsScopesExist(scopes, scopedRegistry) == false)
|
|
71
|
+
{
|
|
72
|
+
Debug.LogWarning("Failed to add new scopes to the manifest");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
|
|
76
|
+
Client.Resolve();
|
|
77
|
+
Debug.Log("Successfully add new scopes to the manifest");
|
|
78
|
+
}
|
|
79
|
+
catch (IOException e)
|
|
80
|
+
{
|
|
81
|
+
Debug.LogWarning($"Failed to add new scopes to the manifest : {e}");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private static bool IsScopesExist(string[] scopes, ScopedRegistry[] scopedRegistries)
|
|
86
|
+
{
|
|
87
|
+
return scopes.All(scopeToCheck => scopedRegistries
|
|
88
|
+
.SelectMany(registry => registry.scopes)
|
|
89
|
+
.Any(scope => scope.ToString() == scopeToCheck));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
internal static void InstallPackage(string package, Action callback)
|
|
93
|
+
{
|
|
94
|
+
EditorApplication.update -= AddPackageProgress;
|
|
95
|
+
EditorApplication.update += AddPackageProgress;
|
|
96
|
+
_addRequest = Client.Add(package);
|
|
97
|
+
_onAddRequestCompleted = callback;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private static void AddPackageProgress()
|
|
101
|
+
{
|
|
102
|
+
if (_addRequest == null || _addRequest.IsCompleted == false)
|
|
103
|
+
return;
|
|
104
|
+
if (_addRequest.Status == StatusCode.Success)
|
|
105
|
+
{
|
|
106
|
+
EditorApplication.update -= AddPackageProgress;
|
|
107
|
+
_onAddRequestCompleted?.Invoke();
|
|
108
|
+
}
|
|
109
|
+
else if (_addRequest.Status == StatusCode.Failure)
|
|
110
|
+
{
|
|
111
|
+
Debug.LogWarning("Fail to add new package");
|
|
112
|
+
}
|
|
113
|
+
_addRequest = null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/Runtime/Ad/AdLogic.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
using System;
|
|
1
2
|
using System.Collections;
|
|
2
3
|
using UnityEngine;
|
|
3
4
|
using static Amanotes.Core.GDKDebug;
|
|
@@ -131,17 +132,8 @@ namespace Amanotes.Core.Internal
|
|
|
131
132
|
protected bool _isRequesting;
|
|
132
133
|
protected bool _isInterstitial => adType == AdType.Interstitial;
|
|
133
134
|
|
|
134
|
-
// Do not warn unused variable, it's been use outside of Editor (Runtime)
|
|
135
|
-
#pragma warning disable
|
|
136
|
-
private bool isFocus;
|
|
137
|
-
#pragma warning enable
|
|
138
|
-
|
|
139
135
|
public void StartShowAd()
|
|
140
136
|
{
|
|
141
|
-
isFocus = false;
|
|
142
|
-
unityCallbacks.OnApplicationFocus -= OnApplicationFocus;
|
|
143
|
-
unityCallbacks.OnApplicationFocus += OnApplicationFocus;
|
|
144
|
-
|
|
145
137
|
if (_showState != ShowAdsState.None)
|
|
146
138
|
{
|
|
147
139
|
LogWarning("[Ad] StartShowAd() --> Invalid _showState: " + _showState);
|
|
@@ -163,14 +155,6 @@ namespace Amanotes.Core.Internal
|
|
|
163
155
|
_showAdRoutine = GDKUtils.StartCoroutine(ShowAdRoutine());
|
|
164
156
|
}
|
|
165
157
|
|
|
166
|
-
private void OnApplicationFocus(bool focus)
|
|
167
|
-
{
|
|
168
|
-
if (!focus) return;
|
|
169
|
-
|
|
170
|
-
unityCallbacks.OnApplicationFocus -= OnApplicationFocus;
|
|
171
|
-
isFocus = true;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
158
|
public void StopShowAd()
|
|
175
159
|
{
|
|
176
160
|
Log($"[Ad] {adType} StopShowAd");
|
|
@@ -238,14 +222,59 @@ namespace Amanotes.Core.Internal
|
|
|
238
222
|
_showState = ShowAdsState.Showing;
|
|
239
223
|
OnAdShowReadyStatus(true, AdShowReadyStatus.Ready);
|
|
240
224
|
TriggerBeforeAdShow();
|
|
225
|
+
#if !UNITY_EDITOR && UNITY_ANDROID
|
|
226
|
+
GDKUtils.StartCoroutine(HandleAdActivityKilledSilently());
|
|
227
|
+
#endif
|
|
241
228
|
ShowAd();
|
|
242
|
-
|
|
243
229
|
yield return WaitForMediationCallback();
|
|
244
|
-
|
|
245
|
-
// wait 1 frame in case hasReward callback after onClose
|
|
246
|
-
if (!context.hasReward && adType == AdType.VideoReward && !context.hasFailedOrCancelled) yield return null;
|
|
247
230
|
ShowAdRoutineCompleted(context.isSuccess);
|
|
248
231
|
}
|
|
232
|
+
|
|
233
|
+
private IEnumerator WaitForMediationCallback()
|
|
234
|
+
{
|
|
235
|
+
while (context != null && !context.potentiallyCompleted)
|
|
236
|
+
{
|
|
237
|
+
yield return null;
|
|
238
|
+
}
|
|
239
|
+
// wait 1 frame in case hasReward callback after onClose
|
|
240
|
+
if (context != null && !context.hasReward && adType == AdType.VideoReward && !context.hasFailedOrCancelled) yield return null;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private IEnumerator HandleAdActivityKilledSilently()
|
|
244
|
+
{
|
|
245
|
+
bool hasOutOfFocus = false;
|
|
246
|
+
bool hasFocusAgain = false;
|
|
247
|
+
Action<bool> onApplicationFocusCallback = focus =>
|
|
248
|
+
{
|
|
249
|
+
if (focus)
|
|
250
|
+
{
|
|
251
|
+
hasFocusAgain = true;
|
|
252
|
+
}
|
|
253
|
+
else
|
|
254
|
+
{
|
|
255
|
+
hasOutOfFocus = true;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
unityCallbacks.OnApplicationFocus += onApplicationFocusCallback;
|
|
259
|
+
int counter = 0;
|
|
260
|
+
while (context != null && !context.potentiallyCompleted)
|
|
261
|
+
{
|
|
262
|
+
if (hasFocusAgain && hasOutOfFocus)
|
|
263
|
+
{
|
|
264
|
+
// Start counting frames only after closed the ad
|
|
265
|
+
counter++;
|
|
266
|
+
}
|
|
267
|
+
if (counter > MAX_FRAMES_WAIT_FOR_CALLBACK)
|
|
268
|
+
{
|
|
269
|
+
// Timeout reached, force close the ad
|
|
270
|
+
LogError("Force close the ad");
|
|
271
|
+
StopShowAd();
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
yield return null;
|
|
275
|
+
}
|
|
276
|
+
unityCallbacks.OnApplicationFocus -= onApplicationFocusCallback;
|
|
277
|
+
}
|
|
249
278
|
|
|
250
279
|
private void EndShowAdRoutineWithFailure(AdShowReadyStatus status)
|
|
251
280
|
{
|
|
@@ -280,40 +309,8 @@ namespace Amanotes.Core.Internal
|
|
|
280
309
|
Log("[Ad] WaitForAd success after " + counter + " | timeout = " + timeout + " secs");
|
|
281
310
|
break;
|
|
282
311
|
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
private IEnumerator WaitForMediationCallback()
|
|
286
|
-
{
|
|
287
|
-
#if UNITY_EDITOR
|
|
288
|
-
while (!context.hasClosed) yield return null;
|
|
289
|
-
yield break;
|
|
290
|
-
#endif
|
|
291
|
-
while (!isFocus) yield return null;
|
|
292
|
-
var wait4CallbackCounter = 0;
|
|
293
|
-
while (!context.potentiallyCompleted && wait4CallbackCounter <= MAX_FRAMES_WAIT_FOR_CALLBACK)
|
|
294
|
-
{
|
|
295
|
-
wait4CallbackCounter++;
|
|
296
|
-
yield return null;
|
|
297
|
-
}
|
|
298
|
-
Log($"[Ad] Waiting for potentially completed callback: {wait4CallbackCounter} frames");
|
|
299
|
-
|
|
300
|
-
if (!context.hasClosed) yield return WaitForAdClosedCallback();
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
private IEnumerator WaitForAdClosedCallback()
|
|
304
|
-
{
|
|
305
|
-
int counter = 0;
|
|
306
|
-
while (!context.hasClosed && counter <= MAX_FRAMES_WAIT_FOR_CALLBACK)
|
|
307
|
-
{
|
|
308
|
-
counter++;
|
|
309
|
-
yield return null;
|
|
310
|
-
}
|
|
311
|
-
Log($"[Ad] Waiting for ad closed callback: {counter} frames");
|
|
312
|
-
if (context.hasClosed) yield break;
|
|
313
|
-
LogWarning("[Ad] Force close ad (mediation missing OnAdClose callback)");
|
|
314
|
-
OnAdClosed();
|
|
315
|
-
}
|
|
316
|
-
|
|
312
|
+
}
|
|
313
|
+
|
|
317
314
|
private void ShowAdRoutineCompleted(bool isSuccess)
|
|
318
315
|
{
|
|
319
316
|
if (_loadState == LoadAdsState.Ready)
|
|
@@ -35,7 +35,7 @@ namespace Amanotes.Core.Internal
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
public bool hasFailedOrCancelled => (adCallback & (AdCallback.Fail | AdCallback.Cancel)) != 0;
|
|
38
|
-
public bool potentiallyCompleted => (adCallback & (AdCallback.Close | AdCallback.Fail | AdCallback.
|
|
38
|
+
public bool potentiallyCompleted => (adCallback & (AdCallback.Close | AdCallback.Fail | AdCallback.Cancel)) != 0;
|
|
39
39
|
public bool hasReward => (adCallback & AdCallback.Reward) != 0;
|
|
40
40
|
public bool hasClosed => (adCallback & AdCallback.Close) != 0;
|
|
41
41
|
public bool hasClicked => (adCallback & AdCallback.Click) != 0;
|
|
@@ -24,7 +24,7 @@ namespace Amanotes.Core.Internal
|
|
|
24
24
|
[HideInNormalInspector] [SerializeField] internal int initOrder;
|
|
25
25
|
[HideInNormalInspector] [SerializeField] internal bool enabled = true;
|
|
26
26
|
[NonSerialized] internal string adapterId;
|
|
27
|
-
[NonSerialized] internal string
|
|
27
|
+
[NonSerialized] internal string compatibleSDKVersion;
|
|
28
28
|
[NonSerialized] protected internal Status status = Status.None;
|
|
29
29
|
|
|
30
30
|
protected abstract void Init(Action<bool> onComplete);
|
|
@@ -75,7 +75,7 @@ namespace Amanotes.Core.Internal
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
adapter.adapterId = id;
|
|
78
|
-
adapter.
|
|
78
|
+
adapter.compatibleSDKVersion = version;
|
|
79
79
|
GDKUtils.AddUnityCallbacks(adapter);
|
|
80
80
|
adapterMap.Add(id, adapter);
|
|
81
81
|
return true;
|