com.amanotes.gdk 0.2.11 → 0.2.13
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 -0
- package/Editor/AmaGDKEditor.cs +22 -4
- package/Editor/AssemblyInfo.cs +5 -0
- package/Editor/AssemblyInfo.cs.meta +11 -0
- package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +20 -0
- package/Editor/Utils/AmaGDKEditor.GUI.cs +10 -14
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AmaGDKProject.unitypackage +0 -0
- package/Packages/AdjustAdapter_v4.33.0.unitypackage +0 -0
- package/Packages/AdjustAdapter_v4.33.0.unitypackage.meta +7 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AmaPassport.ATTSupport.unitypackage +0 -0
- package/Packages/AmaPassportAdapter_v1.0.0.unitypackage +0 -0
- 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.2.6.unitypackage +0 -0
- package/Runtime/AmaGDK.Ads.cs +46 -14
- package/Runtime/AmaGDK.Analytics.cs +1 -1
- package/Runtime/AmaGDK.Internal.cs +0 -8
- package/Runtime/AmaGDK.RemoteConfig.cs +4 -4
- package/Runtime/AmaGDK.UserProfile.cs +2 -2
- package/Runtime/AmaGDK.Utils.cs +34 -6
- package/Runtime/AmaGDK.cs +51 -2
- package/Runtime/AssemblyInfo.cs +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.13 - 2023-07-20]
|
|
4
|
+
### Fix error Remote Config JSON caused by special chars (", ', \)
|
|
5
|
+
|
|
6
|
+
## [0.2.12 - 2023-07-07]
|
|
7
|
+
### Restructure GDK - symlink GDK source to unity projects
|
|
8
|
+
### Unity 2019 compatible - no null coalescing
|
|
9
|
+
### Remove redundant AmaPassport config field
|
|
10
|
+
### Auto request AmaId
|
|
11
|
+
|
|
3
12
|
## [0.2.11 - 2023-06-29]
|
|
4
13
|
### SetLogCondition with EventParam
|
|
5
14
|
### Rename Migrated -> HasMigrated
|
package/Editor/AmaGDKEditor.cs
CHANGED
|
@@ -3,6 +3,7 @@ using System.Text;
|
|
|
3
3
|
using Amanotes.Core;
|
|
4
4
|
using Amanotes.Core.Internal;
|
|
5
5
|
using System.Collections.Generic;
|
|
6
|
+
using System.IO;
|
|
6
7
|
using UnityEditor;
|
|
7
8
|
using UnityEngine;
|
|
8
9
|
using static Amanotes.Core.Internal.Logging;
|
|
@@ -23,6 +24,8 @@ namespace Amanotes.Editor
|
|
|
23
24
|
private static bool showConfigDetail;
|
|
24
25
|
private static bool showAdapterInstaller;
|
|
25
26
|
private static bool showExampleDetail;
|
|
27
|
+
private bool adapterScanned;
|
|
28
|
+
private readonly List<string> lstAdapter = new List<string>();
|
|
26
29
|
|
|
27
30
|
public static Color btnColor;
|
|
28
31
|
public static float btnLerp;
|
|
@@ -32,6 +35,7 @@ namespace Amanotes.Editor
|
|
|
32
35
|
FIREBASE_ANALYTICS,
|
|
33
36
|
FIREBASE_REMOTE_CONFIG,
|
|
34
37
|
APPSFLYER,
|
|
38
|
+
ADJUST,
|
|
35
39
|
IRONSOURCE,
|
|
36
40
|
REVENUECAT
|
|
37
41
|
};
|
|
@@ -118,14 +122,28 @@ namespace Amanotes.Editor
|
|
|
118
122
|
EditorGUILayout.ObjectField(configAsset, configAsset.GetType(), false);
|
|
119
123
|
}
|
|
120
124
|
|
|
125
|
+
private void UpdateListAdapter()
|
|
126
|
+
{
|
|
127
|
+
if(adapterScanned)
|
|
128
|
+
return;
|
|
129
|
+
|
|
130
|
+
adapterScanned = true;
|
|
131
|
+
|
|
132
|
+
var adapterPath = Directory.GetFiles(Res.PACKAGE_PATH, "*Adapter*.unitypackage", SearchOption.AllDirectories);
|
|
133
|
+
|
|
134
|
+
for (int i = 0; i < adapterPath.Length; i++)
|
|
135
|
+
{
|
|
136
|
+
lstAdapter.Add(Path.GetFileName(adapterPath[i]));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
121
139
|
private void DrawGUI_AdapterList()
|
|
122
140
|
{
|
|
123
|
-
|
|
141
|
+
UpdateListAdapter();
|
|
142
|
+
foreach (var adapter in lstAdapter)
|
|
124
143
|
{
|
|
125
|
-
|
|
126
|
-
if (GUILayout.Button(ObjectNames.NicifyVariableName(adapterName)))
|
|
144
|
+
if (GUILayout.Button(ObjectNames.NicifyVariableName(adapter)))
|
|
127
145
|
{
|
|
128
|
-
var package = $"{Res.PACKAGE_PATH}{
|
|
146
|
+
var package = $"{Res.PACKAGE_PATH}{adapter}";
|
|
129
147
|
AssetDatabase.ImportPackage(package, false);
|
|
130
148
|
}
|
|
131
149
|
}
|
|
@@ -101,6 +101,7 @@ namespace Amanotes.Editor
|
|
|
101
101
|
case FIREBASE_ANALYTICS: return FirebaseAnalytics();
|
|
102
102
|
case FIREBASE_REMOTE_CONFIG: return FirebaseRemoteConfig();
|
|
103
103
|
case APPSFLYER: return AppsFlyer();
|
|
104
|
+
case ADJUST: return Adjust();
|
|
104
105
|
case IRONSOURCE: return Ironsource();
|
|
105
106
|
case REVENUECAT: return RevenueCat();
|
|
106
107
|
default:
|
|
@@ -172,6 +173,25 @@ namespace Amanotes.Editor
|
|
|
172
173
|
|
|
173
174
|
return version.Trim();
|
|
174
175
|
}
|
|
176
|
+
|
|
177
|
+
internal static string Adjust()
|
|
178
|
+
{
|
|
179
|
+
var version = "";
|
|
180
|
+
List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
|
|
181
|
+
foreach (var assembly in assemblies)
|
|
182
|
+
{
|
|
183
|
+
foreach (var oType in assembly.GetTypes())
|
|
184
|
+
{
|
|
185
|
+
if (oType.Name.Equals("AdjustAndroid") || oType.Name.Equals("AdjustiOS") )
|
|
186
|
+
{
|
|
187
|
+
version = oType.GetField("sdkPrefix", BindingFlags.Static | BindingFlags.NonPublic)?.GetValue(null).ToString();
|
|
188
|
+
version = version.StartsWith("unity") ? version.Substring(5) : "";
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return version.Trim();
|
|
194
|
+
}
|
|
175
195
|
|
|
176
196
|
internal static string Ironsource()
|
|
177
197
|
{
|
|
@@ -14,8 +14,14 @@ namespace Amanotes.Editor
|
|
|
14
14
|
|
|
15
15
|
private static readonly Texture2D TAG_0 = (Texture2D)EditorGUIUtility.IconContent("sv_label_0").image;
|
|
16
16
|
private static readonly Texture2D TAG_1 = (Texture2D)EditorGUIUtility.IconContent("sv_icon_dot1_pix16_gizmo").image;
|
|
17
|
-
private static GUIStyle versionStyle
|
|
18
|
-
|
|
17
|
+
private static GUIStyle versionStyle = new GUIStyle(EditorStyles.miniBoldLabel)
|
|
18
|
+
{
|
|
19
|
+
alignment = TextAnchor.MiddleCenter
|
|
20
|
+
};
|
|
21
|
+
private static GUIStyle tagLabelStyle = new GUIStyle(EditorStyles.miniBoldLabel)
|
|
22
|
+
{
|
|
23
|
+
alignment = TextAnchor.MiddleCenter
|
|
24
|
+
};
|
|
19
25
|
|
|
20
26
|
public static void SectionLabel(string text)
|
|
21
27
|
{
|
|
@@ -88,11 +94,6 @@ namespace Amanotes.Editor
|
|
|
88
94
|
public static void SemVerGUI(string title, SemVer version, Color? color1 = null, Color? color2 = null)
|
|
89
95
|
{
|
|
90
96
|
const int TAG_SIZE = 60;
|
|
91
|
-
versionStyle ??= new GUIStyle(EditorStyles.miniBoldLabel)
|
|
92
|
-
{
|
|
93
|
-
alignment = TextAnchor.MiddleCenter
|
|
94
|
-
};
|
|
95
|
-
|
|
96
97
|
var rect = GUILayoutUtility.GetRect(120, 16f);
|
|
97
98
|
var rect1 = rect;
|
|
98
99
|
|
|
@@ -104,8 +105,8 @@ namespace Amanotes.Editor
|
|
|
104
105
|
rect2.xMin += (rect2.width-TAG_SIZE);
|
|
105
106
|
rect2.width = TAG_SIZE;
|
|
106
107
|
|
|
107
|
-
color1
|
|
108
|
-
color2
|
|
108
|
+
if (!color1.HasValue) color1 = LIGHT_BLUE;
|
|
109
|
+
if (!color2.HasValue) color2 = LIGHT_GRAY;
|
|
109
110
|
DrawTag(rect2, version.ToString(), version.isValid ? color1.Value : color2.Value, 0.5f);
|
|
110
111
|
|
|
111
112
|
rect1.xMin += 4f;
|
|
@@ -129,11 +130,6 @@ namespace Amanotes.Editor
|
|
|
129
130
|
|
|
130
131
|
public static void DrawTag(Rect rect, string label, Color tagColor, float alpha = 1f, float margin = 1f)
|
|
131
132
|
{
|
|
132
|
-
tagLabelStyle ??= new GUIStyle(EditorStyles.miniBoldLabel)
|
|
133
|
-
{
|
|
134
|
-
alignment = TextAnchor.MiddleCenter
|
|
135
|
-
};
|
|
136
|
-
|
|
137
133
|
rect.xMin += margin;
|
|
138
134
|
rect.xMax -= margin;
|
|
139
135
|
rect.yMin += margin;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/Runtime/AmaGDK.Ads.cs
CHANGED
|
@@ -85,7 +85,7 @@ namespace Amanotes.Core
|
|
|
85
85
|
public AdStat interstitial = new AdStat();
|
|
86
86
|
public AdStat reward = new AdStat();
|
|
87
87
|
|
|
88
|
-
internal int
|
|
88
|
+
internal int TimeSinceLastShow(AdType adType)
|
|
89
89
|
{
|
|
90
90
|
return (int)(Time.realtimeSinceStartup - (adType == AdType.Interstitial ? interstitial.lastSuccessTime : reward.lastSuccessTime));
|
|
91
91
|
}
|
|
@@ -138,11 +138,11 @@ namespace Amanotes.Core
|
|
|
138
138
|
_adapter?.rewardVideo.StartLoadAd();
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
public static bool
|
|
142
|
-
public static bool
|
|
143
|
-
public static bool
|
|
144
|
-
public static bool
|
|
145
|
-
|
|
141
|
+
public static bool HasInterstitial => _adapter.interstitial.hasAd;
|
|
142
|
+
public static bool HasRewardedVideo => _adapter.rewardVideo.hasAd;
|
|
143
|
+
public static bool IsBannerShowing => _isBannerShowing;
|
|
144
|
+
public static bool IsAdShowing => context != null;
|
|
145
|
+
|
|
146
146
|
private static bool ClearPrevContext()
|
|
147
147
|
{
|
|
148
148
|
if (context == null) return true;
|
|
@@ -176,6 +176,15 @@ namespace Amanotes.Core
|
|
|
176
176
|
return context;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
public static bool IsInterstitialShowing
|
|
180
|
+
{
|
|
181
|
+
get
|
|
182
|
+
{
|
|
183
|
+
if (context == null) return false;
|
|
184
|
+
return context.adType == AdType.Interstitial;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
179
188
|
public static IAdCallback ShowRewardedVideo(string placementName = null, Dictionary<string, object> userData = null)
|
|
180
189
|
{
|
|
181
190
|
if (!ClearPrevContext()) return null;
|
|
@@ -184,19 +193,36 @@ namespace Amanotes.Core
|
|
|
184
193
|
_adapter.rewardVideo.StartShowAd();
|
|
185
194
|
return context;
|
|
186
195
|
}
|
|
196
|
+
|
|
197
|
+
public static bool IsRewardedVideoShowing
|
|
198
|
+
{
|
|
199
|
+
get
|
|
200
|
+
{
|
|
201
|
+
if (context == null) return false;
|
|
202
|
+
return context.adType == AdType.VideoReward;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
187
205
|
|
|
188
|
-
private static bool
|
|
189
|
-
public static void ShowBanner()
|
|
206
|
+
private static bool _isBannerShowing;
|
|
207
|
+
public static void ShowBanner(BannerPosition? bannerPosition = null)
|
|
190
208
|
{
|
|
191
|
-
if (
|
|
192
|
-
|
|
193
|
-
|
|
209
|
+
if (_isBannerShowing) return;
|
|
210
|
+
_isBannerShowing = true;
|
|
211
|
+
|
|
212
|
+
if (bannerPosition.HasValue)
|
|
213
|
+
{
|
|
214
|
+
_adapter.ShowBanner(bannerPosition.Value);
|
|
215
|
+
}
|
|
216
|
+
else
|
|
217
|
+
{
|
|
218
|
+
_adapter.ShowBanner(_adConfig.bannerPosition);
|
|
219
|
+
}
|
|
194
220
|
}
|
|
195
221
|
|
|
196
222
|
public static void HideBanner()
|
|
197
223
|
{
|
|
198
|
-
if (!
|
|
199
|
-
|
|
224
|
+
if (!_isBannerShowing) return;
|
|
225
|
+
_isBannerShowing = false;
|
|
200
226
|
_adapter.HideBanner();
|
|
201
227
|
}
|
|
202
228
|
|
|
@@ -210,6 +236,12 @@ namespace Amanotes.Core
|
|
|
210
236
|
else
|
|
211
237
|
_adapter.rewardVideo.StopShowAd();
|
|
212
238
|
}
|
|
239
|
+
|
|
240
|
+
public static int TimeSinceLastInterstitial => localData.TimeSinceLastShow(AdType.Interstitial);
|
|
241
|
+
|
|
242
|
+
public static int TimeSinceLastVideoReward => localData.TimeSinceLastShow(AdType.VideoReward);
|
|
243
|
+
|
|
244
|
+
public static int TimeSinceLastAd => Math.Min(TimeSinceLastInterstitial, TimeSinceLastVideoReward) ;
|
|
213
245
|
}
|
|
214
246
|
}
|
|
215
247
|
}
|
|
@@ -287,7 +319,7 @@ namespace Amanotes.Core.Internal
|
|
|
287
319
|
// Stats
|
|
288
320
|
public float showCallAt;
|
|
289
321
|
public float showFinishAt;
|
|
290
|
-
|
|
322
|
+
|
|
291
323
|
public ShowAdContext(AdType adType, string placementName, Dictionary<string, object> userData)
|
|
292
324
|
{
|
|
293
325
|
this.adType = adType;
|
|
@@ -40,14 +40,6 @@ namespace Amanotes.Core.Internal
|
|
|
40
40
|
public const string AMAGDK_PREFAB = BASE_PATH + "Runtime/AmaGDK.prefab";
|
|
41
41
|
public const string AMAGDK_CONFIG_PACKAGE = PACKAGE_PATH + "AmaGDKConfig.unitypackage";
|
|
42
42
|
|
|
43
|
-
public static readonly string[] AMAGDK_ADAPTERS =
|
|
44
|
-
{
|
|
45
|
-
"FirebaseAnalyticsAdapter_v9.1.0",
|
|
46
|
-
"AppsFlyerAdapter_v6.5.4",
|
|
47
|
-
"IronsourceAdapter_v7.2.6",
|
|
48
|
-
"FirebaseRemoteConfigAdapter_v9.1.0"
|
|
49
|
-
};
|
|
50
|
-
|
|
51
43
|
#if UNITY_EDITOR
|
|
52
44
|
|
|
53
45
|
[MenuItem("GameObject/AmaGDK/Add AmaGDK Prefab", false, 10)]
|
|
@@ -34,7 +34,7 @@ namespace Amanotes.Core
|
|
|
34
34
|
get
|
|
35
35
|
{
|
|
36
36
|
if (_cacheExisted == null)
|
|
37
|
-
_cacheExisted =
|
|
37
|
+
_cacheExisted = GDKFileUtils.Exist(fileName);
|
|
38
38
|
return _cacheExisted.GetValueOrDefault();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -199,8 +199,8 @@ namespace Amanotes.Core
|
|
|
199
199
|
}
|
|
200
200
|
#endif
|
|
201
201
|
|
|
202
|
-
string filePath =
|
|
203
|
-
|
|
202
|
+
string filePath = GDKFileUtils.GetPath(fileName);
|
|
203
|
+
GDKFileUtils.Save(filePath, sb.ToString());
|
|
204
204
|
Log($"[RemoteConfig] Saved remote config to {filePath}");
|
|
205
205
|
NextState();
|
|
206
206
|
}
|
|
@@ -218,7 +218,7 @@ namespace Amanotes.Core
|
|
|
218
218
|
try
|
|
219
219
|
{
|
|
220
220
|
dictConfig.Clear();
|
|
221
|
-
using (StreamReader sr = new StreamReader(
|
|
221
|
+
using (StreamReader sr = new StreamReader(GDKFileUtils.GetPath(fileName)))
|
|
222
222
|
{
|
|
223
223
|
string line;
|
|
224
224
|
int lineIdx = 0;
|
|
@@ -15,12 +15,12 @@ namespace Amanotes.Core
|
|
|
15
15
|
|
|
16
16
|
public void Save()
|
|
17
17
|
{
|
|
18
|
-
|
|
18
|
+
GDKFileUtils.Save(FILE_NAME, JsonUtility.ToJson(this));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
public UserProfile Load()
|
|
22
22
|
{
|
|
23
|
-
string json =
|
|
23
|
+
string json = GDKFileUtils.Load(FILE_NAME);
|
|
24
24
|
if (string.IsNullOrEmpty(json)) return this;
|
|
25
25
|
JsonUtility.FromJsonOverwrite(json, this);
|
|
26
26
|
return this;
|
package/Runtime/AmaGDK.Utils.cs
CHANGED
|
@@ -3,12 +3,13 @@ using System.Collections;
|
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.IO;
|
|
5
5
|
using System.Text;
|
|
6
|
+
using System.Text.RegularExpressions;
|
|
6
7
|
using UnityEngine;
|
|
7
8
|
using static Amanotes.Core.Internal.Logging;
|
|
8
9
|
|
|
9
10
|
namespace Amanotes.Core.Internal
|
|
10
11
|
{
|
|
11
|
-
public class
|
|
12
|
+
public class GDKUtils
|
|
12
13
|
{
|
|
13
14
|
public static void DelayCall(float seconds, Action action)
|
|
14
15
|
{
|
|
@@ -22,7 +23,7 @@ namespace Amanotes.Core.Internal
|
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
internal class
|
|
26
|
+
internal class GDKFileUtils
|
|
26
27
|
{
|
|
27
28
|
|
|
28
29
|
private static string _basePath;
|
|
@@ -39,6 +40,7 @@ namespace Amanotes.Core.Internal
|
|
|
39
40
|
return _basePath;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
43
|
+
|
|
42
44
|
internal static string GetPath(string fileName)
|
|
43
45
|
{
|
|
44
46
|
return Path.Combine(basePath, fileName);
|
|
@@ -161,6 +163,26 @@ namespace Amanotes.Core.Internal
|
|
|
161
163
|
LogWarningOnce(path + "\n" + ex);
|
|
162
164
|
}
|
|
163
165
|
}
|
|
166
|
+
|
|
167
|
+
internal static void ClearCacheData()
|
|
168
|
+
{
|
|
169
|
+
StringBuilder logBuilder = new StringBuilder();
|
|
170
|
+
logBuilder.AppendLine("[AmaGDK] All cached data & stats cleared");
|
|
171
|
+
|
|
172
|
+
if (!Directory.Exists(_basePath))
|
|
173
|
+
{
|
|
174
|
+
logBuilder.AppendLine("Cache path not exists: " + _basePath);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
string[] filePaths = Directory.GetFiles(_basePath);
|
|
179
|
+
foreach (string path in filePaths)
|
|
180
|
+
{
|
|
181
|
+
Delete(path);
|
|
182
|
+
logBuilder.AppendLine($"[deleted] - {path}");
|
|
183
|
+
}
|
|
184
|
+
Debug.Log(logBuilder);
|
|
185
|
+
}
|
|
164
186
|
}
|
|
165
187
|
|
|
166
188
|
public class ActionQueue
|
|
@@ -238,7 +260,7 @@ namespace Amanotes.Core.Internal
|
|
|
238
260
|
instance = result;
|
|
239
261
|
}
|
|
240
262
|
string fileName = instance.GetType().Name;
|
|
241
|
-
string json =
|
|
263
|
+
string json = GDKFileUtils.Load(fileName);
|
|
242
264
|
JsonUtility.FromJsonOverwrite(json, instance);
|
|
243
265
|
return instance;
|
|
244
266
|
}
|
|
@@ -247,7 +269,7 @@ namespace Amanotes.Core.Internal
|
|
|
247
269
|
{
|
|
248
270
|
string fileName = instance.GetType().Name;
|
|
249
271
|
string json = JsonUtility.ToJson(instance);
|
|
250
|
-
|
|
272
|
+
GDKFileUtils.Save(fileName, json);
|
|
251
273
|
}
|
|
252
274
|
}
|
|
253
275
|
|
|
@@ -342,8 +364,7 @@ namespace Amanotes.Core.Internal
|
|
|
342
364
|
return;
|
|
343
365
|
}
|
|
344
366
|
}
|
|
345
|
-
|
|
346
|
-
jsonSb.Append($"\"{value}\"");
|
|
367
|
+
jsonSb.Append($"\"{EscapeJsonString(s)}\"");
|
|
347
368
|
return;
|
|
348
369
|
}
|
|
349
370
|
|
|
@@ -374,6 +395,13 @@ namespace Amanotes.Core.Internal
|
|
|
374
395
|
jsonSb.Append($"{JsonUtility.ToJson(value, format)}");
|
|
375
396
|
}
|
|
376
397
|
|
|
398
|
+
private static string EscapeJsonString(string input)
|
|
399
|
+
{
|
|
400
|
+
//Match any occurrence of a backslash(\), single quotation('), or double quotation (")
|
|
401
|
+
string pattern = "[\\\'\"]";
|
|
402
|
+
return Regex.Replace(input, pattern, match => $"\\{match.Value}");
|
|
403
|
+
}
|
|
404
|
+
|
|
377
405
|
//public static T[] FromJsonToArray<T>(string json)
|
|
378
406
|
//{
|
|
379
407
|
// if (!json.StartsWith("{\"items\":"))
|
package/Runtime/AmaGDK.cs
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Collections;
|
|
3
|
+
using System.Diagnostics;
|
|
4
|
+
using System.IO;
|
|
3
5
|
using System.Text;
|
|
6
|
+
using System.Text.RegularExpressions;
|
|
4
7
|
using Amanotes.Core.Internal;
|
|
5
8
|
using UnityEngine;
|
|
6
9
|
using static Amanotes.Core.Internal.Logging;
|
|
7
10
|
using static Amanotes.Core.Internal.Messsage;
|
|
11
|
+
using Debug = System.Diagnostics.Debug;
|
|
8
12
|
|
|
9
13
|
namespace Amanotes.Core
|
|
10
14
|
{
|
|
11
15
|
public partial class AmaGDK : MonoBehaviour
|
|
12
16
|
{
|
|
13
|
-
public const string VERSION = "0.2.
|
|
17
|
+
public const string VERSION = "0.2.13";
|
|
14
18
|
|
|
15
19
|
internal static AmaGDK _instance;
|
|
16
20
|
internal static Status _status = Status.None;
|
|
@@ -109,7 +113,7 @@ namespace Amanotes.Core
|
|
|
109
113
|
_status = Status.Ready;
|
|
110
114
|
_onReadyCallback?.Invoke();
|
|
111
115
|
_onReadyCallback = null;
|
|
112
|
-
|
|
116
|
+
Log($"AmaGDK v{VERSION} | {READY} in {Time.realtimeSinceStartup - startTime}s\n\n{adapterInfo.ToString()}");
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
void RegisterUnityCallback(AdapterContext adapter)
|
|
@@ -197,6 +201,7 @@ namespace Amanotes.Core
|
|
|
197
201
|
public const string FIREBASE_ANALYTICS = "FirebaseAnalytics";
|
|
198
202
|
public const string FIREBASE_REMOTE_CONFIG = "FirebaseRemoteConfig";
|
|
199
203
|
public const string APPSFLYER = "AppsFlyer";
|
|
204
|
+
public const string ADJUST = "Adjust";
|
|
200
205
|
public const string IRONSOURCE = "IronSource";
|
|
201
206
|
public const string REVENUECAT = "RevenueCat";
|
|
202
207
|
}
|
|
@@ -230,4 +235,48 @@ namespace Amanotes.Core
|
|
|
230
235
|
applicationQuit?.Invoke();
|
|
231
236
|
}
|
|
232
237
|
}
|
|
238
|
+
|
|
239
|
+
public partial class AmaGDK // Switch dev mode
|
|
240
|
+
{
|
|
241
|
+
[ContextMenu("Change Dev Mode")]
|
|
242
|
+
public void ChangeDevMode()
|
|
243
|
+
{
|
|
244
|
+
string variableName = "GDK_HOME";
|
|
245
|
+
string output = RunShellCommand($"source ~/.zshrc && echo ${variableName}");
|
|
246
|
+
output = output.Trim();
|
|
247
|
+
|
|
248
|
+
if (string.IsNullOrEmpty(output))
|
|
249
|
+
{
|
|
250
|
+
LogWarning($"{variableName} environment variable is not set.");
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
UpdateManifest(output);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private string RunShellCommand(string command)
|
|
258
|
+
{
|
|
259
|
+
Process process = new Process();
|
|
260
|
+
process.StartInfo.FileName = "/bin/zsh";
|
|
261
|
+
process.StartInfo.Arguments = $"-c \"{command}\"";
|
|
262
|
+
process.StartInfo.RedirectStandardOutput = true;
|
|
263
|
+
process.StartInfo.UseShellExecute = false;
|
|
264
|
+
process.StartInfo.CreateNoWindow = true;
|
|
265
|
+
process.Start();
|
|
266
|
+
|
|
267
|
+
string output = process.StandardOutput.ReadToEnd();
|
|
268
|
+
process.WaitForExit();
|
|
269
|
+
|
|
270
|
+
return output;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
private void UpdateManifest(string strDesired)
|
|
274
|
+
{
|
|
275
|
+
const string manifestPath = "Packages/manifest.json";
|
|
276
|
+
string manifestJson = File.ReadAllText(manifestPath);
|
|
277
|
+
|
|
278
|
+
manifestJson = Regex.Replace(manifestJson, "\"com\\.amanotes\\.gdk\"\\s*:\\s*\"\\d+\\.\\d+\\.\\d+\"", $"\"com.amanotes.gdk\": \"{strDesired}\"");
|
|
279
|
+
File.WriteAllText(manifestPath, manifestJson);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
233
282
|
}
|
package/Runtime/AssemblyInfo.cs
CHANGED