com.amanotes.gdk 0.1.12 → 0.1.15

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.15 - 2023-03-06]
4
+ ### Release AmaGDK v0.1.15
5
+ ### Fix null exception in VersionExtractor
6
+ ### Warn unhandle platform in Appsflyer initialization
7
+ ### Allow dev to SetPermittedEvents and SetForbiddenEvents to the adapter config
8
+
9
+ ## [0.1.14 - 2023-03-02]
10
+ ### Release AmaGDK v0.1.14
11
+
12
+ ## [0.1.13 - 2023-03-01]
13
+ ### Release AmaGDK v0.1.13
14
+ ### Fix Semver parser
15
+
3
16
  ## [0.1.12 - 2023-03-01]
4
17
  ### Release AmaGDK v0.1.12
5
18
  ### Prioritize analytics instant config over the base config
@@ -185,7 +185,7 @@ namespace Amanotes.Editor
185
185
  DrawGUI_AutoInit();
186
186
  ToggleGroup("Config", ref showConfigDetail, DrawGUI_ConfigDetail, DrawGUI_ConfigAsset);
187
187
  ToggleGroup("Adapters", ref showAdapterInstaller, DrawGUI_AdapterList);
188
- ToggleGroup("Example", ref showExampleDetail, DrawGUI_ExampleScene);
188
+ //("Example", ref showExampleDetail, DrawGUI_ExampleScene);
189
189
  }
190
190
 
191
191
  private static void DrawVersion(string label, string version){
@@ -50,7 +50,7 @@ namespace Amanotes.Editor
50
50
  {
51
51
  public static string GDKAdapter(string sdkId)
52
52
  {
53
- string version = null;
53
+ string version = "";
54
54
  var adapterId = sdkId + "Adapter";
55
55
  // Debug.Log($"Searching for AdapterId: {adapterId}");
56
56
  List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
@@ -73,12 +73,12 @@ namespace Amanotes.Editor
73
73
  }
74
74
  }
75
75
  }
76
- return version;
76
+ return version.Trim();
77
77
  }
78
78
 
79
79
  public static string ThirdParty(string sdkId)
80
80
  {
81
- string version = null;
81
+ string version = "";
82
82
  switch (sdkId)
83
83
  {
84
84
  case FIREBASE_ANALYTICS : return FirebaseAnalytics();
@@ -95,7 +95,7 @@ namespace Amanotes.Editor
95
95
 
96
96
  internal static string FirebaseAnalytics()
97
97
  {
98
- string version = null;
98
+ string version = "";
99
99
  string[] filesFirebase = Directory.GetFiles("Assets", "maven-metadata.xml", SearchOption.AllDirectories);
100
100
  if (filesFirebase != null && filesFirebase.Length > 0)
101
101
  {
@@ -116,12 +116,12 @@ namespace Amanotes.Editor
116
116
  }
117
117
  }
118
118
  }
119
- return version;
119
+ return version.Trim();
120
120
  }
121
121
 
122
122
  internal static string FirebaseRemoteConfig()
123
123
  {
124
- string version = null;
124
+ string version = "";
125
125
  string[] filesFirebase = Directory.GetFiles("Assets", "maven-metadata.xml", SearchOption.AllDirectories);
126
126
  if (filesFirebase != null && filesFirebase.Length > 0)
127
127
  {
@@ -142,12 +142,12 @@ namespace Amanotes.Editor
142
142
  }
143
143
  }
144
144
  }
145
- return version;
145
+ return version.Trim();
146
146
  }
147
147
 
148
148
  internal static string AppsFlyer()
149
149
  {
150
- string version = null;
150
+ string version = "";
151
151
  List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
152
152
  if (assemblies != null)
153
153
  {
@@ -163,12 +163,12 @@ namespace Amanotes.Editor
163
163
  }
164
164
  }
165
165
 
166
- return version;
166
+ return version.Trim();
167
167
  }
168
168
 
169
169
  internal static string Ironsource()
170
170
  {
171
- string version = null;
171
+ string version = "";
172
172
  string[] issdk = Directory.GetFiles("Assets", "IronSourceSDKDependencies.xml", System.IO.SearchOption.AllDirectories);
173
173
  if (issdk != null && issdk.Length > 0)
174
174
  {
@@ -178,14 +178,14 @@ namespace Amanotes.Editor
178
178
  XmlNode dataVersion2 = root2.SelectSingleNode("unityversion");
179
179
  version = dataVersion2.InnerText;
180
180
  }
181
- return version;
181
+ return version.Trim();
182
182
  }
183
183
 
184
184
  internal static string RevenueCat()
185
185
  {
186
186
  string[] files = Directory.GetFiles("Assets", "PurchasesWrapper.java", SearchOption.AllDirectories);
187
187
  string searchString = "PLUGIN_VERSION";
188
- string version = null;
188
+ string version = "";
189
189
  if (files.Length < 1)
190
190
  {
191
191
  return version;
@@ -206,7 +206,7 @@ namespace Amanotes.Editor
206
206
  }
207
207
  }
208
208
  }
209
- return version;
209
+ return version.Trim();
210
210
  }
211
211
  }
212
212
  }
Binary file
Binary file
@@ -215,6 +215,24 @@ namespace Amanotes.Core
215
215
 
216
216
  localData.UpdateMigrationLog();
217
217
  }
