com.amanotes.gdk 0.1.11 → 0.1.12
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 +12 -7
- package/Editor/AmaGDKEditor.cs +32 -1
- package/Editor/Resources/amasdk-modules.json +2 -2
- package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +50 -9
- package/Editor/Utils/AmaGDKEditor.GUI.cs +108 -8
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter_v6.5.4.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
- package/Runtime/AmaGDK.Ads.cs +2 -2
- package/Runtime/AmaGDK.Analytics.cs +54 -17
- package/Runtime/AmaGDK.Config.cs +2 -2
- package/Runtime/AmaGDK.Internal.SemVer.cs +117 -0
- package/Runtime/AmaGDK.Internal.SemVer.cs.meta +11 -0
- package/Runtime/AmaGDK.Internal.cs +1 -1
- package/Runtime/AmaGDK.UserProfile.cs +1 -1
- package/Runtime/AmaGDK.cs +4 -12
- package/package.json +1 -1
- package/Packages/AppsflyerAdapter_v6.5.4.unitypackage +0 -0
- /package/Packages/{AppsflyerAdapter_v6.5.4.unitypackage.meta → AppsFlyerAdapter_v6.5.4.unitypackage.meta} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.12 - 2023-03-01]
|
|
4
|
+
### Release AmaGDK v0.1.12
|
|
5
|
+
### Prioritize analytics instant config over the base config
|
|
6
|
+
### Public common config
|
|
7
|
+
|
|
3
8
|
## [0.1.11 - 2023-02-28]
|
|
4
9
|
### Release AmaGDK v0.1.11
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
### Auto start and log Appsflyer open session
|
|
11
|
+
### Add analytics adapter base config
|
|
12
|
+
### Analytics: count by session
|
|
13
|
+
### Export example scene
|
|
14
|
+
### Add AmaGDKManager
|
|
15
|
+
### Refactor Adapter to support for init order configuration
|
|
11
16
|
|
|
12
17
|
## [0.1.10 - 2023-02-17]
|
|
13
18
|
### Release AmaGDK v0.1.10
|
|
@@ -34,4 +39,4 @@
|
|
|
34
39
|
## [0.1.2] - 2023-02-08
|
|
35
40
|
### Release AmaGDK 0.1.2
|
|
36
41
|
### FirebaseAnalytics adapter compatible with FirebaseAnalytics SDK v9
|
|
37
|
-
###
|
|
42
|
+
### AppsFlyer adapter compatible with AppsFlyer SDK v6
|
package/Editor/AmaGDKEditor.cs
CHANGED
|
@@ -6,7 +6,9 @@ using UnityEditor;
|
|
|
6
6
|
using Amanotes.Core;
|
|
7
7
|
using Amanotes.Core.Internal;
|
|
8
8
|
using static Amanotes.Core.Internal.Logging;
|
|
9
|
-
using static Amanotes.Editor.
|
|
9
|
+
using static Amanotes.Editor.AmaGUI;
|
|
10
|
+
using static Amanotes.Core.AmaGDK.AdapterID;
|
|
11
|
+
using System.Text;
|
|
10
12
|
|
|
11
13
|
namespace Amanotes.Editor
|
|
12
14
|
{
|
|
@@ -137,6 +139,14 @@ namespace Amanotes.Editor
|
|
|
137
139
|
}
|
|
138
140
|
GUILayout.EndHorizontal();
|
|
139
141
|
}
|
|
142
|
+
|
|
143
|
+
private static readonly string[] SDK_IDS = new string[]{
|
|
144
|
+
FIREBASE_ANALYTICS,
|
|
145
|
+
FIREBASE_REMOTE_CONFIG,
|
|
146
|
+
APPSFLYER,
|
|
147
|
+
IRONSOURCE,
|
|
148
|
+
REVENUECAT
|
|
149
|
+
};
|
|
140
150
|
|
|
141
151
|
public override void OnInspectorGUI()
|
|
142
152
|
{
|
|
@@ -144,7 +154,28 @@ namespace Amanotes.Editor
|
|
|
144
154
|
|
|
145
155
|
// DrawGUI_ColorPicker();
|
|
146
156
|
SectionLabel($"<b>AmaGDK</b> <size=12><color=gray>v{AmaGDK.VERSION}</color></size>");
|
|
157
|
+
EditorGUILayout.Space();
|
|
147
158
|
|
|
159
|
+
for (var i =0 ;i < SDK_IDS.Length; i++)
|
|
160
|
+
{
|
|
161
|
+
AmaGUI.DrawSDKStatus(SDK_IDS[i]);
|
|
162
|
+
}
|
|
163
|
+
EditorGUILayout.Space();
|
|
164
|
+
|
|
165
|
+
if (GUILayout.Button("version_info.tsv -> Clipboard")){
|
|
166
|
+
var sb = new StringBuilder();
|
|
167
|
+
sb.AppendLine("ID\tSDK VERSION\tADAPTER VERSION");
|
|
168
|
+
for (var i =0 ;i < SDK_IDS.Length; i++)
|
|
169
|
+
{
|
|
170
|
+
sb.AppendLine(SDKStatus.Get(SDK_IDS[i]).ToTSVString());
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
var tsv = sb.ToString();
|
|
174
|
+
EditorGUIUtility.systemCopyBuffer = tsv;
|
|
175
|
+
Debug.Log($"Content of version_info.tsv copied to clipboard!\n\n{tsv}\n\n");
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
|
|
148
179
|
if (configAsset == null)
|
|
149
180
|
{
|
|
150
181
|
DrawGUI_ConfigMissing();
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"infoURL": "https://d29y8yeuyaq8nk.cloudfront.net/firebase-remote-config"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"id": "
|
|
16
|
-
"name": "
|
|
15
|
+
"id": "AppsFlyer",
|
|
16
|
+
"name": "AppsFlyer",
|
|
17
17
|
"adapter": "AppsFlyerAdapter",
|
|
18
18
|
"infoURL": "https://d29y8yeuyaq8nk.cloudfront.net/appsflyer"
|
|
19
19
|
},
|
|
@@ -4,17 +4,55 @@ using System.IO;
|
|
|
4
4
|
using System.Linq;
|
|
5
5
|
using System.Reflection;
|
|
6
6
|
using System.Xml;
|
|
7
|
-
using Amanotes.Core;
|
|
7
|
+
using Amanotes.Core.Internal;
|
|
8
8
|
using UnityEngine;
|
|
9
9
|
using static Amanotes.Core.AmaGDK.AdapterID;
|
|
10
10
|
|
|
11
11
|
namespace Amanotes.Editor
|
|
12
12
|
{
|
|
13
|
+
[Serializable] internal class SDKStatus
|
|
14
|
+
{
|
|
15
|
+
public string sdkId;
|
|
16
|
+
public SemVer sdkVersion;
|
|
17
|
+
public SemVer adapterVersion;
|
|
18
|
+
|
|
19
|
+
public bool sdkInstalled { get { return sdkVersion > SemVer.ZERO; }}
|
|
20
|
+
public bool adapterInstalled { get { return sdkVersion > SemVer.ZERO; }}
|
|
21
|
+
|
|
22
|
+
public string ToTSVString()
|
|
23
|
+
{
|
|
24
|
+
return $"{sdkId}\t{sdkVersion}\t{adapterVersion}";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//
|
|
28
|
+
|
|
29
|
+
static readonly public Dictionary<string, SDKStatus> _cache = new Dictionary<string, SDKStatus>();
|
|
30
|
+
static public SDKStatus Get(string sdkId, bool force = false){
|
|
31
|
+
if (!force && _cache.TryGetValue(sdkId, out var result)) return result;
|
|
32
|
+
|
|
33
|
+
result = new SDKStatus(){
|
|
34
|
+
sdkId = sdkId,
|
|
35
|
+
adapterVersion = new SemVer(ExtractVersion.GDKAdapter(sdkId)),
|
|
36
|
+
sdkVersion = new SemVer(ExtractVersion.ThirdParty(sdkId))
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
if (_cache.ContainsKey(sdkId)){
|
|
40
|
+
_cache[sdkId] = result;
|
|
41
|
+
} else {
|
|
42
|
+
_cache.Add(sdkId, result);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
13
49
|
public class ExtractVersion
|
|
14
50
|
{
|
|
15
51
|
public static string GDKAdapter(string sdkId)
|
|
16
52
|
{
|
|
17
53
|
string version = null;
|
|
54
|
+
var adapterId = sdkId + "Adapter";
|
|
55
|
+
// Debug.Log($"Searching for AdapterId: {adapterId}");
|
|
18
56
|
List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
|
|
19
57
|
if (assemblies != null)
|
|
20
58
|
{
|
|
@@ -22,11 +60,16 @@ namespace Amanotes.Editor
|
|
|
22
60
|
{
|
|
23
61
|
foreach (Type oType in assembly.GetTypes())
|
|
24
62
|
{
|
|
25
|
-
if (oType.Name.Equals(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
63
|
+
if (!oType.Name.Equals(adapterId)) continue;
|
|
64
|
+
|
|
65
|
+
var field = oType.GetField("VERSION");
|
|
66
|
+
if (field == null) {
|
|
67
|
+
// Debug.Log("Found: " + oType + " --> " + field);
|
|
68
|
+
continue;
|
|
29
69
|
}
|
|
70
|
+
|
|
71
|
+
version = field.GetValue(null).ToString();
|
|
72
|
+
return version;
|
|
30
73
|
}
|
|
31
74
|
}
|
|
32
75
|
}
|
|
@@ -40,7 +83,7 @@ namespace Amanotes.Editor
|
|
|
40
83
|
{
|
|
41
84
|
case FIREBASE_ANALYTICS : return FirebaseAnalytics();
|
|
42
85
|
case FIREBASE_REMOTE_CONFIG : return FirebaseRemoteConfig();
|
|
43
|
-
case APPSFLYER : return
|
|
86
|
+
case APPSFLYER : return AppsFlyer();
|
|
44
87
|
case IRONSOURCE : return Ironsource();
|
|
45
88
|
case REVENUECAT : return RevenueCat();
|
|
46
89
|
default:
|
|
@@ -102,7 +145,7 @@ namespace Amanotes.Editor
|
|
|
102
145
|
return version;
|
|
103
146
|
}
|
|
104
147
|
|
|
105
|
-
internal static string
|
|
148
|
+
internal static string AppsFlyer()
|
|
106
149
|
{
|
|
107
150
|
string version = null;
|
|
108
151
|
List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
|
|
@@ -138,8 +181,6 @@ namespace Amanotes.Editor
|
|
|
138
181
|
return version;
|
|
139
182
|
}
|
|
140
183
|
|
|
141
|
-
|
|
142
|
-
|
|
143
184
|
internal static string RevenueCat()
|
|
144
185
|
{
|
|
145
186
|
string[] files = Directory.GetFiles("Assets", "PurchasesWrapper.java", SearchOption.AllDirectories);
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using
|
|
3
|
-
using System.Collections.Generic;
|
|
2
|
+
using Amanotes.Core.Internal;
|
|
4
3
|
using UnityEditor;
|
|
5
4
|
using UnityEngine;
|
|
6
5
|
|
|
7
6
|
namespace Amanotes.Editor
|
|
8
7
|
{
|
|
9
|
-
public static class
|
|
8
|
+
public static class AmaGUI
|
|
10
9
|
{
|
|
11
|
-
static Color LIGHT_BLUE = new Color(0.
|
|
12
|
-
|
|
10
|
+
static Color LIGHT_BLUE = new Color(0.2f, 0.45f, 1f);
|
|
11
|
+
static Color LIGHT_GRAY = new Color(0.6f, 0.6f, 0.6f);
|
|
12
|
+
static Color DARK = new Color(0.15f, 0.15f, 0.15f, 1f);
|
|
13
|
+
|
|
13
14
|
static GUIStyle BIG_LABEL = null;
|
|
14
15
|
|
|
15
16
|
public static void SectionLabel(string text)
|
|
@@ -25,10 +26,10 @@ namespace Amanotes.Editor
|
|
|
25
26
|
|
|
26
27
|
BIG_LABEL.normal.textColor = Color.white;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
|
|
29
30
|
Rect rect = GUILayoutUtility.GetRect(Screen.width, 32);
|
|
30
31
|
rect.xMin -= 16f;
|
|
31
|
-
EditorGUI.DrawRect(rect,
|
|
32
|
+
EditorGUI.DrawRect(rect, DARK);
|
|
32
33
|
EditorGUI.LabelField(rect, text, BIG_LABEL);
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -59,7 +60,8 @@ namespace Amanotes.Editor
|
|
|
59
60
|
return true;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
public static bool ToggleGroup(string label, ref bool isOpen, Action drawFunc, Action titleFunc = null)
|
|
63
|
+
public static bool ToggleGroup(string label, ref bool isOpen, Action drawFunc, Action titleFunc = null)
|
|
64
|
+
{
|
|
63
65
|
GUILayout.BeginHorizontal();
|
|
64
66
|
var newValue = EditorGUILayout.Foldout(isOpen, label);
|
|
65
67
|
var changed = newValue != isOpen;
|
|
@@ -78,5 +80,103 @@ namespace Amanotes.Editor
|
|
|
78
80
|
isOpen = newValue;
|
|
79
81
|
return true;
|
|
80
82
|
}
|
|
83
|
+
|
|
84
|
+
static readonly Texture2D TAG_0 = (Texture2D)EditorGUIUtility.IconContent("sv_label_0").image;
|
|
85
|
+
static readonly Texture2D TAG_1 = (Texture2D)EditorGUIUtility.IconContent("sv_icon_dot1_pix16_gizmo").image;
|
|
86
|
+
static GUIStyle versionStyle;
|
|
87
|
+
static GUIStyle tagLabelStyle;
|
|
88
|
+
|
|
89
|
+
public static void SemVerGUI(string title, SemVer version)
|
|
90
|
+
{
|
|
91
|
+
if (versionStyle == null){
|
|
92
|
+
versionStyle = new GUIStyle(EditorStyles.miniBoldLabel)
|
|
93
|
+
{
|
|
94
|
+
alignment = TextAnchor.MiddleCenter
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
var rect = GUILayoutUtility.GetRect(100, 16f);
|
|
99
|
+
var rect1 = rect;
|
|
100
|
+
|
|
101
|
+
rect1.width /= 2;
|
|
102
|
+
var rect2 = rect1;
|
|
103
|
+
rect2.x += rect.width / 2f;
|
|
104
|
+
|
|
105
|
+
GUI.Box(rect, GUIContent.none);
|
|
106
|
+
DrawTag(rect2, version.ToString(), version.isValid ? LIGHT_BLUE : LIGHT_GRAY, 0.5f, 2f);
|
|
107
|
+
|
|
108
|
+
rect1.xMin += 4f;
|
|
109
|
+
GUI.Label(rect1, title, versionStyle);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public static void DrawSDKStatus(string sdkId){
|
|
113
|
+
var status = SDKStatus.Get(sdkId);
|
|
114
|
+
GUILayout.BeginHorizontal();
|
|
115
|
+
{
|
|
116
|
+
GUILayout.Label(ObjectNames.NicifyVariableName(sdkId), EditorStyles.boldLabel);
|
|
117
|
+
GUILayout.FlexibleSpace();
|
|
118
|
+
SemVerGUI("SDK", status.sdkVersion);
|
|
119
|
+
GUILayout.Space(4);
|
|
120
|
+
SemVerGUI("Adapter", status.adapterVersion);
|
|
121
|
+
}
|
|
122
|
+
GUILayout.EndHorizontal();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public static void DrawTag(Rect rect, string label, Color tagColor, float alpha = 1f, float margin = 2f)
|
|
126
|
+
{
|
|
127
|
+
if (tagLabelStyle == null){
|
|
128
|
+
tagLabelStyle = new GUIStyle(EditorStyles.miniBoldLabel)
|
|
129
|
+
{
|
|
130
|
+
alignment = TextAnchor.MiddleCenter
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
rect.xMin += margin;
|
|
135
|
+
rect.xMax -= margin;
|
|
136
|
+
rect.yMin += margin;
|
|
137
|
+
rect.yMax -= margin;
|
|
138
|
+
|
|
139
|
+
tagColor.a = alpha;
|
|
140
|
+
GUI.DrawTexture(rect, Texture2D.whiteTexture, ScaleMode.StretchToFill, false, 1f, tagColor, 0f, 5f);
|
|
141
|
+
|
|
142
|
+
rect.xMin += 4f;
|
|
143
|
+
GUI.Label(rect, label, versionStyle);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public static void Draw9Slice(Rect rect, Texture2D texture,
|
|
147
|
+
float l, float r, float t, float b)
|
|
148
|
+
{
|
|
149
|
+
float x = rect.x;
|
|
150
|
+
float y = rect.y;
|
|
151
|
+
float w = rect.width;
|
|
152
|
+
float h = rect.height;
|
|
153
|
+
|
|
154
|
+
float tw = texture.width;
|
|
155
|
+
float th = texture.height;
|
|
156
|
+
|
|
157
|
+
float lu = l / tw;
|
|
158
|
+
float ru = (tw - r) / tw;
|
|
159
|
+
float tv = (th-t) / th;
|
|
160
|
+
float bv = b / th;
|
|
161
|
+
|
|
162
|
+
// Calculate the sizes of the texture's center and corners.
|
|
163
|
+
float centerX = Mathf.Max(w - l - r, 0);
|
|
164
|
+
float centerY = Mathf.Max(h - t - b, 0);
|
|
165
|
+
|
|
166
|
+
// Draw the corners.
|
|
167
|
+
GUI.DrawTextureWithTexCoords(new Rect(x, y, l, t), texture, new Rect(0, tv, lu, t/th));
|
|
168
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + w - r, y, r, t), texture, new Rect(ru, tv, r/tw, t/th));
|
|
169
|
+
GUI.DrawTextureWithTexCoords(new Rect(x, y + h - b, l, b), texture, new Rect(0, 0, lu, bv));
|
|
170
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + w - r, y + h - b, r, b), texture, new Rect(ru, 0, r/tw, bv));
|
|
171
|
+
|
|
172
|
+
// Draw the edges.
|
|
173
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + l, y, centerX, t), texture, new Rect(lu, tv, ru-lu, t/th));
|
|
174
|
+
GUI.DrawTextureWithTexCoords(new Rect(x, y + t, l, centerY), texture, new Rect(0, bv, lu, tv-bv));
|
|
175
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + w - r, y + t, r, centerY), texture, new Rect(ru, bv, r/tw, tv-bv));
|
|
176
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + l, y + h - b, centerX, b), texture, new Rect(lu, 0, ru-lu, bv));
|
|
177
|
+
|
|
178
|
+
// Draw the center.
|
|
179
|
+
GUI.DrawTextureWithTexCoords(new Rect(x + l, y + t, centerX, centerY), texture, new Rect(lu, bv, ru-lu, tv-bv));
|
|
180
|
+
}
|
|
81
181
|
}
|
|
82
182
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/Runtime/AmaGDK.Ads.cs
CHANGED
|
@@ -122,7 +122,7 @@ namespace Amanotes.Core
|
|
|
122
122
|
if (!adsModule.IsAdReady(AdType.Interstitial))
|
|
123
123
|
{
|
|
124
124
|
LogWarning("Interstitial is not ready");
|
|
125
|
-
|
|
125
|
+
AmaGDK._instance.StartCoroutine(IWaitShowInterstitial());
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
adsModule.ShowInterstitial();
|
|
@@ -143,7 +143,7 @@ namespace Amanotes.Core
|
|
|
143
143
|
if (!adsModule.IsAdReady(AdType.Reward))
|
|
144
144
|
{
|
|
145
145
|
LogWarning("Reward is not ready");
|
|
146
|
-
|
|
146
|
+
AmaGDK._instance.StartCoroutine(IWaitShowRewardedVideo());
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
149
|
adsModule.ShowRewardedVideo();
|
|
@@ -13,14 +13,15 @@ namespace Amanotes.Core
|
|
|
13
13
|
public class AnalyticsAdapterBaseConfig
|
|
14
14
|
{
|
|
15
15
|
public bool SendEventByDefault;
|
|
16
|
+
|
|
16
17
|
public List<string> NeverSend;
|
|
17
18
|
public List<string> AlwaysSend;
|
|
18
19
|
|
|
19
|
-
public bool
|
|
20
|
+
public bool IsForbidden(string eventName)
|
|
20
21
|
{
|
|
21
22
|
return SendEventByDefault
|
|
22
|
-
?
|
|
23
|
-
: AlwaysSend.Contains(eventName);
|
|
23
|
+
? NeverSend.Contains(eventName)
|
|
24
|
+
: !AlwaysSend.Contains(eventName);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -38,8 +39,10 @@ namespace Amanotes.Core
|
|
|
38
39
|
public string funnelSignature;
|
|
39
40
|
public bool accumulated;
|
|
40
41
|
public bool withinSession;
|
|
41
|
-
|
|
42
|
-
public
|
|
42
|
+
|
|
43
|
+
public bool overrideConfig;
|
|
44
|
+
public HashSet<string> ignoreAdapterIds = new HashSet<string>();
|
|
45
|
+
public HashSet<string> allowAdapterIds = new HashSet<string>();
|
|
43
46
|
|
|
44
47
|
public EventParams(string eventName)
|
|
45
48
|
{
|
|
@@ -50,6 +53,22 @@ namespace Amanotes.Core
|
|
|
50
53
|
{
|
|
51
54
|
get { return !string.IsNullOrEmpty(funnelSignature); }
|
|
52
55
|
}
|
|
56
|
+
|
|
57
|
+
public bool IsForbidden(string adapterId)
|
|
58
|
+
{
|
|
59
|
+
if (ignoreAdapterIds.Count > 0)
|
|
60
|
+
{
|
|
61
|
+
return ignoreAdapterIds.Contains(adapterId);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (allowAdapterIds.Count > 0)
|
|
65
|
+
{
|
|
66
|
+
return !allowAdapterIds.Contains(adapterId);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Debug.LogWarning("[AmaGDK] Should never be here: overrideConfig == true but no id in listAdapterIds!");
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
53
72
|
}
|
|
54
73
|
|
|
55
74
|
public static IEventParamsBuilder LogEvent(string eventName)
|
|
@@ -237,14 +256,10 @@ namespace Amanotes.Core
|
|
|
237
256
|
eventData.AddParam("accumulated_count", eventData.withinSession ? countInSession : totalCount);
|
|
238
257
|
}
|
|
239
258
|
|
|
259
|
+
if (showAnalyticsLog) Debug.Log($"[AmaGDK] Event <{eventData.eventName}> (in session: {countInSession}, total: {totalCount})");
|
|
240
260
|
foreach (var m in listAdapters)
|
|
241
|
-
{
|
|
242
|
-
|
|
243
|
-
continue;
|
|
244
|
-
if (eventData.ignoreAnalyticIds.Contains(m.id))
|
|
245
|
-
continue;
|
|
246
|
-
m.GetAdapterApi<IAnalyticAdapter>().LogEvent(eventData);
|
|
247
|
-
if (showAnalyticsLog) Debug.Log($"[{m.id}] Sent event <{eventData.eventName}> (in session: {countInSession}, total: {totalCount})");
|
|
261
|
+
{
|
|
262
|
+
m.GetAdapterApi<IAnalyticAdapter>().LogEvent(eventData);
|
|
248
263
|
}
|
|
249
264
|
}
|
|
250
265
|
|
|
@@ -441,12 +456,23 @@ namespace Amanotes.Core
|
|
|
441
456
|
public static IEventParamsBuilder Except(this IEventParamsBuilder ap, params string[] analyticIds)
|
|
442
457
|
{
|
|
443
458
|
if (ap == null) return null;
|
|
444
|
-
if (analyticIds.Length == 0)
|
|
459
|
+
if (analyticIds.Length == 0)
|
|
460
|
+
{
|
|
461
|
+
LogWarning("Except() expect at least one analytics id!");
|
|
462
|
+
return ap;
|
|
463
|
+
}
|
|
445
464
|
|
|
446
465
|
EventParams eventData = ap as EventParams;
|
|
466
|
+
if (eventData.overrideConfig)
|
|
467
|
+
{
|
|
468
|
+
LogWarning("Except() can only be set once!");
|
|
469
|
+
return ap;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
eventData.overrideConfig = true;
|
|
447
473
|
foreach (var mId in analyticIds)
|
|
448
474
|
{
|
|
449
|
-
eventData.
|
|
475
|
+
eventData.ignoreAdapterIds.Add(mId);
|
|
450
476
|
}
|
|
451
477
|
return ap;
|
|
452
478
|
}
|
|
@@ -454,12 +480,23 @@ namespace Amanotes.Core
|
|
|
454
480
|
public static IEventParamsBuilder OnlyTo(this IEventParamsBuilder ap, params string[] analyticIds)
|
|
455
481
|
{
|
|
456
482
|
if (ap == null) return null;
|
|
457
|
-
if (analyticIds.Length == 0)
|
|
483
|
+
if (analyticIds.Length == 0)
|
|
484
|
+
{
|
|
485
|
+
LogWarning("OnlyTo() expect at least one analytics id!");
|
|
486
|
+
return ap;
|
|
487
|
+
}
|
|
458
488
|
|
|
459
489
|
EventParams eventData = ap as EventParams;
|
|
490
|
+
if (eventData.overrideConfig)
|
|
491
|
+
{
|
|
492
|
+
LogWarning("OnlyTo() can only be set once!");
|
|
493
|
+
return ap;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
eventData.overrideConfig = true;
|
|
460
497
|
foreach (var mId in analyticIds)
|
|
461
498
|
{
|
|
462
|
-
eventData.
|
|
499
|
+
eventData.allowAdapterIds.Add(mId);
|
|
463
500
|
}
|
|
464
501
|
return ap;
|
|
465
502
|
}
|
|
@@ -536,7 +573,7 @@ namespace Amanotes.Core
|
|
|
536
573
|
|
|
537
574
|
namespace Amanotes.Core.Internal
|
|
538
575
|
{
|
|
539
|
-
partial class SDKConfig
|
|
576
|
+
public partial class SDKConfig
|
|
540
577
|
{
|
|
541
578
|
public bool showAnalyticsLog = true;
|
|
542
579
|
public bool normalizeEventName = true;
|
package/Runtime/AmaGDK.Config.cs
CHANGED
|
@@ -12,7 +12,7 @@ namespace Amanotes.Core.Internal {
|
|
|
12
12
|
{
|
|
13
13
|
[SerializeField] internal bool simpleOrder = true;
|
|
14
14
|
[SerializeField] internal List<InitOrder> initOrder = new List<InitOrder>();
|
|
15
|
-
[SerializeField]
|
|
15
|
+
[SerializeField] public SDKConfig common;
|
|
16
16
|
|
|
17
17
|
#if UNITY_EDITOR
|
|
18
18
|
void OnValidate()
|
|
@@ -80,7 +80,7 @@ namespace Amanotes.Core.Internal {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
[Serializable]
|
|
83
|
-
|
|
83
|
+
public partial class SDKConfig
|
|
84
84
|
{
|
|
85
85
|
public bool verboseLog = false;
|
|
86
86
|
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Text.RegularExpressions;
|
|
4
|
+
|
|
5
|
+
namespace Amanotes.Core.Internal
|
|
6
|
+
{
|
|
7
|
+
public struct SemVer : IComparable<SemVer>, IComparer<SemVer>
|
|
8
|
+
{
|
|
9
|
+
public static readonly SemVer ZERO = new SemVer(0,0,0);
|
|
10
|
+
|
|
11
|
+
public int major;
|
|
12
|
+
public int minor;
|
|
13
|
+
public int patch;
|
|
14
|
+
|
|
15
|
+
public SemVer(int major, int minor, int patch)
|
|
16
|
+
{
|
|
17
|
+
this.major = major;
|
|
18
|
+
this.minor = minor;
|
|
19
|
+
this.patch = patch;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public SemVer(string version)
|
|
23
|
+
{
|
|
24
|
+
if (string.IsNullOrEmpty(version)) {
|
|
25
|
+
major = 0;
|
|
26
|
+
minor = 0;
|
|
27
|
+
patch = 0;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Regex regex = new Regex(@"^(\d+)\.(\d+)\.(\d+)$");
|
|
32
|
+
Match match = regex.Match(version);
|
|
33
|
+
if (!match.Success)
|
|
34
|
+
{
|
|
35
|
+
throw new ArgumentException("Invalid SemVer string", "version");
|
|
36
|
+
}
|
|
37
|
+
major = int.Parse(match.Groups[1].Value);
|
|
38
|
+
minor = int.Parse(match.Groups[2].Value);
|
|
39
|
+
patch = int.Parse(match.Groups[3].Value);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public bool isValid { get { return this != ZERO; }}
|
|
43
|
+
|
|
44
|
+
public override string ToString()
|
|
45
|
+
{
|
|
46
|
+
if (this == ZERO) return "-";
|
|
47
|
+
return $"{major}.{minor}.{patch}";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public int CompareTo(SemVer other)
|
|
51
|
+
{
|
|
52
|
+
if (major != other.major)
|
|
53
|
+
{
|
|
54
|
+
return major.CompareTo(other.major);
|
|
55
|
+
}
|
|
56
|
+
if (minor != other.minor)
|
|
57
|
+
{
|
|
58
|
+
return minor.CompareTo(other.minor);
|
|
59
|
+
}
|
|
60
|
+
if (patch != other.patch)
|
|
61
|
+
{
|
|
62
|
+
return patch.CompareTo(other.patch);
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public int Compare(SemVer x, SemVer y)
|
|
68
|
+
{
|
|
69
|
+
return x.CompareTo(y);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public override bool Equals(object obj)
|
|
73
|
+
{
|
|
74
|
+
if (!(obj is SemVer))
|
|
75
|
+
{
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
SemVer other = (SemVer)obj;
|
|
79
|
+
return major == other.major && minor == other.minor && patch == other.patch;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public static bool operator >(SemVer x, SemVer y)
|
|
83
|
+
{
|
|
84
|
+
return x.CompareTo(y) > 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public static bool operator <(SemVer x, SemVer y)
|
|
88
|
+
{
|
|
89
|
+
return x.CompareTo(y) < 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public static bool operator >=(SemVer x, SemVer y)
|
|
93
|
+
{
|
|
94
|
+
return x.CompareTo(y) >= 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public static bool operator <=(SemVer x, SemVer y)
|
|
98
|
+
{
|
|
99
|
+
return x.CompareTo(y) <= 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public static bool operator ==(SemVer x, SemVer y)
|
|
103
|
+
{
|
|
104
|
+
return x.Equals(y);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public static bool operator !=(SemVer x, SemVer y)
|
|
108
|
+
{
|
|
109
|
+
return !x.Equals(y);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public override int GetHashCode()
|
|
113
|
+
{
|
|
114
|
+
return (major << 16) | (minor << 8) | patch;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
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.
|
|
15
|
+
public const string VERSION = "0.1.12";
|
|
16
16
|
|
|
17
17
|
internal static AmaGDK _instance;
|
|
18
18
|
internal static event Action _frameUpdate;
|
|
@@ -147,17 +147,9 @@ namespace Amanotes.Core
|
|
|
147
147
|
_instance = sdk.AddComponent<AmaGDK>();
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
{
|
|
152
|
-
_instance.StartCoroutine(enumerator);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
public static void EndCoroutine(IEnumerator enumerator)
|
|
156
|
-
{
|
|
157
|
-
_instance.StopCoroutine(enumerator);
|
|
158
|
-
}
|
|
150
|
+
|
|
159
151
|
|
|
160
|
-
public static void
|
|
152
|
+
public static void SetOnReadyCallback(Action onReady)
|
|
161
153
|
{
|
|
162
154
|
if (onReady == null)
|
|
163
155
|
{
|
|
@@ -176,7 +168,7 @@ namespace Amanotes.Core
|
|
|
176
168
|
{
|
|
177
169
|
public const string FIREBASE_ANALYTICS = "FirebaseAnalytics";
|
|
178
170
|
public const string FIREBASE_REMOTE_CONFIG = "FirebaseRemoteConfig";
|
|
179
|
-
public const string APPSFLYER = "
|
|
171
|
+
public const string APPSFLYER = "AppsFlyer";
|
|
180
172
|
public const string IRONSOURCE = "IronSource";
|
|
181
173
|
public const string REVENUECAT = "RevenueCat";
|
|
182
174
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
File without changes
|