com.amanotes.gdk 0.2.20 → 0.2.21
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 +93 -87
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AmaGDKProject.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.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/Packages/RevenueCatAdapter_v6.0.0.unitypackage +0 -0
- package/Packages/{RevenueCatAdapter_v5.3.0.unitypackage.meta → RevenueCatAdapter_v6.0.0.unitypackage.meta} +1 -1
- package/README.md +51 -6
- package/Runtime/AmaGDK.Analytics.cs +34 -21
- package/Runtime/AmaGDK.Config.cs +10 -1
- package/Runtime/AmaGDK.IAP.cs +2 -1
- package/Runtime/AmaGDK.Internal.cs +9 -8
- package/Runtime/AmaGDK.UserProfile.cs +21 -12
- package/Runtime/AmaGDK.cs +3 -2
- package/package.json +1 -1
- package/Packages/RevenueCatAdapter_v5.3.0.unitypackage +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,152 +1,158 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.21 - 2023-10-11]
|
|
4
|
+
- RevenueCat adapter v6.0.0
|
|
5
|
+
- Handle early Firebase call
|
|
6
|
+
- Fix null exception in non-subscription game
|
|
7
|
+
- Add log level
|
|
8
|
+
|
|
3
9
|
## [0.2.20 - 2023-10-05]
|
|
4
|
-
|
|
10
|
+
- Update RevenueCat 5.3.0
|
|
5
11
|
|
|
6
12
|
## [0.2.19 - 2023-09-12]
|
|
7
|
-
|
|
13
|
+
- Add `ama_device_id` to all events
|
|
8
14
|
|
|
9
15
|
## [0.2.18 - 2023-09-11]
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
- Add dev mode switch
|
|
17
|
+
- Auto get SDK version
|
|
18
|
+
- Add in-app purchase module, RevenueCat
|
|
19
|
+
- Support Unity 2019.4
|
|
20
|
+
- Remove AmaPassport
|
|
15
21
|
|
|
16
22
|
## [0.2.14 - 2023-08-08]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
- Support multiple embed remote config and load config by id
|
|
24
|
+
- Clear cached remote config on new app update
|
|
25
|
+
- Override remote config value in editor mode
|
|
26
|
+
- New feature: Analytics Quality
|
|
21
27
|
|
|
22
28
|
## [0.2.13 - 2023-07-20]
|
|
23
|
-
|
|
29
|
+
- Fix error Remote Config JSON caused by special chars (", ', \)
|
|
24
30
|
|
|
25
31
|
## [0.2.12 - 2023-07-07]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
- Restructure GDK - symlink GDK source to unity projects
|
|
33
|
+
- Unity 2019 compatible - no null coalescing
|
|
34
|
+
- Remove redundant AmaPassport config field
|
|
35
|
+
- Auto request AmaId
|
|
30
36
|
|
|
31
37
|
## [0.2.11 - 2023-06-29]
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
- SetLogCondition with EventParam
|
|
39
|
+
- Rename Migrated -> HasMigrated
|
|
40
|
+
- Fix StopShowAd
|
|
35
41
|
|
|
36
42
|
## [0.2.10 - 2023-06-23]
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
- Extra package: Project Panel
|
|
44
|
+
- Remote config: Allow user to enable / disable automatic default valuye updating (in play mode)
|
|
45
|
+
- Fix ad routine
|
|
46
|
+
- Expose analytics migration flag
|
|
41
47
|
|
|
42
48
|
## [0.2.9 - 2023-06-15]
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
- Show total init time
|
|
50
|
+
- Show adapter version + status at init time
|
|
51
|
+
- Remove AmaGDK version in debug log
|
|
52
|
+
- Remove "Params" in analytics debug log
|
|
53
|
+
- Check "event_name" early
|
|
54
|
+
- Fix null exception in AmaGDKInstaller
|
|
55
|
+
- Add csc.rsp to enable AMAGDK_DEV
|
|
56
|
+
- Update Ads module
|
|
51
57
|
|
|
52
58
|
## [0.2.8 - 2023-06-12]
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
- Mute Appsflyer's init log on Editor
|
|
60
|
+
- Clear analytics log in adapters
|
|
61
|
+
- Check null event params before calling AddParam()
|
|
62
|
+
- Export AmaPassport info
|
|
57
63
|
|
|
58
64
|
## [0.2.7 - 2023-06-09]
|
|
59
|
-
|
|
65
|
+
- Fix log single adapter
|
|
60
66
|
|
|
61
67
|
## [0.2.6 - 2023-06-08]
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
- Update AmaPassport
|
|
69
|
+
- Fix JSON parse in RemoteConfig
|
|
70
|
+
- Ads adds interstitial callbacks
|
|
71
|
+
- Clean & export AmaGDK Installer
|
|
66
72
|
|
|
67
73
|
## [0.2.5 - 2023-06-07]
|
|
68
|
-
|
|
74
|
+
- Remove ATT dependency package
|
|
69
75
|
|
|
70
76
|
## [0.2.4 - 2023-06-07]
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
- Hotfix Ads module
|
|
78
|
+
- Update Analytics unit tests
|
|
73
79
|
|
|
74
80
|
## [0.2.3 - 2023-06-06]
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
- Refactor Ads module, support ironSource
|
|
82
|
+
- Refactor AmaPassport
|
|
83
|
+
- Refactor AmaGDK structure
|
|
84
|
+
- Add callback when RemoteConfig module completes fetching
|
|
79
85
|
|
|
80
86
|
## [0.1.20 - 2023-04-20]
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
- Refactor Adapter architure to support reading adapter config from Core
|
|
88
|
+
- Add session stat for Analytics module
|
|
89
|
+
- Unit test for Json parser and Analytics module
|
|
84
90
|
|
|
85
91
|
## [0.1.19 - 2023-04-11]
|
|
86
|
-
|
|
92
|
+
- Move AmaGDKTest out of AmaGDKCore
|
|
87
93
|
|
|
88
94
|
## [0.1.18 - 2023-03-27]
|
|
89
|
-
|
|
95
|
+
- Fix AmaGDK's autoInit saving issue
|
|
90
96
|
|
|
91
97
|
## [0.1.17 - 2023-03-13]
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
- Release AmaGDK v0.1.17
|
|
99
|
+
- Rename Analytics APIs
|
|
94
100
|
|
|
95
101
|
## [0.1.16 - 2023-03-10]
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
- Release AmaGDK v0.1.16
|
|
103
|
+
- SemVer supports 4 parts
|
|
104
|
+
- Analytics supports EventConfig
|
|
99
105
|
|
|
100
106
|
## [0.1.15 - 2023-03-06]
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
- Release AmaGDK v0.1.15
|
|
108
|
+
- Fix null exception in VersionExtractor
|
|
109
|
+
- Warn unhandle platform in Appsflyer initialization
|
|
110
|
+
- Allow dev to SetPermittedEvents and SetForbiddenEvents to the adapter config
|
|
105
111
|
|
|
106
112
|
## [0.1.14 - 2023-03-02]
|
|
107
|
-
|
|
113
|
+
- Release AmaGDK v0.1.14
|
|
108
114
|
|
|
109
115
|
## [0.1.13 - 2023-03-01]
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
- Release AmaGDK v0.1.13
|
|
117
|
+
- Fix Semver parser
|
|
112
118
|
|
|
113
119
|
## [0.1.12 - 2023-03-01]
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
- Release AmaGDK v0.1.12
|
|
121
|
+
- Prioritize analytics instant config over the base config
|
|
122
|
+
- Public common config
|
|
117
123
|
|
|
118
124
|
## [0.1.11 - 2023-02-28]
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
- Release AmaGDK v0.1.11
|
|
126
|
+
- Auto start and log Appsflyer open session
|
|
127
|
+
- Add analytics adapter base config
|
|
128
|
+
- Analytics: count by session
|
|
129
|
+
- Export example scene
|
|
130
|
+
- Add AmaGDKManager
|
|
131
|
+
- Refactor Adapter to support for init order configuration
|
|
126
132
|
|
|
127
133
|
## [0.1.10 - 2023-02-17]
|
|
128
|
-
|
|
134
|
+
- Release AmaGDK v0.1.10
|
|
129
135
|
|
|
130
136
|
## [0.1.9 - 2023-02-15]
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
- Release AmaGDK v0.1.9
|
|
138
|
+
- Change Documentation URL
|
|
139
|
+
- Support API LogEvent(eventName, parameters)
|
|
134
140
|
|
|
135
141
|
## [0.1.8 - 2023-02-15]
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
- Release AmaGDK v0.1.8
|
|
143
|
+
- Add AdapterID
|
|
138
144
|
|
|
139
145
|
## [0.1.5 - 2023-02-13]
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
- Release AmaSDK v0.1.5
|
|
147
|
+
- Validate EventParams
|
|
142
148
|
|
|
143
149
|
## [0.1.4 - 2023-02-13]
|
|
144
|
-
|
|
150
|
+
- Release AmaSDK v0.1.4
|
|
145
151
|
|
|
146
152
|
## [0.1.3 - 2023-02-10]
|
|
147
|
-
|
|
153
|
+
- Release AmaSDK v0.1.3
|
|
148
154
|
|
|
149
155
|
## [0.1.2] - 2023-02-08
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
156
|
+
- Release AmaGDK 0.1.2
|
|
157
|
+
- FirebaseAnalytics adapter compatible with FirebaseAnalytics SDK v9
|
|
158
|
+
- AppsFlyer adapter compatible with AppsFlyer SDK v6
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/README.md
CHANGED
|
@@ -1,12 +1,57 @@
|
|
|
1
1
|
# Amanotes GDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## AmaGDK Dev Project Setup
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Clone Project From GitLab
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. Clone project from GitLab url: https://gitlab.amanotes.net/sdk/AmaSDK_v5
|
|
8
|
+
2. Open terminal windows and cd to your project
|
|
9
|
+
3. Run file create-links.sh (Link GDK folder children to GDKDev)
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
### How To Open Project
|
|
14
|
+
|
|
15
|
+
* Open project GDKDev
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
### Main folder
|
|
20
|
+
|
|
21
|
+
* AmaGDK: adapters logic, example, installer, configs
|
|
22
|
+
|
|
23
|
+
* AmaGDKCore: core logic, packages
|
|
24
|
+
|
|
25
|
+
* AmaGDKDev: tools for dev as build tool, release tool
|
|
26
|
+
|
|
27
|
+
* AmaGDKTest: scenes test, unit test
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
### Switch To Dev Mode
|
|
32
|
+
|
|
33
|
+
1. Add GDK_HOME variable to .zshrc file in Mac OS
|
|
34
|
+
|
|
35
|
+
* Step 1: Open terminal, input sudo nano `~/.zshrc`
|
|
36
|
+
|
|
37
|
+
* Step 2: Enter and input password, add new line export `GDK_HOME=/AmaGDKCoreFolderPath`
|
|
38
|
+
|
|
39
|
+
* Step 3: Press Ctr+X buttons -> Press Y button -> Press `Enter` button to save
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
2. Select AmaGDK prefab in scene → select `Change Dev Mode` in context menu
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+
### Code Convention
|
|
48
|
+
[Convention](https://amanotesjsc.atlassian.net/wiki/spaces/AP/pages/3409413152)
|
|
49
|
+
|
|
50
|
+
### Links Reference
|
|
51
|
+
[Reference](https://amanotesjsc.atlassian.net/wiki/spaces/AP/pages/3334930473)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Getting started with AmaGDK
|
|
10
55
|
|
|
11
56
|
### Add AmaGDK prefab to your bootstrap scene (the first scene in your game build settings)
|
|
12
57
|
There are two ways to do:
|
|
@@ -35,10 +80,10 @@ public class YourGameSceneController
|
|
|
35
80
|
}
|
|
36
81
|
```
|
|
37
82
|
|
|
38
|
-
|
|
83
|
+
### Versioning
|
|
39
84
|
|
|
40
85
|
We use [SemVer](http://semver.org/) for versioning.
|
|
41
86
|
|
|
42
|
-
|
|
87
|
+
### License
|
|
43
88
|
|
|
44
89
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
|
@@ -136,30 +136,12 @@ namespace Amanotes.Core
|
|
|
136
136
|
|
|
137
137
|
public static void SetUserId(string userId)
|
|
138
138
|
{
|
|
139
|
-
|
|
140
|
-
{
|
|
141
|
-
LogWarningOnce("ListAnalyticsAdapter is empty! Maybe you need to wait for Analytics to init");
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
foreach (AdapterContext s in listAdapters)
|
|
146
|
-
{
|
|
147
|
-
s.GetAdapterApi<IAnalyticAdapter>().SetUserId(userId);
|
|
148
|
-
}
|
|
139
|
+
actionQueue.Enqueue(() => InternalSetUserId(userId));
|
|
149
140
|
}
|
|
150
141
|
|
|
151
142
|
public static void SetUserProperty(string key, string value)
|
|
152
143
|
{
|
|
153
|
-
|
|
154
|
-
{
|
|
155
|
-
LogWarningOnce("ListAnalyticsAdapter is empty! Maybe you need to wait for Analytics to init");
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
foreach (AdapterContext s in listAdapters)
|
|
160
|
-
{
|
|
161
|
-
s.GetAdapterApi<IAnalyticAdapter>().SetUserProperty(key, value);
|
|
162
|
-
}
|
|
144
|
+
actionQueue.Enqueue(() => InternalSetUserProperty(key, value));
|
|
163
145
|
}
|
|
164
146
|
|
|
165
147
|
private static IntegrityFlag MergeData(List<string> funnelEvents, Dictionary<string, int> eventCountMap, bool sumEventCount)
|
|
@@ -285,6 +267,7 @@ namespace Amanotes.Core
|
|
|
285
267
|
internal static readonly Dictionary<string, EventConfig> sendAtCount = new Dictionary<string, EventConfig>();
|
|
286
268
|
internal static Predicate<EventParams> logEventHook = null;
|
|
287
269
|
internal static readonly Queue<EventParams> eventQueue = new Queue<EventParams>();
|
|
270
|
+
internal static readonly Queue<Action> actionQueue = new Queue<Action>();
|
|
288
271
|
internal static readonly List<AdapterContext> listAdapters = new List<AdapterContext>();
|
|
289
272
|
internal static readonly AnalyticsData localData = new AnalyticsData().LoadJsonFromFile();
|
|
290
273
|
internal static readonly SessionStat sessionStat = new SessionStat();
|
|
@@ -296,6 +279,9 @@ namespace Amanotes.Core
|
|
|
296
279
|
|
|
297
280
|
onFrameUpdate -= ProcessEventQueue;
|
|
298
281
|
onFrameUpdate += ProcessEventQueue;
|
|
282
|
+
|
|
283
|
+
onFrameUpdate -= ProcessActionQueue;
|
|
284
|
+
onFrameUpdate += ProcessActionQueue;
|
|
299
285
|
}
|
|
300
286
|
|
|
301
287
|
internal static void ProcessEventQueue()
|
|
@@ -389,7 +375,7 @@ namespace Amanotes.Core
|
|
|
389
375
|
sb.AppendLine($" - Malformed eventName (should not contains <space> or <dash>: <{eventName}>");
|
|
390
376
|
}
|
|
391
377
|
}
|
|
392
|
-
|
|
378
|
+
|
|
393
379
|
if (!char.IsLetter(eventName[0])) sb.AppendLine($" - EventName must start with a letter: <{eventName}> ");
|
|
394
380
|
if (eventName.Length > 40) sb.AppendLine($" - EventName is too long ({eventName.Length} > 40): <{eventName}> ");
|
|
395
381
|
if (sb.Length > 0 && dryRun) LogWarningOnce(sb.ToString(), $"NormalizeEventName<{eventName}>");
|
|
@@ -418,6 +404,33 @@ namespace Amanotes.Core
|
|
|
418
404
|
|
|
419
405
|
return true;
|
|
420
406
|
}
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
internal static void ProcessActionQueue()
|
|
410
|
+
{
|
|
411
|
+
if (actionQueue.Count <= 0) return;
|
|
412
|
+
while (actionQueue.Count > 0)
|
|
413
|
+
{
|
|
414
|
+
var action = actionQueue.Dequeue();
|
|
415
|
+
action.Invoke();
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
internal static void InternalSetUserId(string userId)
|
|
420
|
+
{
|
|
421
|
+
foreach (AdapterContext s in listAdapters)
|
|
422
|
+
{
|
|
423
|
+
s.GetAdapterApi<IAnalyticAdapter>().SetUserId(userId);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
internal static void InternalSetUserProperty(string key, string value)
|
|
428
|
+
{
|
|
429
|
+
foreach (AdapterContext s in listAdapters)
|
|
430
|
+
{
|
|
431
|
+
s.GetAdapterApi<IAnalyticAdapter>().SetUserProperty(key, value);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
421
434
|
}
|
|
422
435
|
|
|
423
436
|
//PERSISTENT DATA
|
package/Runtime/AmaGDK.Config.cs
CHANGED
|
@@ -83,10 +83,19 @@ namespace Amanotes.Core.Internal
|
|
|
83
83
|
#endif
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
[Flags]
|
|
87
|
+
public enum LogLevel
|
|
88
|
+
{
|
|
89
|
+
None = 0,
|
|
90
|
+
Error = 1,
|
|
91
|
+
Warning = 2,
|
|
92
|
+
Verbose = 4
|
|
93
|
+
}
|
|
94
|
+
|
|
86
95
|
[Serializable]
|
|
87
96
|
public partial class SDKConfig
|
|
88
97
|
{
|
|
89
|
-
public
|
|
98
|
+
public LogLevel logLevel = LogLevel.Warning | LogLevel.Error;
|
|
90
99
|
}
|
|
91
100
|
|
|
92
101
|
[Serializable]
|
package/Runtime/AmaGDK.IAP.cs
CHANGED
|
@@ -438,7 +438,7 @@ namespace Amanotes.Core.Internal
|
|
|
438
438
|
}
|
|
439
439
|
onSuccess?.Invoke(dicProducts);
|
|
440
440
|
return;
|
|
441
|
-
#
|
|
441
|
+
#else
|
|
442
442
|
|
|
443
443
|
getProdQueue.Clear();
|
|
444
444
|
var subs = new List<string>();
|
|
@@ -468,6 +468,7 @@ namespace Amanotes.Core.Internal
|
|
|
468
468
|
getProdQueue.Enqueue((cons, ProductType.Consumable));
|
|
469
469
|
getProdQueue.Enqueue((nons, ProductType.NonConsumable));
|
|
470
470
|
GetNextProductsInQueue();
|
|
471
|
+
#endif
|
|
471
472
|
}
|
|
472
473
|
|
|
473
474
|
void GetNextProductsInQueue()
|
|
@@ -68,6 +68,7 @@ namespace Amanotes.Core.Internal
|
|
|
68
68
|
|
|
69
69
|
public static void LogWarningOnce(string message, string key = null)
|
|
70
70
|
{
|
|
71
|
+
if ((Config.common.logLevel & LogLevel.Warning) == 0) return;
|
|
71
72
|
if (string.IsNullOrEmpty(key)) key = message;
|
|
72
73
|
if (logWarningDict.Contains(key)) return;
|
|
73
74
|
logWarningDict.Add(key);
|
|
@@ -75,15 +76,15 @@ namespace Amanotes.Core.Internal
|
|
|
75
76
|
}
|
|
76
77
|
public static void LogWarning(string message)
|
|
77
78
|
{
|
|
78
|
-
Debug.LogWarning($"AmaGDK {message}");
|
|
79
|
+
if ((Config.common.logLevel & LogLevel.Warning) != 0) Debug.LogWarning($"AmaGDK {message}");
|
|
79
80
|
}
|
|
80
81
|
public static void LogError(string message)
|
|
81
82
|
{
|
|
82
|
-
Debug.LogError($"AmaGDK {message}");
|
|
83
|
+
if ((Config.common.logLevel & LogLevel.Error) != 0) Debug.LogError($"AmaGDK {message}");
|
|
83
84
|
}
|
|
84
85
|
public static void Log(string message)
|
|
85
86
|
{
|
|
86
|
-
if (
|
|
87
|
+
if ((Config.common.logLevel & LogLevel.Verbose) != 0) Debug.Log($"AmaGDK {message}");
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -91,10 +92,10 @@ namespace Amanotes.Core.Internal
|
|
|
91
92
|
{
|
|
92
93
|
public static void DestroyAndReset()
|
|
93
94
|
{
|
|
94
|
-
if (
|
|
95
|
+
if (_instance != null)
|
|
95
96
|
{
|
|
96
|
-
UnityObject.Destroy(
|
|
97
|
-
|
|
97
|
+
UnityObject.Destroy(_instance);
|
|
98
|
+
_instance = null;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
AmaGDK[] result = Resources.FindObjectsOfTypeAll<AmaGDK>();
|
|
@@ -113,8 +114,8 @@ namespace Amanotes.Core.Internal
|
|
|
113
114
|
UnityObject.Destroy(result[i].gameObject);
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
_status = Status.None;
|
|
118
|
+
_allowInit = false;
|
|
118
119
|
|
|
119
120
|
// TODO: Destroy adapters? - Don't do this. An adapter registers just 1 time. Clear adapters cause Analytics test fail.
|
|
120
121
|
//Adapter.listAdapters.Clear();
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using System.Collections;
|
|
2
3
|
using Amanotes.Core.Internal;
|
|
3
4
|
using UnityEngine;
|
|
4
5
|
namespace Amanotes.Core
|
|
5
6
|
{
|
|
6
7
|
public partial class AmaGDK //User profile
|
|
7
8
|
{
|
|
8
|
-
public static readonly UserProfile User = new UserProfile()
|
|
9
|
+
public static readonly UserProfile User = new UserProfile();
|
|
9
10
|
|
|
10
11
|
[Serializable]
|
|
11
12
|
public partial class UserProfile : IJsonFile
|
|
@@ -18,14 +19,6 @@ namespace Amanotes.Core
|
|
|
18
19
|
GDKFileUtils.Save(FILE_NAME, JsonUtility.ToJson(this));
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
internal UserProfile Load()
|
|
22
|
-
{
|
|
23
|
-
string json = GDKFileUtils.Load(FILE_NAME);
|
|
24
|
-
if (string.IsNullOrEmpty(json)) return this;
|
|
25
|
-
JsonUtility.FromJsonOverwrite(json, this);
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
22
|
internal void SaveIfDirty()
|
|
30
23
|
{
|
|
31
24
|
if (!_dirty) return;
|
|
@@ -57,10 +50,26 @@ namespace Amanotes.Core
|
|
|
57
50
|
private string appsFlyerId;
|
|
58
51
|
|
|
59
52
|
private const string AMA_DEVICE_ID_KEY = "ama_device_id";
|
|
53
|
+
private const float TIME_OUT = 5f;
|
|
54
|
+
private const float WAIT_TIME = 0.5f;
|
|
55
|
+
private WaitForSeconds waitForDuration = new WaitForSeconds(WAIT_TIME);
|
|
60
56
|
|
|
61
|
-
internal
|
|
57
|
+
internal IEnumerator Init()
|
|
62
58
|
{
|
|
63
|
-
|
|
59
|
+
User.LoadJsonFromFile();
|
|
60
|
+
if (IsAmaDeviceIdExist()) yield break;
|
|
61
|
+
|
|
62
|
+
GetAdvertisingId();
|
|
63
|
+
|
|
64
|
+
float time = 0;
|
|
65
|
+
while (!User.IsAmaDeviceIdExist())
|
|
66
|
+
{
|
|
67
|
+
yield return waitForDuration;
|
|
68
|
+
time += WAIT_TIME;
|
|
69
|
+
if (time <= TIME_OUT) continue;
|
|
70
|
+
Logging.LogWarning($"User init time out: {TIME_OUT}");
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
private bool IsAmaDeviceIdExist()
|
|
@@ -118,7 +127,7 @@ namespace Amanotes.Core
|
|
|
118
127
|
break;
|
|
119
128
|
|
|
120
129
|
default:
|
|
121
|
-
|
|
130
|
+
amaDeviceId = SystemInfo.deviceUniqueIdentifier;
|
|
122
131
|
break;
|
|
123
132
|
}
|
|
124
133
|
Logging.Log($"Generate AmaDeviceId completed: {amaDeviceId}");
|
package/Runtime/AmaGDK.cs
CHANGED
|
@@ -14,7 +14,7 @@ namespace Amanotes.Core
|
|
|
14
14
|
{
|
|
15
15
|
public partial class AmaGDK : MonoBehaviour
|
|
16
16
|
{
|
|
17
|
-
public const string VERSION = "0.2.
|
|
17
|
+
public const string VERSION = "0.2.21";
|
|
18
18
|
|
|
19
19
|
internal static AmaGDK _instance;
|
|
20
20
|
internal static Status _status = Status.None;
|
|
@@ -61,6 +61,8 @@ namespace Amanotes.Core
|
|
|
61
61
|
throw new Exception("[AmaGDK] " + CONFIG_NOT_FOUND);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
yield return User.Init();
|
|
65
|
+
|
|
64
66
|
float time = 0;
|
|
65
67
|
float timeout = 10;
|
|
66
68
|
|
|
@@ -106,7 +108,6 @@ namespace Amanotes.Core
|
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
// Init modules (Adapter managers)
|
|
109
|
-
User.InitUserProfile();
|
|
110
111
|
Analytics.Init();
|
|
111
112
|
Ads.Init();
|
|
112
113
|
IAP.Init();
|
package/package.json
CHANGED
|
Binary file
|