218
+
219
+ public static void SetPermittedEvents(List<string> eventNames, params string[] adapterIDs)
220
+ {
221
+ foreach (var adapterID in adapterIDs)
222
+ {
223
+ var adapter = listAdapters.Find(a => a.id == adapterID)?.GetAdapterApi<IAnalyticAdapter>();
224
+ adapter?.SetPermittedEvents(eventNames);
225
+ }
226
+ }
227
+
228
+ public static void SetForbiddenEvents(List<string> eventNames, params string[] adapterIDs)
229
+ {
230
+ foreach (var adapterID in adapterIDs)
231
+ {
232
+ var adapter = listAdapters.Find(a => a.id == adapterID)?.GetAdapterApi<IAnalyticAdapter>();
233
+ adapter?.SetForbiddenEvents(eventNames);
234
+ }
235
+ }
218
236
  }
219
237
 
220
238
  //INTERNAL
@@ -587,5 +605,9 @@ namespace Amanotes.Core.Internal
587
605
  void SetUserId(string userId);
588
606
 
589
607
  void SetUserProperty(string key, string value);
608
+
609
+ void SetPermittedEvents(List<string> eventNames);
610
+
611
+ void SetForbiddenEvents(List<string> eventNames);
590
612
  }
591
613
  }
@@ -1,12 +1,13 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
3
  using System.Text.RegularExpressions;
4
+ using static Amanotes.Core.Internal.Logging;
4
5
 
5
6
  namespace Amanotes.Core.Internal
6
7
  {
7
8
  public struct SemVer : IComparable<SemVer>, IComparer<SemVer>
8
9
  {
9
- public static readonly SemVer ZERO = new SemVer(0,0,0);
10
+ public static readonly SemVer ZERO = new SemVer(0, 0, 0);
10
11
 
11
12
  public int major;
12
13
  public int minor;
@@ -21,25 +22,30 @@ namespace Amanotes.Core.Internal
21
22
 
22
23
  public SemVer(string version)
23
24
  {
24
- if (string.IsNullOrEmpty(version)) {
25
- major = 0;
26
- minor = 0;
27
- patch = 0;
25
+ major = 0;
26
+ minor = 0;
27
+ patch = 0;
28
+
29
+ if (string.IsNullOrEmpty(version))
30
+ {
28
31
  return;
29
32
  }
30
33
 
34
+ version = version.Trim();
35
+
31
36
  Regex regex = new Regex(@"^(\d+)\.(\d+)\.(\d+)$");
32
37
  Match match = regex.Match(version);
33
38
  if (!match.Success)
34
39
  {
35
- throw new ArgumentException("Invalid SemVer string", "version");
40
+ LogWarning($"Invalid SemVer string: [{version}]");
41
+ return;
36
42
  }
37
43
  major = int.Parse(match.Groups[1].Value);
38
44
  minor = int.Parse(match.Groups[2].Value);
39
45
  patch = int.Parse(match.Groups[3].Value);
40
46
  }
41
47
 
42
- public bool isValid { get { return this != ZERO; }}
48
+ public bool isValid { get { return this != ZERO; } }
43
49
 
44
50
  public override string ToString()
45
51
  {
@@ -0,0 +1,43 @@
1
+ using System.Collections;
2
+ using UnityEngine.Networking;
3
+ using System;
4
+ using System.Collections.Generic;
5
+ using static Amanotes.Core.Internal.Logging;
6
+
7
+ namespace Amanotes.Core.Internal
8
+ {
9
+ internal class WebUtils
10
+ {
11
+ public static void PostJson(string url, string jsonData, Action<bool, string> onComplete = null, Dictionary<string, string> headers = null)
12
+ {
13
+ AmaGDK._instance.StartCoroutine(PostJsonCoroutine(url, jsonData, onComplete, headers));
14
+ }
15
+
16
+ static IEnumerator PostJsonCoroutine(string url, string jsonData, Action<bool, string> onComplete = null, Dictionary<string, string> headers = null)
17
+ {
18
+ UnityWebRequest webRequest = new UnityWebRequest(url, "POST");
19
+ if (headers != null)
20
+ {
21
+ foreach (KeyValuePair<string, string> kvp in headers)
22
+ {
23
+ webRequest.SetRequestHeader(kvp.Key, kvp.Value);
24
+ }
25
+ }
26
+
27
+ byte[] bodyRaw = System.Text.Encoding.UTF8.GetBytes(jsonData);
28
+ webRequest.uploadHandler = new UploadHandlerRaw(bodyRaw);
29
+ webRequest.downloadHandler = new DownloadHandlerBuffer();
30
+ yield return webRequest.SendWebRequest();
31
+
32
+ if (webRequest.result != UnityWebRequest.Result.Success)
33
+ {
34
+ LogWarning("POST request failed: " + webRequest.error);
35
+ onComplete?.Invoke(false, webRequest.error);
36
+ }
37
+ else
38
+ {
39
+ onComplete?.Invoke(true, webRequest.downloadHandler.text);
40
+ }
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: fe77d47845d9e4132b8837f07079a6dd
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/Runtime/AmaGDK.cs CHANGED
@@ -12,7 +12,7 @@ namespace Amanotes.Core
12
12
  {
13
13
  public partial class AmaGDK : MonoBehaviour
14
14
  {
15
- public const string VERSION = "0.1.12";
15
+ public const string VERSION = "0.1.15";
16
16
 
17
17
  internal static AmaGDK _instance;
18
18
  internal static event Action _frameUpdate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.1.12",
3
+ "version": "0.1.15",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2020.3",