com.amanotes.gdk 0.2.46 → 0.2.47
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 +4 -0
- package/Editor/AmaGDKEditor.cs +281 -104
- package/Editor/MatchSDKVersion.cs +3 -6
- package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +5 -1
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AmaGDKProject.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.unitypackage +0 -0
- package/Packages/{FirebaseRemoteConfigAdapter_v9.1.0.unitypackage.meta → AppsFlyerAdapter.unitypackage.meta} +1 -1
- package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
- package/Packages/{AppsFlyerAdapter_v6.5.4.unitypackage.meta → FirebaseAnalyticsAdapter.unitypackage.meta} +1 -1
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/{IronSourceAdapter_v7.5.2.unitypackage.meta → FirebaseRemoteConfigAdapter.unitypackage.meta} +1 -1
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/{FirebaseAnalyticsAdapter_v9.1.0.unitypackage.meta → IronSourceAdapter.unitypackage.meta} +1 -1
- package/Packages/RevenueCatAdapter.unitypackage +0 -0
- package/Packages/RevenueCatAdapter.unitypackage.meta +7 -0
- package/Runtime/AmaGDK.Adapters.cs +55 -77
- package/Runtime/AmaGDK.Ads.cs +160 -174
- package/Runtime/AmaGDK.Analytics.cs +245 -125
- package/Runtime/AmaGDK.Config.cs +2 -1
- package/Runtime/AmaGDK.IAP.cs +47 -48
- package/Runtime/AmaGDK.RemoteConfig.cs +38 -35
- package/Runtime/AmaGDK.UserProfile.cs +27 -19
- package/Runtime/AmaGDK.cs +158 -111
- package/Runtime/Core.meta +8 -0
- package/Runtime/Internal/AmaGDK.Internal.AmaGUI.cs +8 -3
- package/Runtime/Internal/AmaGDK.Internal.SemVer.cs +21 -17
- package/Runtime/Internal/AmaGDK.Internal.cs +17 -6
- package/Runtime/Internal/AmaGDK.Utils.cs +78 -11
- package/package.json +1 -1
- package/Packages/AppsFlyerAdapter_v6.5.4.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage +0 -0
- package/Packages/IronSourceAdapter_v7.5.2.unitypackage +0 -0
- package/Packages/IronsourceAdapter_v7.2.6.unitypackage +0 -0
- package/Packages/IronsourceAdapter_v7.2.6.unitypackage.meta +0 -7
- package/Packages/RevenueCatAdapter_v6.0.0.unitypackage +0 -0
- package/Packages/RevenueCatAdapter_v6.0.0.unitypackage.meta +0 -7
|
@@ -6,109 +6,87 @@ using static Amanotes.Core.Internal.Logging;
|
|
|
6
6
|
|
|
7
7
|
namespace Amanotes.Core.Internal
|
|
8
8
|
{
|
|
9
|
-
public abstract class
|
|
9
|
+
public abstract partial class Adapter2
|
|
10
10
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
// internal use
|
|
12
|
+
[HideInInspector] [SerializeField] internal int initOrder;
|
|
13
|
+
[HideInInspector] [SerializeField] internal bool enabled = true;
|
|
14
|
+
[NonSerialized] internal string adapterId;
|
|
15
|
+
[NonSerialized] internal string adapterVersion;
|
|
16
|
+
[NonSerialized] internal protected Status status = Status.None;
|
|
17
|
+
|
|
18
|
+
protected abstract void Init(Action<bool> onComplete);
|
|
19
|
+
|
|
18
20
|
public bool IsReady => status == Status.Ready;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
internal void InitSDK() // call by AmaGDK
|
|
21
23
|
{
|
|
22
24
|
if (status != Status.None)
|
|
23
25
|
{
|
|
24
|
-
LogWarning($"Invalid status: {status}");
|
|
26
|
+
LogWarning($"InitSDK() - Invalid Adapter <{adapterId}> status (expect <None>, got: <{status}>)");
|
|
25
27
|
return;
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
#if UNITY_EDITOR
|
|
31
|
+
status = Status.Ready;
|
|
32
|
+
#else
|
|
28
33
|
status = Status.Initialize;
|
|
29
34
|
Init(success =>
|
|
30
35
|
{
|
|
31
36
|
status = success ? Status.Ready : Status.Failed;
|
|
32
37
|
});
|
|
38
|
+
#endif
|
|
33
39
|
}
|
|
34
|
-
|
|
35
|
-
protected virtual void Init(Action<bool> onCompleted) { }
|
|
36
|
-
public T GetAdapterApi<T>() { return (T)(object)this; }
|
|
37
|
-
public abstract T GetAdapterConfig<T>() where T : class;
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
public
|
|
41
|
+
|
|
42
|
+
public abstract partial class Adapter2
|
|
41
43
|
{
|
|
42
|
-
internal static readonly
|
|
43
|
-
|
|
44
|
-
public static string GetId(Type adapterType)
|
|
44
|
+
[NonSerialized] internal static readonly Dictionary<string, Adapter2> adapterMap = new Dictionary<string, Adapter2>();
|
|
45
|
+
protected static bool Register(string id, string version)
|
|
45
46
|
{
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public static void Register<T>(Func<ConfigAsset, T> createFunc) where T : AdapterContext
|
|
50
|
-
{
|
|
51
|
-
if (AmaGDK._status != Status.None)
|
|
47
|
+
if (adapterMap.ContainsKey(id))
|
|
52
48
|
{
|
|
53
|
-
|
|
54
|
-
return;
|
|
49
|
+
LogWarning($"Duplicated Adapter id registered <{id}>");
|
|
50
|
+
return false;
|
|
55
51
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (orderConfig != null) adapter.initOrder = orderConfig.order;
|
|
60
|
-
listAdapters.Add(adapter);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public static AdapterContext Find<T>()
|
|
64
|
-
{
|
|
65
|
-
for (var i = 0; i < listAdapters.Count; i++)
|
|
52
|
+
|
|
53
|
+
var adapter = AmaGDK.Config.GetFieldValue<Adapter2>(id);
|
|
54
|
+
if (adapter == null)
|
|
66
55
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (!typeof(T).IsAssignableFrom(itemType)) continue;
|
|
70
|
-
return item;
|
|
56
|
+
LogWarning($"Adapter <{id}> == null in ConfigAsset? (non-serialized?)");
|
|
57
|
+
return false;
|
|
71
58
|
}
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
|
|
60
|
+
adapter.adapterId = id;
|
|
61
|
+
adapter.adapterVersion = version;
|
|
62
|
+
GDKUtils.RegisterUnityCallbacks(adapter);
|
|
63
|
+
adapterMap.Add(id, adapter);
|
|
64
|
+
return true;
|
|
74
65
|
}
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
|
|
67
|
+
// PUBLIC STATIC APIs
|
|
68
|
+
public static Adapter2 GetAdapterById(string id)
|
|
77
69
|
{
|
|
78
|
-
|
|
79
|
-
for (var i = 0; i < listAdapters.Count; i++)
|
|
80
|
-
{
|
|
81
|
-
AdapterContext item = listAdapters[i];
|
|
82
|
-
Type itemType = item.GetType();
|
|
83
|
-
if (!typeof(T).IsAssignableFrom(itemType)) continue;
|
|
84
|
-
result.Add(item);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return result;
|
|
70
|
+
return GetAdapterById<Adapter2>(id);
|
|
88
71
|
}
|
|
89
|
-
|
|
90
|
-
public static T GetSingleAdapter<T>() where T : class
|
|
72
|
+
public static TAdapter GetAdapterById<TAdapter>(string id) where TAdapter: Adapter2
|
|
91
73
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (adapters == null || adapters.Count < 1)
|
|
95
|
-
{
|
|
96
|
-
Log($"Not found adapter for <{typeof(T)}>!");
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (adapters.Count > 1)
|
|
101
|
-
{
|
|
102
|
-
LogError($"Multiple adapters detected. <{typeof(T)}> supports only one adapter!");
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return adapters[0].GetAdapterApi<T>();
|
|
74
|
+
return adapterMap.TryGetValue(id, out var result) ? (TAdapter)result : null;
|
|
107
75
|
}
|
|
108
|
-
|
|
109
|
-
public static
|
|
76
|
+
|
|
77
|
+
public static TAdapter GetAdapter<TAdapter>() where TAdapter: Adapter2
|
|
78
|
+
{
|
|
79
|
+
var result = adapterMap.Values
|
|
80
|
+
.FirstOrDefault(value => value is TAdapter);
|
|
81
|
+
|
|
82
|
+
return (TAdapter)result;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public static List<TAdapter> GetAllAdapter<TAdapter>() where TAdapter: Adapter2
|
|
110
86
|
{
|
|
111
|
-
return
|
|
87
|
+
return adapterMap.Values
|
|
88
|
+
.OfType<TAdapter>()
|
|
89
|
+
.ToList();
|
|
112
90
|
}
|
|
113
91
|
}
|
|
114
92
|
}
|