com.amanotes.gdk 0.1.20 → 0.2.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 (58) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/Editor/AmaGDKEditor.cs +91 -46
  3. package/Editor/AmaGDKManager.cs +26 -27
  4. package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +133 -103
  5. package/Editor/Utils/AmaGDKEditor.GUI.cs +54 -51
  6. package/Editor/Utils/AmaGDKEditor.Utils.cs +2 -3
  7. package/Packages/AmaGDKConfig.unitypackage +0 -0
  8. package/Packages/AmaGDKExample.unitypackage +0 -0
  9. package/Packages/AmaGDKTest.unitypackage +0 -0
  10. package/Packages/AmaPassport.ATTSupport.unitypackage +0 -0
  11. package/{Samples~/Example/AmaGDKExample.unity.meta → Packages/AmaPassport.ATTSupport.unitypackage.meta} +1 -1
  12. package/Packages/AmaPassport.AdvertisingID.unitypackage +0 -0
  13. package/{Sample~/Example/AmaGDKExample.unity.meta → Packages/AmaPassport.AdvertisingID.unitypackage.meta} +1 -1
  14. package/Packages/AppsFlyerAdapter_v6.5.4.unitypackage +0 -0
  15. package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
  16. package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage +0 -0
  17. package/{Runtime/AmaPassport/Plugins.meta → Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage.meta} +1 -2
  18. package/Packages/IronsourceAdapter_v7.2.6.unitypackage +0 -0
  19. package/Runtime/AmaGDK.Adapters.cs +30 -12
  20. package/Runtime/AmaGDK.Ads.cs +520 -162
  21. package/Runtime/{AmaPassport/AmaGDK.AmaPassport.cs → AmaGDK.AmaPassport.cs} +36 -47
  22. package/Runtime/{AmaPassport/AmaGDK.AmaPassport.cs.meta → AmaGDK.AmaPassport.cs.meta} +1 -1
  23. package/Runtime/AmaGDK.Analytics.cs +78 -89
  24. package/Runtime/AmaGDK.Config.cs +23 -19
  25. package/Runtime/AmaGDK.Internal.SemVer.cs +11 -29
  26. package/Runtime/AmaGDK.Internal.cs +17 -11
  27. package/Runtime/AmaGDK.RemoteConfig.cs +352 -0
  28. package/Runtime/{AmaPassport/Plugins/Android/AdvertisingIdFetcher.cs.meta → AmaGDK.RemoteConfig.cs.meta} +1 -1
  29. package/Runtime/AmaGDK.UserProfile.cs +5 -8
  30. package/Runtime/AmaGDK.Utils.cs +79 -60
  31. package/Runtime/AmaGDK.WebUtils.cs +45 -48
  32. package/Runtime/AmaGDK.cs +74 -22
  33. package/Runtime/AssemblyInfo.cs +0 -1
  34. package/package.json +1 -1
  35. package/Packages/AppsflyerAdapter_v6.5.4.unitypackage +0 -0
  36. package/Runtime/AmaPassport/Plugins/Android/AdvertisingIdCallback.java +0 -7
  37. package/Runtime/AmaPassport/Plugins/Android/AdvertisingIdCallback.java.meta +0 -32
  38. package/Runtime/AmaPassport/Plugins/Android/AdvertisingIdFetcher.cs +0 -96
  39. package/Runtime/AmaPassport/Plugins/Android/AdvertisingIdFetcher.java +0 -79
  40. package/Runtime/AmaPassport/Plugins/Android/AdvertisingIdFetcher.java.meta +0 -32
  41. package/Runtime/AmaPassport/Plugins/Android.meta +0 -8
  42. package/Runtime/AmaPassport/Plugins/iOS/KeyChain.cs +0 -59
  43. package/Runtime/AmaPassport/Plugins/iOS/KeyChain.cs.meta +0 -11
  44. package/Runtime/AmaPassport/Plugins/iOS/KeyChainPlugin.mm +0 -52
  45. package/Runtime/AmaPassport/Plugins/iOS/KeyChainPlugin.mm.meta +0 -33
  46. package/Runtime/AmaPassport/Plugins/iOS/UICKeyChainStore.h +0 -281
  47. package/Runtime/AmaPassport/Plugins/iOS/UICKeyChainStore.h.meta +0 -33
  48. package/Runtime/AmaPassport/Plugins/iOS/UICKeyChainStore.m +0 -1393
  49. package/Runtime/AmaPassport/Plugins/iOS/UICKeyChainStore.m.meta +0 -33
  50. package/Runtime/AmaPassport/Plugins/iOS.meta +0 -8
  51. package/Runtime/AmaPassport.meta +0 -8
  52. package/Samples~/Example/AmaGDKExample.cs +0 -87
  53. package/Samples~/Example/AmaGDKExample.cs.meta +0 -11
  54. package/Samples~/Example/AmaGDKExample.unity +0 -3114
  55. package/Sample~/Example/AmaGDKExample.cs +0 -87
  56. package/Sample~/Example/AmaGDKExample.cs.meta +0 -11
  57. package/Sample~/Example/AmaGDKExample.unity +0 -3114
  58. /package/Packages/{AppsflyerAdapter_v6.5.4.unitypackage.meta → AppsFlyerAdapter_v6.5.4.unitypackage.meta} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.1 - 2023-06-06]
