com.amanotes.gdk 0.1.10 → 0.1.11
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 +9 -1
- package/Editor/AmaGDKEditor.cs +32 -77
- package/Editor/AmaGDKManager.cs +236 -0
- package/Editor/AmaGDKManager.cs.meta +11 -0
- package/Editor/Resources/amasdk-modules.json +31 -0
- package/Editor/Resources/amasdk-modules.json.meta +7 -0
- package/Editor/Resources.meta +8 -0
- package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +171 -0
- package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs.meta +11 -0
- package/Editor/Utils/AmaGDKEditor.GUI.cs +82 -0
- package/Editor/Utils/AmaGDKEditor.GUI.cs.meta +11 -0
- package/Editor/Utils/AmaGDKEditor.Utils.cs +35 -0
- package/Editor/Utils/AmaGDKEditor.Utils.cs.meta +11 -0
- package/Editor/Utils.meta +8 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage.meta +7 -0
- package/Packages/AppsflyerAdapter_v6.5.4.unitypackage +0 -0
- package/Packages/AppsflyerAdapter_v6.5.4.unitypackage.meta +7 -0
- package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
- package/Runtime/AmaGDK.Analytics.cs +39 -5
- package/Runtime/AmaGDK.Internal.cs +25 -1
- package/Runtime/AmaGDK.cs +2 -2
- package/Samples~/Example/AmaGDKExample.cs +87 -0
- package/Samples~/Example/AmaGDKExample.cs.meta +11 -0
- package/Samples~/Example/AmaGDKExample.unity +3114 -0
- package/Samples~/Example/AmaGDKExample.unity.meta +7 -0
- package/Sample~/Example/AmaGDKExample.cs +87 -0
- package/Sample~/Example/AmaGDKExample.cs.meta +11 -0
- package/Sample~/Example/AmaGDKExample.unity +3114 -0
- package/Sample~/Example/AmaGDKExample.unity.meta +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.11 - 2023-02-28]
|
|
4
|
+
### Release AmaGDK v0.1.11
|
|
5
|
+
## Auto start and log Appsflyer open session
|
|
6
|
+
## Add analytics adapter base config
|
|
7
|
+
## Analytics: count by session
|
|
8
|
+
## Export example scene
|
|
9
|
+
## Add AmaGDKManager
|
|
10
|
+
## Refactor Adapter to support for init order configuration
|
|
11
|
+
|
|
3
12
|
## [0.1.10 - 2023-02-17]
|
|
4
13
|
### Release AmaGDK v0.1.10
|
|
5
|
-
### Support accumulated event within session
|
|
6
14
|
|
|
7
15
|
## [0.1.9 - 2023-02-15]
|
|
8
16
|
### Release AmaGDK v0.1.9
|
package/Editor/AmaGDKEditor.cs
CHANGED
|
@@ -1,42 +1,27 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
|
|
1
3
|
using UnityEngine;
|
|
2
4
|
using UnityEditor;
|
|
5
|
+
|
|
6
|
+
using Amanotes.Core;
|
|
3
7
|
using Amanotes.Core.Internal;
|
|
4
|
-
using System;
|
|
5
8
|
using static Amanotes.Core.Internal.Logging;
|
|
9
|
+
using static Amanotes.Editor.GUI;
|
|
6
10
|
|
|
7
|
-
namespace Amanotes.
|
|
11
|
+
namespace Amanotes.Editor
|
|
8
12
|
{
|
|
9
|
-
internal class EditorContext
|
|
10
|
-
{
|
|
11
|
-
[MenuItem("GameObject/AmaGDK/Add AmaGDK Prefab", false, 10)]
|
|
12
|
-
private static void AddPrefab_AmaGDK()
|
|
13
|
-
{
|
|
14
|
-
GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject>(Res.AMAGDK_PREFAB);
|
|
15
|
-
if (prefab == null)
|
|
16
|
-
{
|
|
17
|
-
Debug.LogWarning($"Prefab [AmaGDK] not found at: {Res.AMAGDK_PREFAB}");
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
GameObject newPrefab = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
|
|
22
|
-
newPrefab.name = "AmaGDK";
|
|
23
|
-
Selection.activeObject = newPrefab;
|
|
24
|
-
Selection.activeObject = null;
|
|
25
|
-
Selection.activeObject = newPrefab;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
13
|
[CustomEditor(typeof(AmaGDK))]
|
|
30
|
-
public class AmaGDKEditor : Editor
|
|
14
|
+
public class AmaGDKEditor : UnityEditor.Editor
|
|
31
15
|
{
|
|
32
16
|
static Color BLUE = new Color32(0x34, 0xFF, 0xF7, 0xFF);
|
|
33
17
|
|
|
34
18
|
static AmaGDK sdk;
|
|
35
19
|
static ConfigAsset configAsset;
|
|
36
|
-
static Editor editor;
|
|
20
|
+
static UnityEditor.Editor editor;
|
|
37
21
|
|
|
38
22
|
static bool showConfigDetail;
|
|
39
23
|
static bool showAdapterInstaller;
|
|
24
|
+
static bool showExampleDetail;
|
|
40
25
|
|
|
41
26
|
public void OnEnable()
|
|
42
27
|
{
|
|
@@ -66,7 +51,7 @@ namespace Amanotes.Core
|
|
|
66
51
|
|
|
67
52
|
GUILayout.BeginHorizontal();
|
|
68
53
|
{
|
|
69
|
-
if (
|
|
54
|
+
if (BigButton("CREATE", 40f, BLUE))
|
|
70
55
|
{
|
|
71
56
|
try
|
|
72
57
|
{
|
|
@@ -93,12 +78,12 @@ namespace Amanotes.Core
|
|
|
93
78
|
{
|
|
94
79
|
if (sdk.autoInit)
|
|
95
80
|
{
|
|
96
|
-
|
|
81
|
+
Toggle("Auto Init", ref sdk.autoInit);
|
|
97
82
|
return;
|
|
98
83
|
}
|
|
99
84
|
|
|
100
85
|
EditorGUILayout.HelpBox("You disabled AmaGDK AutoInit\nMake sure to call AmaGDK.Init() manually!", MessageType.Warning);
|
|
101
|
-
if (
|
|
86
|
+
if (BigButton("Enable AutoInit", 40f, BLUE))
|
|
102
87
|
{
|
|
103
88
|
sdk.autoInit = true;
|
|
104
89
|
EditorUtility.SetDirty(sdk);
|
|
@@ -131,6 +116,16 @@ namespace Amanotes.Core
|
|
|
131
116
|
}
|
|
132
117
|
}
|
|
133
118
|
|
|
119
|
+
void DrawGUI_ExampleScene()
|
|
120
|
+
{
|
|
121
|
+
var examplePackageName = "AmaGDKExample";
|
|
122
|
+
if (GUILayout.Button(ObjectNames.NicifyVariableName(examplePackageName)))
|
|
123
|
+
{
|
|
124
|
+
var package = $"{Res.PACKAGE_PATH}{examplePackageName}.unitypackage";
|
|
125
|
+
AssetDatabase.ImportPackage(package, false);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
134
129
|
static public Color btnColor;
|
|
135
130
|
static public float btnLerp;
|
|
136
131
|
void DrawGUI_ColorPicker()
|
|
@@ -148,7 +143,8 @@ namespace Amanotes.Core
|
|
|
148
143
|
if (sdk == null) return;
|
|
149
144
|
|
|
150
145
|
// DrawGUI_ColorPicker();
|
|
151
|
-
|
|
146
|
+
SectionLabel($"<b>AmaGDK</b> <size=12><color=gray>v{AmaGDK.VERSION}</color></size>");
|
|
147
|
+
|
|
152
148
|
if (configAsset == null)
|
|
153
149
|
{
|
|
154
150
|
DrawGUI_ConfigMissing();
|
|
@@ -156,58 +152,17 @@ namespace Amanotes.Core
|
|
|
156
152
|
}
|
|
157
153
|
|
|
158
154
|
DrawGUI_AutoInit();
|
|
159
|
-
|
|
160
|
-
|
|
155
|
+
ToggleGroup("Config", ref showConfigDetail, DrawGUI_ConfigDetail, DrawGUI_ConfigAsset);
|
|
156
|
+
ToggleGroup("Adapters", ref showAdapterInstaller, DrawGUI_AdapterList);
|
|
157
|
+
ToggleGroup("Example", ref showExampleDetail, DrawGUI_ExampleScene);
|
|
161
158
|
}
|
|
162
159
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
private static bool GUIButton(string label, float height = 16f, Color? color = null, float colorMod = 0.5f)
|
|
166
|
-
{
|
|
167
|
-
var bgColor = GUI.backgroundColor;
|
|
168
|
-
|
|
169
|
-
bool result;
|
|
170
|
-
if (color != null)
|
|
171
|
-
{
|
|
172
|
-
var c = (colorMod < 0f) ? Color.Lerp(color.Value, Color.black, -colorMod)
|
|
173
|
-
: (colorMod > 0f) ? Color.Lerp(color.Value, Color.white, colorMod) : color.Value;
|
|
174
|
-
GUI.backgroundColor = c;
|
|
175
|
-
}
|
|
160
|
+
private static void DrawVersion(string label, string version){
|
|
161
|
+
EditorGUI.BeginDisabledGroup(true);
|
|
176
162
|
{
|
|
177
|
-
|
|
163
|
+
GUILayout.Label($"{label} v{version}", EditorStyles.largeLabel);
|
|
178
164
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
private static bool GUIToggle(string label, ref bool value)
|
|
184
|
-
{
|
|
185
|
-
var newValue = EditorGUILayout.Toggle(label, value);
|
|
186
|
-
if (newValue == value) return false;
|
|
187
|
-
|
|
188
|
-
value = newValue;
|
|
189
|
-
EditorUtility.SetDirty(sdk);
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
private static bool GUIToggleGroup(string label, ref bool isOpen, Action drawFunc, Action titleFunc = null){
|
|
194
|
-
GUILayout.BeginHorizontal();
|
|
195
|
-
var newValue = EditorGUILayout.Foldout(isOpen, label);
|
|
196
|
-
var changed = newValue != isOpen;
|
|
197
|
-
titleFunc?.Invoke();
|
|
198
|
-
GUILayout.EndHorizontal();
|
|
199
|
-
|
|
200
|
-
if (isOpen)
|
|
201
|
-
{
|
|
202
|
-
EditorGUI.indentLevel++;
|
|
203
|
-
drawFunc();
|
|
204
|
-
EditorGUI.indentLevel--;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (!changed) return false;
|
|
208
|
-
|
|
209
|
-
isOpen = newValue;
|
|
210
|
-
return true;
|
|
211
|
-
}
|
|
165
|
+
EditorGUI.EndDisabledGroup();
|
|
166
|
+
}
|
|
212
167
|
}
|
|
213
168
|
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Linq;
|
|
5
|
+
using Amanotes.Core;
|
|
6
|
+
using UnityEditor;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
using UnityEngine.Networking;
|
|
9
|
+
|
|
10
|
+
namespace Amanotes.Editor
|
|
11
|
+
{
|
|
12
|
+
[Serializable]
|
|
13
|
+
public class GDKModule
|
|
14
|
+
{
|
|
15
|
+
public string id;
|
|
16
|
+
public string name;
|
|
17
|
+
public string adapter;
|
|
18
|
+
public string currentVersion;
|
|
19
|
+
public int selectIndex;
|
|
20
|
+
public string[] versions;
|
|
21
|
+
public string infoURL;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[Serializable]
|
|
25
|
+
public class BucketInfo
|
|
26
|
+
{
|
|
27
|
+
public PackageInfo[] packages;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[Serializable]
|
|
31
|
+
public class PackageInfo
|
|
32
|
+
{
|
|
33
|
+
public string version;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public class VersionHelper
|
|
37
|
+
{
|
|
38
|
+
public const string PACKAGE_NAME = "com.amanotes.gdk";
|
|
39
|
+
|
|
40
|
+
public static T[] FromJsonToArray<T>(string json)
|
|
41
|
+
{
|
|
42
|
+
if (!json.StartsWith("{\"items\":"))
|
|
43
|
+
{
|
|
44
|
+
json = $"{{\"items\":{json}}}";
|
|
45
|
+
}
|
|
46
|
+
Wrapper<T> wrapper = JsonUtility.FromJson<Wrapper<T>>(json);
|
|
47
|
+
return wrapper.items;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
[Serializable]
|
|
51
|
+
private class Wrapper<T>
|
|
52
|
+
{
|
|
53
|
+
public T[] items;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public static List<GDKModule> LoadLocalModuleInfo()
|
|
57
|
+
{
|
|
58
|
+
List<GDKModule> dicModule = new List<GDKModule>();
|
|
59
|
+
string jsonServices = Resources.Load<TextAsset>("amasdk-modules").text;
|
|
60
|
+
if (!string.IsNullOrEmpty(jsonServices))
|
|
61
|
+
{
|
|
62
|
+
GDKModule[] configs = FromJsonToArray<GDKModule>(jsonServices);
|
|
63
|
+
|
|
64
|
+
foreach (var config in configs)
|
|
65
|
+
{
|
|
66
|
+
GDKModule module = new GDKModule();
|
|
67
|
+
module.infoURL = config.infoURL;
|
|
68
|
+
module.name = config.name;
|
|
69
|
+
module.adapter = config.adapter;
|
|
70
|
+
module.id = config.id;
|
|
71
|
+
module.currentVersion = ExtractVersion.GDKAdapter(module.adapter);
|
|
72
|
+
dicModule.Add(module);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return dicModule;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public static void UpdateListVersions(GDKModule module)
|
|
79
|
+
{
|
|
80
|
+
LoadModuleInfo($"{module.infoURL}/package.json",
|
|
81
|
+
bucketInfo =>
|
|
82
|
+
{
|
|
83
|
+
if (bucketInfo != null)
|
|
84
|
+
{
|
|
85
|
+
module.versions = bucketInfo.packages.Select(p => p.version).ToArray();
|
|
86
|
+
}
|
|
87
|
+
}).StartEditorCoroutine();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private static IEnumerator LoadModuleInfo(string url, Action<BucketInfo> callback)
|
|
91
|
+
{
|
|
92
|
+
BucketInfo bucketInfo = null;
|
|
93
|
+
|
|
94
|
+
using (UnityWebRequest www = UnityWebRequest.Get(url))
|
|
95
|
+
{
|
|
96
|
+
yield return www.SendWebRequest();
|
|
97
|
+
|
|
98
|
+
while (www.isDone == false)
|
|
99
|
+
yield return null;
|
|
100
|
+
|
|
101
|
+
bucketInfo = JsonUtility.FromJson<BucketInfo>(www.downloadHandler.text);
|
|
102
|
+
}
|
|
103
|
+
callback(bucketInfo);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public class AmaGDKManager : EditorWindow
|
|
108
|
+
{
|
|
109
|
+
private static AmaGDKManager window;
|
|
110
|
+
private Dictionary<string, string> dicThirdparty;
|
|
111
|
+
private List<GDKModule> listModule;
|
|
112
|
+
private GUIStyle headerStyle;
|
|
113
|
+
|
|
114
|
+
#if AMAGDK_DEV
|
|
115
|
+
|
|
116
|
+
[MenuItem("AmaGDK/AmaGDK Manager", priority = 1)]
|
|
117
|
+
private static void ShowAmaSDKNotificationEditor()
|
|
118
|
+
{
|
|
119
|
+
if(window)
|
|
120
|
+
{
|
|
121
|
+
window.Show();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
window = GetWindow<AmaGDKManager>();
|
|
125
|
+
window.titleContent = new GUIContent("AmaGDK Manager");
|
|
126
|
+
window.minSize = new Vector2(600, 600);
|
|
127
|
+
window.Show();
|
|
128
|
+
}
|
|
129
|
+
#endif
|
|
130
|
+
|
|
131
|
+
private void OnEnable()
|
|
132
|
+
{
|
|
133
|
+
headerStyle = new GUIStyle();
|
|
134
|
+
headerStyle.normal.textColor = Color.green;
|
|
135
|
+
dicThirdparty = new Dictionary<string, string>();
|
|
136
|
+
listModule = VersionHelper.LoadLocalModuleInfo();
|
|
137
|
+
foreach (GDKModule module in listModule)
|
|
138
|
+
{
|
|
139
|
+
VersionHelper.UpdateListVersions(module);
|
|
140
|
+
dicThirdparty.Add(module.id, ExtractVersion.ThirdParty(module.id));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private void DrawUILine(int thickness = 2, int padding = 10)
|
|
145
|
+
{
|
|
146
|
+
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
|
147
|
+
r.height = thickness;
|
|
148
|
+
r.y += padding / 2;
|
|
149
|
+
r.x -= 2;
|
|
150
|
+
r.width += 6;
|
|
151
|
+
EditorGUI.DrawRect(r, EditorGUIUtility.isProSkin ? Color.black : Color.gray);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private void ModuleInformation()
|
|
155
|
+
{
|
|
156
|
+
foreach (GDKModule module in listModule)
|
|
157
|
+
{
|
|
158
|
+
var currentVersion = module.currentVersion;
|
|
159
|
+
string[] versions = module.versions;
|
|
160
|
+
DrawUILine();
|
|
161
|
+
GUILayout.Label(module.name, headerStyle);
|
|
162
|
+
GUILayout.BeginVertical();
|
|
163
|
+
{
|
|
164
|
+
GUILayout.Space(10);
|
|
165
|
+
GUILayout.BeginHorizontal(GUILayout.Width(450));
|
|
166
|
+
{
|
|
167
|
+
GUILayout.BeginVertical();
|
|
168
|
+
{
|
|
169
|
+
GUILayout.Label($"- Adapter version: {(string.IsNullOrEmpty(currentVersion) ? "None" : currentVersion)}");
|
|
170
|
+
if (dicThirdparty != null && dicThirdparty.ContainsKey(module.id))
|
|
171
|
+
{
|
|
172
|
+
GUILayout.Label($"- Thirdparty version: {dicThirdparty[module.id]}");
|
|
173
|
+
}
|
|
174
|
+
else
|
|
175
|
+
{
|
|
176
|
+
GUILayout.Label("- Thirdparty version: None");
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
GUILayout.EndVertical();
|
|
180
|
+
|
|
181
|
+
GUILayout.BeginVertical();
|
|
182
|
+
{
|
|
183
|
+
if (versions != null && versions.Length > 0)
|
|
184
|
+
{
|
|
185
|
+
module.selectIndex = EditorGUILayout.Popup("Adapter all version:", module.selectIndex, versions);
|
|
186
|
+
if (GUILayout.Button(!string.IsNullOrEmpty(currentVersion) ? "Update" : "Install"))
|
|
187
|
+
{
|
|
188
|
+
// Install or update module
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
GUILayout.EndVertical();
|
|
193
|
+
}
|
|
194
|
+
GUILayout.EndHorizontal();
|
|
195
|
+
}
|
|
196
|
+
GUILayout.EndVertical();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
private void AmaGDKCoreInformation()
|
|
201
|
+
{
|
|
202
|
+
GUILayout.Space(10);
|
|
203
|
+
GUILayout.Label("AmaGDK Core", headerStyle);
|
|
204
|
+
GUILayout.Label(string.Format("version: {0}", AmaGDK.VERSION));
|
|
205
|
+
if (GUILayout.Button("Check Update", GUILayout.MaxWidth(100)))
|
|
206
|
+
{
|
|
207
|
+
UnityEditor.PackageManager.UI.Window.Open(VersionHelper.PACKAGE_NAME);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private void OnGUI()
|
|
212
|
+
{
|
|
213
|
+
GUILayout.BeginVertical();
|
|
214
|
+
{
|
|
215
|
+
GUILayout.BeginHorizontal();
|
|
216
|
+
{
|
|
217
|
+
GUILayout.Space(10);
|
|
218
|
+
|
|
219
|
+
GUILayout.BeginVertical(GUILayout.MaxWidth(150));
|
|
220
|
+
{
|
|
221
|
+
AmaGDKCoreInformation();
|
|
222
|
+
}
|
|
223
|
+
GUILayout.EndVertical();
|
|
224
|
+
|
|
225
|
+
GUILayout.BeginVertical();
|
|
226
|
+
{
|
|
227
|
+
ModuleInformation();
|
|
228
|
+
}
|
|
229
|
+
GUILayout.EndVertical();
|
|
230
|
+
}
|
|
231
|
+
GUILayout.EndHorizontal();
|
|
232
|
+
}
|
|
233
|
+
GUILayout.EndVertical();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "FirebaseAnalytics",
|
|
4
|
+
"name": "Firebase Analytics",
|
|
5
|
+
"adapter": "FirebaseAnalyticsAdapter",
|
|
6
|
+
"infoURL": "https://d29y8yeuyaq8nk.cloudfront.net/firebase-analytics"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": "FirebaseRemoteConfig",
|
|
10
|
+
"name": "Firebase Remote Config",
|
|
11
|
+
"adapter": "",
|
|
12
|
+
"infoURL": "https://d29y8yeuyaq8nk.cloudfront.net/firebase-remote-config"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "Appsflyer",
|
|
16
|
+
"name": "Appsflyer",
|
|
17
|
+
"adapter": "AppsFlyerAdapter",
|
|
18
|
+
"infoURL": "https://d29y8yeuyaq8nk.cloudfront.net/appsflyer"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "IronSource",
|
|
22
|
+
"name": "Ironsource",
|
|
23
|
+
"infoURL": "https://d29y8yeuyaq8nk.cloudfront.net/ama-ironsource"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "RevenueCat",
|
|
27
|
+
"name": "Revenuecat",
|
|
28
|
+
"adapter": "",
|
|
29
|
+
"infoURL": "https://d29y8yeuyaq8nk.cloudfront.net/ama-revenuecat"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using System.Linq;
|
|
5
|
+
using System.Reflection;
|
|
6
|
+
using System.Xml;
|
|
7
|
+
using Amanotes.Core;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
using static Amanotes.Core.AmaGDK.AdapterID;
|
|
10
|
+
|
|
11
|
+
namespace Amanotes.Editor
|
|
12
|
+
{
|
|
13
|
+
public class ExtractVersion
|
|
14
|
+
{
|
|
15
|
+
public static string GDKAdapter(string sdkId)
|
|
16
|
+
{
|
|
17
|
+
string version = null;
|
|
18
|
+
List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
|
|
19
|
+
if (assemblies != null)
|
|
20
|
+
{
|
|
21
|
+
foreach (Assembly assembly in assemblies)
|
|
22
|
+
{
|
|
23
|
+
foreach (Type oType in assembly.GetTypes())
|
|
24
|
+
{
|
|
25
|
+
if (oType.Name.Equals(sdkId))
|
|
26
|
+
{
|
|
27
|
+
version = oType.GetField("VERSION").GetValue(null).ToString();
|
|
28
|
+
return version;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return version;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public static string ThirdParty(string sdkId)
|
|
37
|
+
{
|
|
38
|
+
string version = null;
|
|
39
|
+
switch (sdkId)
|
|
40
|
+
{
|
|
41
|
+
case FIREBASE_ANALYTICS : return FirebaseAnalytics();
|
|
42
|
+
case FIREBASE_REMOTE_CONFIG : return FirebaseRemoteConfig();
|
|
43
|
+
case APPSFLYER : return Appsflyer();
|
|
44
|
+
case IRONSOURCE : return Ironsource();
|
|
45
|
+
case REVENUECAT : return RevenueCat();
|
|
46
|
+
default:
|
|
47
|
+
Debug.LogWarning($"Unsupported sdkID <{sdkId}>");
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return version;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
internal static string FirebaseAnalytics()
|
|
54
|
+
{
|
|
55
|
+
string version = null;
|
|
56
|
+
string[] filesFirebase = Directory.GetFiles("Assets", "maven-metadata.xml", SearchOption.AllDirectories);
|
|
57
|
+
if (filesFirebase != null && filesFirebase.Length > 0)
|
|
58
|
+
{
|
|
59
|
+
for (int i = 0; i < filesFirebase.Length; i++)
|
|
60
|
+
{
|
|
61
|
+
XmlDocument Xdoc = new XmlDocument();
|
|
62
|
+
|
|
63
|
+
Xdoc.Load(filesFirebase[i]);
|
|
64
|
+
XmlElement root = Xdoc.DocumentElement;
|
|
65
|
+
|
|
66
|
+
XmlNode dataName = root.SelectSingleNode("artifactId");
|
|
67
|
+
XmlNode dataVersion = root.SelectSingleNode("versioning/release");
|
|
68
|
+
|
|
69
|
+
if (dataName.InnerText.Contains("firebase-analytics-unity"))
|
|
70
|
+
{
|
|
71
|
+
version = dataVersion.InnerText;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return version;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
internal static string FirebaseRemoteConfig()
|
|
80
|
+
{
|
|
81
|
+
string version = null;
|
|
82
|
+
string[] filesFirebase = Directory.GetFiles("Assets", "maven-metadata.xml", SearchOption.AllDirectories);
|
|
83
|
+
if (filesFirebase != null && filesFirebase.Length > 0)
|
|
84
|
+
{
|
|
85
|
+
for (int i = 0; i < filesFirebase.Length; i++)
|
|
86
|
+
{
|
|
87
|
+
XmlDocument Xdoc = new XmlDocument();
|
|
88
|
+
|
|
89
|
+
Xdoc.Load(filesFirebase[i]);
|
|
90
|
+
XmlElement root = Xdoc.DocumentElement;
|
|
91
|
+
|
|
92
|
+
XmlNode dataName = root.SelectSingleNode("artifactId");
|
|
93
|
+
XmlNode dataVersion = root.SelectSingleNode("versioning/release");
|
|
94
|
+
|
|
95
|
+
if (dataName.InnerText.Contains("firebase-config-unity"))
|
|
96
|
+
{
|
|
97
|
+
version = dataVersion.InnerText;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return version;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
internal static string Appsflyer()
|
|
106
|
+
{
|
|
107
|
+
string version = null;
|
|
108
|
+
List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
|
|
109
|
+
if (assemblies != null)
|
|
110
|
+
{
|
|
111
|
+
foreach (Assembly assembly in assemblies)
|
|
112
|
+
{
|
|
113
|
+
foreach (Type oType in assembly.GetTypes())
|
|
114
|
+
{
|
|
115
|
+
if (oType.Name.Equals("AppsFlyer"))
|
|
116
|
+
{
|
|
117
|
+
version = oType.GetField("kAppsFlyerPluginVersion").GetValue(null).ToString();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return version;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
internal static string Ironsource()
|
|
127
|
+
{
|
|
128
|
+
string version = null;
|
|
129
|
+
string[] issdk = Directory.GetFiles("Assets", "IronSourceSDKDependencies.xml", System.IO.SearchOption.AllDirectories);
|
|
130
|
+
if (issdk != null && issdk.Length > 0)
|
|
131
|
+
{
|
|
132
|
+
XmlDocument Xdoc2 = new XmlDocument();
|
|
133
|
+
Xdoc2.Load(issdk[0]);
|
|
134
|
+
XmlElement root2 = Xdoc2.DocumentElement;
|
|
135
|
+
XmlNode dataVersion2 = root2.SelectSingleNode("unityversion");
|
|
136
|
+
version = dataVersion2.InnerText;
|
|
137
|
+
}
|
|
138
|
+
return version;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
internal static string RevenueCat()
|
|
144
|
+
{
|
|
145
|
+
string[] files = Directory.GetFiles("Assets", "PurchasesWrapper.java", SearchOption.AllDirectories);
|
|
146
|
+
string searchString = "PLUGIN_VERSION";
|
|
147
|
+
string version = null;
|
|
148
|
+
if (files.Length < 1)
|
|
149
|
+
{
|
|
150
|
+
return version;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
foreach (string file in files)
|
|
154
|
+
{
|
|
155
|
+
using (StreamReader r = new StreamReader(file))
|
|
156
|
+
{
|
|
157
|
+
string line;
|
|
158
|
+
while ((line = r.ReadLine()) != null)
|
|
159
|
+
{
|
|
160
|
+
if (line.Contains(searchString))
|
|
161
|
+
{
|
|
162
|
+
version = line.Split('=')[1].Replace("\"", "").Replace(";", "");
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return version;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|