4
+ ### Refactor Ads module, support ironSource
5
+ ### Refactor AmaPassport
6
+ ### Refactor AmaGDK structure
7
+ ### Add callback when RemoteConfig module completes fetching
8
+
3
9
  ## [0.1.20 - 2023-04-20]
4
10
  ### Refactor Adapter architure to support reading adapter config from Core
5
11
  ### Add session stat for Analytics module
@@ -1,29 +1,40 @@
1
1
  using System;
2
-
3
- using UnityEngine;
4
- using UnityEditor;
5
-
2
+ using System.Text;
6
3
  using Amanotes.Core;
7
4
  using Amanotes.Core.Internal;
5
+ using System.Collections.Generic;
6
+ using UnityEditor;
7
+ using UnityEngine;
8
8
  using static Amanotes.Core.Internal.Logging;
9
9
  using static Amanotes.Editor.AmaGUI;
10
10
  using static Amanotes.Core.AmaGDK.AdapterID;
11
- using System.Text;
12
11
 
13
12
  namespace Amanotes.Editor
14
13
  {
15
14
  [CustomEditor(typeof(AmaGDK))]
16
- public class AmaGDKEditor : UnityEditor.Editor
15
+ internal class AmaGDKEditor : UnityEditor.Editor
17
16
  {
18
- static Color BLUE = new Color32(0x34, 0xFF, 0xF7, 0xFF);
17
+ private static readonly Color BLUE = new Color32(0x34, 0xFF, 0xF7, 0xFF);
18
+
19
+ private static AmaGDK sdk;
20
+ private static ConfigAsset configAsset;
21
+ private static UnityEditor.Editor editor;
19
22
 
20
- static AmaGDK sdk;
21
- static ConfigAsset configAsset;
22
- static UnityEditor.Editor editor;
23
+ private static bool showConfigDetail;
24
+ private static bool showAdapterInstaller;
25
+ private static bool showExampleDetail;
23
26
 
24
- static bool showConfigDetail;
25
- static bool showAdapterInstaller;
26
- static bool showExampleDetail;
27
+ public static Color btnColor;
28
+ public static float btnLerp;
29
+
30
+ private static readonly string[] SDK_IDS =
31
+ {
32
+ FIREBASE_ANALYTICS,
33
+ FIREBASE_REMOTE_CONFIG,
34
+ APPSFLYER,
35
+ IRONSOURCE,
36
+ REVENUECAT
37
+ };
27
38
 
28
39
  public void OnEnable()
29
40
  {
@@ -32,13 +43,13 @@ namespace Amanotes.Editor
32
43
  if (configAsset == null) SearchForConfigAsset();
33
44
  }
34
45
 
35
- void SearchForConfigAsset()
46
+ private void SearchForConfigAsset()
36
47
  {
37
48
  Resources.UnloadUnusedAssets();
38
49
  configAsset = Resources.Load<ConfigAsset>("AmaGDKConfig");
39
50
  }
40
51
 
41
- void KeepSearchingForConfig()
52
+ private void KeepSearchingForConfig()
42
53
  {
43
54
  if (EditorApplication.isUpdating || EditorApplication.isCompiling) return;
44
55
  SearchForConfigAsset();
@@ -47,7 +58,7 @@ namespace Amanotes.Editor
47
58
  EditorApplication.update -= KeepSearchingForConfig;
48
59
  }
49
60
 
50
- void DrawGUI_ConfigMissing()
61
+ private void DrawGUI_ConfigMissing()
51
62
  {
52
63
  EditorGUILayout.HelpBox("[Warning] AmaGDK ConfigAsset NOT FOUND!\nYou need to create one to control all the adapter's configurations!", MessageType.Warning);
53
64
 
@@ -76,7 +87,7 @@ namespace Amanotes.Editor
76
87
  GUILayout.EndHorizontal();
77
88
  }
78
89
 
79
- void DrawGUI_AutoInit()
90
+ private void DrawGUI_AutoInit()
80
91
  {
81
92
  if (sdk.autoInit)
82
93
  {
@@ -93,24 +104,25 @@ namespace Amanotes.Editor
93
104
  }
94
105
  }
95
106
 
96
- void DrawGUI_ConfigDetail()
107
+ private void DrawGUI_ConfigDetail()
97
108
  {
98
109
  CreateCachedEditor(configAsset, null, ref editor);
99
- var lbWidth = EditorGUIUtility.labelWidth;
110
+ float lbWidth = EditorGUIUtility.labelWidth;
100
111
  EditorGUIUtility.labelWidth = 200f;
101
112
  editor.OnInspectorGUI();
102
113
  EditorGUIUtility.labelWidth = lbWidth;
103
114
  }
104
115
 
105
- void DrawGUI_ConfigAsset(){
116
+ private void DrawGUI_ConfigAsset()
117
+ {
106
118
  EditorGUILayout.ObjectField(configAsset, configAsset.GetType(), false);
107
119
  }
108
120
 
109
- void DrawGUI_AdapterList()
121
+ private void DrawGUI_AdapterList()
110
122
  {
111
123
  for (var i = 0; i < Res.AMAGDK_ADAPTERS.Length; i++)
112
124
  {
113
- var adapterName = Res.AMAGDK_ADAPTERS[i];
125
+ string adapterName = Res.AMAGDK_ADAPTERS[i];
114
126
  if (GUILayout.Button(ObjectNames.NicifyVariableName(adapterName)))
115
127
  {
116
128
  var package = $"{Res.PACKAGE_PATH}{adapterName}.unitypackage";
@@ -119,7 +131,7 @@ namespace Amanotes.Editor
119
131
  }
120
132
  }
121
133
 
122
- void DrawGUI_ExampleScene()
134
+ private void DrawGUI_ExampleScene()
123
135
  {
124
136
  var examplePackageName = "AmaGDKExample";
125
137
  if (GUILayout.Button(ObjectNames.NicifyVariableName(examplePackageName)))
@@ -128,10 +140,7 @@ namespace Amanotes.Editor
128
140
  AssetDatabase.ImportPackage(package, false);
129
141
  }
130
142
  }
131
-
132
- static public Color btnColor;
133
- static public float btnLerp;
134
- void DrawGUI_ColorPicker()
143
+ private void DrawGUI_ColorPicker()
135
144
  {
136
145
  GUILayout.BeginHorizontal();
137
146
  {
@@ -140,14 +149,6 @@ namespace Amanotes.Editor
140
149
  }
141
150
  GUILayout.EndHorizontal();
142
151
  }
143
-
144
- private static readonly string[] SDK_IDS = new string[]{
145
- FIREBASE_ANALYTICS,
146
- FIREBASE_REMOTE_CONFIG,
147
- APPSFLYER,
148
- IRONSOURCE,
149
- REVENUECAT
150
- };
151
152
 
152
153
  public override void OnInspectorGUI()
153
154
  {
@@ -156,26 +157,49 @@ namespace Amanotes.Editor
156
157
  // DrawGUI_ColorPicker();
157
158
  SectionLabel($"<b>AmaGDK</b> <size=12><color=gray>v{AmaGDK.VERSION}</color></size>");
158
159
  EditorGUILayout.Space();
159
-
160
- for (var i =0 ;i < SDK_IDS.Length; i++)
160
+
161
+ for (var i = 0; i < SDK_IDS.Length; i++)
161
162
  {
163
+ string id = SDK_IDS[i];
162
164
  AmaGUI.DrawSDKStatus(SDK_IDS[i]);
165
+
166
+ if (id == IRONSOURCE)
167
+ {
168
+ var lastRect = GUILayoutUtility.GetLastRect();
169
+ lastRect.width = 18f;
170
+ lastRect.y += 2f;
171
+ showIronSourceSDKAdapter = EditorGUI.Foldout(lastRect, showIronSourceSDKAdapter, "");
172
+ if (showIronSourceSDKAdapter)
173
+ {
174
+ DrawIRSAdapterVersions();
175
+ }
176
+ }
163
177
  }
164
178
  EditorGUILayout.Space();
165
179
 
166
- if (GUILayout.Button("version_info.tsv -> Clipboard")){
180
+ if (GUILayout.Button("version_info.tsv -> Clipboard"))
181
+ {
167
182
  var sb = new StringBuilder();
168
183
  sb.AppendLine("ID\tSDK VERSION\tADAPTER VERSION");
169
- for (var i =0 ;i < SDK_IDS.Length; i++)
184
+ for (var i = 0; i < SDK_IDS.Length; i++)
170
185
  {
171
- sb.AppendLine(SDKStatus.Get(SDK_IDS[i]).ToTSVString());
186
+ var status = SDKStatus.Get(SDK_IDS[i]);
187
+ sb.AppendLine(status.ToTSVString());
188
+ if (status.sdkId != IRONSOURCE) continue;
189
+ if (!status.sdkInstalled || !status.adapterInstalled) continue;
190
+
191
+ List<IronSourceSDKAdapter> list = ExtractVersion.IronSourceAdapter();
192
+ for (var j = 0; j < list.Count; j++)
193
+ {
194
+ var item = list[j];
195
+ sb.AppendLine($"IS{item.name}Adapter\t{item.version}");
196
+ }
172
197
  }
173
-
198
+
174
199
  var tsv = sb.ToString();
175
200
  EditorGUIUtility.systemCopyBuffer = tsv;
176
201
  Debug.Log($"Content of version_info.tsv copied to clipboard!\n\n{tsv}\n\n");
177
- };
178
-
202
+ }
179
203
 
180
204
  if (configAsset == null)
181
205
  {
@@ -186,15 +210,36 @@ namespace Amanotes.Editor
186
210
  DrawGUI_AutoInit();
187
211
  ToggleGroup("Config", ref showConfigDetail, DrawGUI_ConfigDetail, DrawGUI_ConfigAsset);
188
212
  ToggleGroup("Adapters", ref showAdapterInstaller, DrawGUI_AdapterList);
213
+
189
214
  //("Example", ref showExampleDetail, DrawGUI_ExampleScene);
190
215
  }
191
216
 
192
- private static void DrawVersion(string label, string version){
217
+ private static void DrawVersion(string label, string version)
218
+ {
193
219
  EditorGUI.BeginDisabledGroup(true);
194
220
  {
195
221
  GUILayout.Label($"{label} v{version}", EditorStyles.largeLabel);
196
222
  }
197
223
  EditorGUI.EndDisabledGroup();
198
- }
224
+ }
225
+ public static bool showIronSourceSDKAdapter = false;
226
+
227
+ public static void DrawIRSAdapterVersions()
228
+ {
229
+ SDKStatus status = SDKStatus.Get(IRONSOURCE);
230
+ if (!status.sdkInstalled) return;
231
+ if (!status.adapterInstalled) return;
232
+ if (!showIronSourceSDKAdapter) return;
233
+
234
+ // Get the list of installed SDK & versions
235
+ List<IronSourceSDKAdapter> list = ExtractVersion.IronSourceAdapter();
236
+
237
+ var color = new Color(0.0f, .5f, .5f, 1f);
238
+ for (var i = 0; i < list.Count; i++)
239
+ {
240
+ var item = list[i];
241
+ SemVerGUI(item.name, item.semVer, color);
242
+ }
243
+ }
199
244
  }
200
- }
245
+ }
@@ -4,13 +4,13 @@ using System.Collections.Generic;
4
4
  using System.Linq;
5
5
  using Amanotes.Core;
6
6
  using UnityEditor;
7
+ using UnityEditor.PackageManager.UI;
7
8
  using UnityEngine;
8
9
  using UnityEngine.Networking;
9
-
10
10
  namespace Amanotes.Editor
11
11
  {
12
12
  [Serializable]
13
- public class GDKModule
13
+ internal class GDKModule
14
14
  {
15
15
  public string id;
16
16
  public string name;
@@ -22,18 +22,18 @@ namespace Amanotes.Editor
22
22
  }
23
23
 
24
24
  [Serializable]
25
- public class BucketInfo
25
+ internal class BucketInfo
26
26
  {
27
27
  public PackageInfo[] packages;
28
28
  }
29
29
 
30
30
  [Serializable]
31
- public class PackageInfo
31
+ internal class PackageInfo
32
32
  {
33
33
  public string version;
34
34
  }
35
35
 
36
- public class VersionHelper
36
+ internal class VersionHelper
37
37
  {
38
38
  public const string PACKAGE_NAME = "com.amanotes.gdk";
39
39
 
@@ -47,12 +47,6 @@ namespace Amanotes.Editor
47
47
  return wrapper.items;
48
48
  }
49
49
 
50
- [Serializable]
51
- private class Wrapper<T>
52
- {
53
- public T[] items;
54
- }
55
-
56
50
  public static List<GDKModule> LoadLocalModuleInfo()
57
51
  {
58
52
  List<GDKModule> dicModule = new List<GDKModule>();
@@ -63,7 +57,7 @@ namespace Amanotes.Editor
63
57
 
64
58
  foreach (var config in configs)
65
59
  {
66
- GDKModule module = new GDKModule();
60
+ var module = new GDKModule();
67
61
  module.infoURL = config.infoURL;
68
62
  module.name = config.name;
69
63
  module.adapter = config.adapter;
@@ -78,20 +72,20 @@ namespace Amanotes.Editor
78
72
  public static void UpdateListVersions(GDKModule module)
79
73
  {
80
74
  LoadModuleInfo($"{module.infoURL}/package.json",
81
- bucketInfo =>
82
- {
83
- if (bucketInfo != null)
75
+ bucketInfo =>
84
76
  {
85
- module.versions = bucketInfo.packages.Select(p => p.version).ToArray();
86
- }
87
- }).StartEditorCoroutine();
77
+ if (bucketInfo != null)
78
+ {
79
+ module.versions = bucketInfo.packages.Select(p => p.version).ToArray();
80
+ }
81
+ }).StartEditorCoroutine();
88
82
  }
89
83
 
90
84
  private static IEnumerator LoadModuleInfo(string url, Action<BucketInfo> callback)
91
85
  {
92
86
  BucketInfo bucketInfo = null;
93
87
 
94
- using (UnityWebRequest www = UnityWebRequest.Get(url))
88
+ using (var www = UnityWebRequest.Get(url))
95
89
  {
96
90
  yield return www.SendWebRequest();
97
91
 
@@ -102,8 +96,14 @@ namespace Amanotes.Editor
102
96
  }
103
97
  callback(bucketInfo);
104
98
  }
99
+
100
+ [Serializable]
101
+ private class Wrapper<T>
102
+ {
103
+ public T[] items;
104
+ }
105
105
  }
106
-
106
+
107
107
  public class AmaGDKManager : EditorWindow
108
108
  {
109
109
  private static AmaGDKManager window;
@@ -112,7 +112,6 @@ namespace Amanotes.Editor
112
112
  private GUIStyle headerStyle;
113
113
 
114
114
  #if AMAGDK_DEV
115
-
116
115
  [MenuItem("AmaGDK/AmaGDK Manager", priority = 1)]
117
116
  private static void ShowAmaSDKNotificationEditor()
118
117
  {
@@ -134,7 +133,7 @@ namespace Amanotes.Editor
134
133
  headerStyle.normal.textColor = Color.green;
135
134
  dicThirdparty = new Dictionary<string, string>();
136
135
  listModule = VersionHelper.LoadLocalModuleInfo();
137
- foreach (GDKModule module in listModule)
136
+ foreach (var module in listModule)
138
137
  {
139
138
  VersionHelper.UpdateListVersions(module);
140
139
  dicThirdparty.Add(module.id, ExtractVersion.ThirdParty(module.id));
@@ -143,9 +142,9 @@ namespace Amanotes.Editor
143
142
 
144
143
  private void DrawUILine(int thickness = 2, int padding = 10)
145
144
  {
146
- Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
145
+ var r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
147
146
  r.height = thickness;
148
- r.y += padding / 2;
147
+ r.y += padding / 2f;
149
148
  r.x -= 2;
150
149
  r.width += 6;
151
150
  EditorGUI.DrawRect(r, EditorGUIUtility.isProSkin ? Color.black : Color.gray);
@@ -153,9 +152,9 @@ namespace Amanotes.Editor
153
152
 
154
153
  private void ModuleInformation()
155
154
  {
156
- foreach (GDKModule module in listModule)
155
+ foreach (var module in listModule)
157
156
  {
158
- var currentVersion = module.currentVersion;
157
+ string currentVersion = module.currentVersion;
159
158
  string[] versions = module.versions;
160
159
  DrawUILine();
161
160
  GUILayout.Label(module.name, headerStyle);
@@ -204,7 +203,7 @@ namespace Amanotes.Editor
204
203
  GUILayout.Label(string.Format("version: {0}", AmaGDK.VERSION));
205
204
  if (GUILayout.Button("Check Update", GUILayout.MaxWidth(100)))
206
205
  {
207
- UnityEditor.PackageManager.UI.Window.Open(VersionHelper.PACKAGE_NAME);
206
+ Window.Open(VersionHelper.PACKAGE_NAME);
208
207
  }
209
208
  }
210
209