com.amanotes.gdk 0.2.46 → 0.2.47
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 +4 -0
- package/Editor/AmaGDKEditor.cs +281 -104
- package/Editor/MatchSDKVersion.cs +3 -6
- package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +5 -1
- 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.unitypackage +0 -0
- package/Packages/{FirebaseRemoteConfigAdapter_v9.1.0.unitypackage.meta → AppsFlyerAdapter.unitypackage.meta} +1 -1
- package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
- package/Packages/{AppsFlyerAdapter_v6.5.4.unitypackage.meta → FirebaseAnalyticsAdapter.unitypackage.meta} +1 -1
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/{IronSourceAdapter_v7.5.2.unitypackage.meta → FirebaseRemoteConfigAdapter.unitypackage.meta} +1 -1
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/{FirebaseAnalyticsAdapter_v9.1.0.unitypackage.meta → IronSourceAdapter.unitypackage.meta} +1 -1
- package/Packages/RevenueCatAdapter.unitypackage +0 -0
- package/Packages/RevenueCatAdapter.unitypackage.meta +7 -0
- package/Runtime/AmaGDK.Adapters.cs +55 -77
- package/Runtime/AmaGDK.Ads.cs +160 -174
- package/Runtime/AmaGDK.Analytics.cs +245 -125
- package/Runtime/AmaGDK.Config.cs +2 -1
- package/Runtime/AmaGDK.IAP.cs +47 -48
- package/Runtime/AmaGDK.RemoteConfig.cs +38 -35
- package/Runtime/AmaGDK.UserProfile.cs +27 -19
- package/Runtime/AmaGDK.cs +158 -111
- package/Runtime/Core.meta +8 -0
- package/Runtime/Internal/AmaGDK.Internal.AmaGUI.cs +8 -3
- package/Runtime/Internal/AmaGDK.Internal.SemVer.cs +21 -17
- package/Runtime/Internal/AmaGDK.Internal.cs +17 -6
- package/Runtime/Internal/AmaGDK.Utils.cs +78 -11
- package/package.json +1 -1
- 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.5.2.unitypackage +0 -0
- package/Packages/IronsourceAdapter_v7.2.6.unitypackage +0 -0
- package/Packages/IronsourceAdapter_v7.2.6.unitypackage.meta +0 -7
- package/Packages/RevenueCatAdapter_v6.0.0.unitypackage +0 -0
- package/Packages/RevenueCatAdapter_v6.0.0.unitypackage.meta +0 -7
package/Runtime/AmaGDK.IAP.cs
CHANGED
|
@@ -97,9 +97,9 @@ namespace Amanotes.Core
|
|
|
97
97
|
|
|
98
98
|
public partial class IAP //Internal
|
|
99
99
|
{
|
|
100
|
-
private static
|
|
101
|
-
internal static
|
|
102
|
-
internal static
|
|
100
|
+
private static IAPAdapter _adapter;
|
|
101
|
+
internal static IAPData localData;
|
|
102
|
+
internal static IAPAdapter Adapter
|
|
103
103
|
{
|
|
104
104
|
get
|
|
105
105
|
{
|
|
@@ -109,31 +109,22 @@ namespace Amanotes.Core
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
private static IAPAdapterConfig _adapterConfig;
|
|
113
|
-
internal static IAPAdapterConfig AdapterConfig
|
|
114
|
-
{
|
|
115
|
-
get
|
|
116
|
-
{
|
|
117
|
-
if (_adapterConfig != null) return _adapterConfig;
|
|
118
|
-
LogWarning("[IAP] Adapter config is not available.");
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
112
|
|
|
123
113
|
internal static Dictionary<string, ProductInfo> dicProducts = new Dictionary<string, ProductInfo>();
|
|
124
|
-
|
|
125
|
-
internal static
|
|
114
|
+
|
|
115
|
+
internal static bool InitModule()
|
|
126
116
|
{
|
|
127
|
-
_adapter =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
117
|
+
_adapter = Adapter2.GetAdapter<IAPAdapter>();
|
|
118
|
+
if (_adapter == null) return false;
|
|
119
|
+
localData = new IAPData().LoadJsonFromFile();
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
132
122
|
|
|
133
|
-
|
|
123
|
+
internal static void StartModule()
|
|
124
|
+
{
|
|
125
|
+
if (_adapter == null) return;
|
|
134
126
|
localData.Sync();
|
|
135
|
-
if (
|
|
136
|
-
GetProducts();
|
|
127
|
+
if (Config.iap.autoGetProducts) GetProducts();
|
|
137
128
|
}
|
|
138
129
|
|
|
139
130
|
internal static void ExecuteInNextFrame(Action method)
|
|
@@ -311,7 +302,7 @@ namespace Amanotes.Core
|
|
|
311
302
|
internal static void ClearOldProductConfig()
|
|
312
303
|
{
|
|
313
304
|
if (isCleanUpConfig) return;
|
|
314
|
-
|
|
305
|
+
AmaGDK.Config.iap.products.Clear();
|
|
315
306
|
isCleanUpConfig = true;
|
|
316
307
|
}
|
|
317
308
|
|
|
@@ -319,9 +310,9 @@ namespace Amanotes.Core
|
|
|
319
310
|
{
|
|
320
311
|
if (sc == null) return null;
|
|
321
312
|
ClearOldProductConfig();
|
|
322
|
-
var ls =
|
|
313
|
+
var ls = AmaGDK.Config.iap.products;
|
|
323
314
|
if (ls == null) return null;
|
|
324
|
-
foreach (
|
|
315
|
+
foreach (string pId in subs)
|
|
325
316
|
{
|
|
326
317
|
ls.Add(new ProductInfo { id = pId, type = ProductType.Subscription });
|
|
327
318
|
}
|
|
@@ -332,9 +323,9 @@ namespace Amanotes.Core
|
|
|
332
323
|
{
|
|
333
324
|
if (sc == null) return null;
|
|
334
325
|
ClearOldProductConfig();
|
|
335
|
-
var ls =
|
|
326
|
+
var ls = AmaGDK.Config.iap.products;
|
|
336
327
|
if (ls == null) return null;
|
|
337
|
-
foreach (
|
|
328
|
+
foreach (string pId in cons)
|
|
338
329
|
{
|
|
339
330
|
ls.Add(new ProductInfo { id = pId, type = ProductType.Consumable });
|
|
340
331
|
}
|
|
@@ -345,9 +336,9 @@ namespace Amanotes.Core
|
|
|
345
336
|
{
|
|
346
337
|
if (sc == null) return null;
|
|
347
338
|
ClearOldProductConfig();
|
|
348
|
-
var ls =
|
|
339
|
+
var ls = AmaGDK.Config.iap.products;
|
|
349
340
|
if (ls == null) return null;
|
|
350
|
-
foreach (
|
|
341
|
+
foreach (string pId in nons)
|
|
351
342
|
{
|
|
352
343
|
ls.Add(new ProductInfo { id = pId, type = ProductType.NonConsumable });
|
|
353
344
|
}
|
|
@@ -405,14 +396,20 @@ namespace Amanotes.Core
|
|
|
405
396
|
namespace Amanotes.Core.Internal
|
|
406
397
|
{
|
|
407
398
|
[Serializable]
|
|
408
|
-
public class
|
|
399
|
+
public class IAPConfig
|
|
409
400
|
{
|
|
401
|
+
// [Header("----- MODULE CONFIG -----")]
|
|
410
402
|
public bool autoInit;
|
|
411
403
|
[SerializeField] internal bool allPurchaseSuccessInEditor;
|
|
412
404
|
[SerializeField] internal List<ProductInfo> products;
|
|
413
405
|
[SerializeField] internal bool autoGetProducts;
|
|
414
406
|
}
|
|
415
407
|
|
|
408
|
+
public partial class ConfigAsset
|
|
409
|
+
{
|
|
410
|
+
[SerializeField] public IAPConfig iap;
|
|
411
|
+
}
|
|
412
|
+
|
|
416
413
|
public interface ISetupBuilder { }
|
|
417
414
|
|
|
418
415
|
public class SetupContext: ISetupBuilder
|
|
@@ -424,7 +421,7 @@ namespace Amanotes.Core.Internal
|
|
|
424
421
|
|
|
425
422
|
public void GetProducts()
|
|
426
423
|
{
|
|
427
|
-
var ls =
|
|
424
|
+
var ls = AmaGDK.Config.iap.products;
|
|
428
425
|
if (ls == null || ls.Count == 0)
|
|
429
426
|
{
|
|
430
427
|
LogWarning("There is no IAP product");
|
|
@@ -517,7 +514,7 @@ namespace Amanotes.Core.Internal
|
|
|
517
514
|
public void Purchase(ProductInfo productInfo)
|
|
518
515
|
{
|
|
519
516
|
#if UNITY_EDITOR
|
|
520
|
-
if (
|
|
517
|
+
if (AmaGDK.Config.iap.allPurchaseSuccessInEditor)
|
|
521
518
|
{
|
|
522
519
|
DoOnSuccess(new PurchaseSuccess
|
|
523
520
|
{
|
|
@@ -554,20 +551,22 @@ namespace Amanotes.Core.Internal
|
|
|
554
551
|
}
|
|
555
552
|
}
|
|
556
553
|
|
|
557
|
-
public
|
|
554
|
+
public abstract class IAPAdapter : Adapter2
|
|
558
555
|
{
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
void
|
|
562
|
-
void
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
string
|
|
566
|
-
string
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
DateTime?
|
|
570
|
-
|
|
571
|
-
DateTime?
|
|
556
|
+
protected IAPConfig iapConfig => AmaGDK.Config.iap;
|
|
557
|
+
|
|
558
|
+
public abstract void GetProducts(string[] productIds, ProductType productType, Action<ProductInfo[]> onSuccess = null, Action<string> onFail = null);
|
|
559
|
+
public abstract void Purchase(ProductInfo productInfo, Action<PurchaseSuccess> onSuccess = null, Action<PurchaseError> onFail = null);
|
|
560
|
+
public abstract void PurchaseDiscount(ProductInfo productInfo, string discountId, Action<PurchaseSuccess> onSuccess = null, Action<PurchaseError> onFail = null);
|
|
561
|
+
public abstract void RestorePurchase(Action<PurchaseSuccess> onSuccess = null, Action<PurchaseError> onFail = null);
|
|
562
|
+
public abstract List<string> GetActiveSubscriptions();
|
|
563
|
+
public abstract List<string> GetPurchasedProducts();
|
|
564
|
+
public abstract string GetActiveSubscriptionId();
|
|
565
|
+
public abstract string GetSubscriptionPeriodType();
|
|
566
|
+
public abstract DateTime? GetSubscriptionLastPurchaseDate();
|
|
567
|
+
public abstract DateTime? GetSubscriptionExpiredDate();
|
|
568
|
+
public abstract DateTime? GetUnsubscribedDate();
|
|
569
|
+
public abstract HashSet<PurchaseRecord> GetPurchaseHistory();
|
|
570
|
+
public abstract DateTime? GetLastPurchaseDate(string productAndPlanId);
|
|
572
571
|
}
|
|
573
|
-
}
|
|
572
|
+
}
|
|
@@ -4,6 +4,7 @@ using System.IO;
|
|
|
4
4
|
using System.Text;
|
|
5
5
|
using UnityEngine;
|
|
6
6
|
using Amanotes.Core.Internal;
|
|
7
|
+
using UnityEngine.Profiling;
|
|
7
8
|
using static Amanotes.Core.Internal.Logging;
|
|
8
9
|
|
|
9
10
|
#if UNITY_EDITOR
|
|
@@ -65,9 +66,9 @@ namespace Amanotes.Core
|
|
|
65
66
|
{
|
|
66
67
|
#if UNITY_EDITOR
|
|
67
68
|
//Override value in editor environment
|
|
68
|
-
if (
|
|
69
|
+
if (Config.remoteConfig.embedRemoteConfig.overrideInEditor)
|
|
69
70
|
{
|
|
70
|
-
foreach (var c in
|
|
71
|
+
foreach (var c in Config.remoteConfig.embedRemoteConfig.overrideConfig)
|
|
71
72
|
if (c.key == key)
|
|
72
73
|
return (T)Convert.ChangeType(c.value, typeof(T));
|
|
73
74
|
}
|
|
@@ -89,9 +90,13 @@ namespace Amanotes.Core
|
|
|
89
90
|
|
|
90
91
|
public static void SetActiveEmbedConfig(string id)
|
|
91
92
|
{
|
|
92
|
-
if (
|
|
93
|
+
if (Config.remoteConfig == null || Config.remoteConfig.embedRemoteConfig == null)
|
|
94
|
+
{
|
|
93
95
|
LogWarning("[RemoteConfig] No embed remote config available");
|
|
94
|
-
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
Config.remoteConfig.embedRemoteConfig.SetActiveConfig(id);
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
|
|
@@ -100,7 +105,6 @@ namespace Amanotes.Core
|
|
|
100
105
|
internal enum FetchState
|
|
101
106
|
{
|
|
102
107
|
None,
|
|
103
|
-
ResolveDependencies,
|
|
104
108
|
CheckInternet,
|
|
105
109
|
Fetch,
|
|
106
110
|
SaveCache,
|
|
@@ -117,8 +121,8 @@ namespace Amanotes.Core
|
|
|
117
121
|
static string base64Prefix = "base64:";
|
|
118
122
|
const string VERSION_PREFIX = "version:";
|
|
119
123
|
static int EmbedVersion =>
|
|
120
|
-
|
|
121
|
-
?
|
|
124
|
+
Config.remoteConfig != null && Config.remoteConfig.embedRemoteConfig != null
|
|
125
|
+
? Config.remoteConfig.embedRemoteConfig.version
|
|
122
126
|
: 1;
|
|
123
127
|
|
|
124
128
|
static FetchState _state = FetchState.None;
|
|
@@ -126,8 +130,7 @@ namespace Amanotes.Core
|
|
|
126
130
|
|
|
127
131
|
static readonly Dictionary<FetchState, Action[]> fetchSM = new Dictionary<FetchState, Action[]>
|
|
128
132
|
{
|
|
129
|
-
{ FetchState.None, new Action[]{
|
|
130
|
-
{ FetchState.ResolveDependencies, new Action[]{ LoadCache, CheckInternet}},
|
|
133
|
+
{ FetchState.None, new Action[]{ CheckInternet}},
|
|
131
134
|
{ FetchState.CheckInternet, new Action[]{ LoadCache, Fetch}},
|
|
132
135
|
{ FetchState.Fetch, new Action[]{ LoadCache, SaveCache}},
|
|
133
136
|
{ FetchState.SaveCache, new Action[]{ SetDone }},
|
|
@@ -135,10 +138,10 @@ namespace Amanotes.Core
|
|
|
135
138
|
{ FetchState.LoadEmbedConfig, new Action[]{ SetFail, SetDone}}
|
|
136
139
|
};
|
|
137
140
|
|
|
138
|
-
internal static
|
|
139
|
-
internal static RemoteConfigConfig adapterConfig;
|
|
140
|
-
internal static Action<bool> onAdapterInitCompleteCallback;
|
|
141
|
+
internal static RemoteConfigAdapter adapter;
|
|
141
142
|
|
|
143
|
+
internal static Action<bool> onAdapterInitCompleteCallback;
|
|
144
|
+
|
|
142
145
|
internal static void NextState(bool result = true)
|
|
143
146
|
{
|
|
144
147
|
if (!fetchSM.TryGetValue(_state, out var actions))
|
|
@@ -155,21 +158,7 @@ namespace Amanotes.Core
|
|
|
155
158
|
|
|
156
159
|
actions[result ? 1 : 0]();
|
|
157
160
|
}
|
|
158
|
-
|
|
159
|
-
static void ResolveDependency()
|
|
160
|
-
{
|
|
161
|
-
_state = FetchState.ResolveDependencies;
|
|
162
|
-
adapter = Adapter.GetSingleAdapter<IRemoteConfig>();
|
|
163
|
-
if (adapter == null)
|
|
164
|
-
{
|
|
165
|
-
NextState(false);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
adapterConfig = (adapter as AdapterContext)?.GetAdapterConfig<RemoteConfigConfig>();
|
|
170
|
-
adapter.ResolveDependencies(NextState);
|
|
171
|
-
}
|
|
172
|
-
|
|
161
|
+
|
|
173
162
|
static void CheckInternet()
|
|
174
163
|
{
|
|
175
164
|
_state = FetchState.CheckInternet;
|
|
@@ -196,6 +185,8 @@ namespace Amanotes.Core
|
|
|
196
185
|
|
|
197
186
|
static void SaveCache()
|
|
198
187
|
{
|
|
188
|
+
Profiler.BeginSample("AmaGDK.RemoteConfig.SaveCache()");
|
|
189
|
+
|
|
199
190
|
_state = FetchState.SaveCache;
|
|
200
191
|
StringBuilder sb = new StringBuilder();
|
|
201
192
|
|
|
@@ -210,15 +201,19 @@ namespace Amanotes.Core
|
|
|
210
201
|
string filePath = GDKFileUtils.GetPath(fileName);
|
|
211
202
|
GDKFileUtils.Save(filePath, sb.ToString());
|
|
212
203
|
Log($"[RemoteConfig] Saved remote config to {filePath}");
|
|
204
|
+
Profiler.EndSample();
|
|
213
205
|
NextState();
|
|
214
206
|
}
|
|
215
207
|
|
|
216
208
|
static void LoadCache()
|
|
217
209
|
{
|
|
210
|
+
Profiler.BeginSample("AmaGDK.RemoteConfig.LoadCache()");
|
|
211
|
+
|
|
218
212
|
_state = FetchState.LoadCache;
|
|
219
213
|
|
|
220
214
|
if (!HasCache)
|
|
221
215
|
{
|
|
216
|
+
Profiler.EndSample();
|
|
222
217
|
NextState(false);
|
|
223
218
|
return;
|
|
224
219
|
}
|
|
@@ -268,10 +263,12 @@ namespace Amanotes.Core
|
|
|
268
263
|
{
|
|
269
264
|
LogWarning($"[RemoteConfig] Error on LoadCache: {ex.Message}");
|
|
270
265
|
_cacheExisted = false;
|
|
266
|
+
Profiler.EndSample();
|
|
271
267
|
NextState(false);
|
|
272
268
|
return;
|
|
273
269
|
}
|
|
274
270
|
|
|
271
|
+
Profiler.EndSample();
|
|
275
272
|
NextState(true);
|
|
276
273
|
}
|
|
277
274
|
|
|
@@ -279,13 +276,13 @@ namespace Amanotes.Core
|
|
|
279
276
|
{
|
|
280
277
|
_state = FetchState.LoadEmbedConfig;
|
|
281
278
|
|
|
282
|
-
if (
|
|
279
|
+
if (_config.remoteConfig == null || _config.remoteConfig.embedRemoteConfig == null)
|
|
283
280
|
{
|
|
284
281
|
NextState(false);
|
|
285
282
|
return;
|
|
286
283
|
}
|
|
287
284
|
|
|
288
|
-
var config =
|
|
285
|
+
var config = _config.remoteConfig.embedRemoteConfig.ActiveConfig;
|
|
289
286
|
|
|
290
287
|
if (config == null || config.items.Length == 0)
|
|
291
288
|
{
|
|
@@ -343,7 +340,7 @@ namespace Amanotes.Core
|
|
|
343
340
|
|
|
344
341
|
public static class RemoteConfigExtension
|
|
345
342
|
{
|
|
346
|
-
public static void InitRemoteConfigModule(this
|
|
343
|
+
public static void InitRemoteConfigModule(this RemoteConfigAdapter ap, Action<bool> onCompleteCallback)
|
|
347
344
|
{
|
|
348
345
|
if (AmaGDK.RemoteConfig.State != AmaGDK.RemoteConfig.FetchState.None)
|
|
349
346
|
{
|
|
@@ -361,15 +358,21 @@ namespace Amanotes.Core.Internal
|
|
|
361
358
|
[Serializable]
|
|
362
359
|
public class RemoteConfigConfig
|
|
363
360
|
{
|
|
364
|
-
[
|
|
365
|
-
|
|
361
|
+
// [Header("----- MODULE CONFIG -----")]
|
|
362
|
+
|
|
366
363
|
public float firstFetchTimeOutInSeconds = 10;
|
|
367
364
|
public float defaultTimeOutInSeconds = 3;
|
|
365
|
+
[SerializeField] internal EmbedRemoteConfigAsset embedRemoteConfig;
|
|
368
366
|
}
|
|
369
367
|
|
|
370
|
-
public
|
|
368
|
+
public partial class ConfigAsset
|
|
369
|
+
{
|
|
370
|
+
[SerializeField] public RemoteConfigConfig remoteConfig;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
public abstract class RemoteConfigAdapter : Adapter2
|
|
371
374
|
{
|
|
372
|
-
|
|
373
|
-
void FetchConfig(bool isFirstTime, Action<bool, Dictionary<string, string>> onComplete);
|
|
375
|
+
protected RemoteConfigConfig moduleConfig => AmaGDK.Config.remoteConfig;
|
|
376
|
+
public abstract void FetchConfig(bool isFirstTime, Action<bool, Dictionary<string, string>> onComplete);
|
|
374
377
|
}
|
|
375
378
|
}
|
|
@@ -40,6 +40,7 @@ namespace Amanotes.Core
|
|
|
40
40
|
}
|
|
41
41
|
private set
|
|
42
42
|
{
|
|
43
|
+
if (_userId == value) return;
|
|
43
44
|
_userId = value;
|
|
44
45
|
OnUserIdChanged?.Invoke(_userId);
|
|
45
46
|
Save();
|
|
@@ -133,30 +134,34 @@ namespace Amanotes.Core
|
|
|
133
134
|
private const float WAIT_TIME = 0.5f;
|
|
134
135
|
private WaitForSecondsRealtime waitForDuration = new WaitForSecondsRealtime(WAIT_TIME);
|
|
135
136
|
|
|
136
|
-
internal
|
|
137
|
+
internal void InitModule()
|
|
137
138
|
{
|
|
138
139
|
User.LoadJsonFromFile();
|
|
140
|
+
|
|
141
|
+
// Always get the latest advertising id
|
|
139
142
|
GetAdvertisingId();
|
|
140
|
-
|
|
141
|
-
float time = 0;
|
|
142
|
-
while (!User.IsAmaDeviceIdExist())
|
|
143
|
-
{
|
|
144
|
-
yield return waitForDuration;
|
|
145
|
-
time += WAIT_TIME;
|
|
146
|
-
if (time <= TIME_OUT) continue;
|
|
147
|
-
Logging.LogWarning($"| UserProfile <init> timeout: {TIME_OUT} (ama_device_id not exist)");
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
143
|
}
|
|
151
|
-
|
|
144
|
+
|
|
145
|
+
internal void StartModule()
|
|
146
|
+
{
|
|
147
|
+
UpdateUserId();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// internal IEnumerator Init()
|
|
151
|
+
// {
|
|
152
|
+
// float time = 0;
|
|
153
|
+
// while (!User.IsAmaDeviceIdExist())
|
|
154
|
+
// {
|
|
155
|
+
// yield return waitForDuration;
|
|
156
|
+
// time += WAIT_TIME;
|
|
157
|
+
// if (time <= TIME_OUT) continue;
|
|
158
|
+
// Logging.LogWarning($"| UserProfile <init> timeout: {TIME_OUT} (ama_device_id not exist)");
|
|
159
|
+
// break;
|
|
160
|
+
// }
|
|
161
|
+
// }
|
|
162
|
+
|
|
152
163
|
internal void UpdateUserId()
|
|
153
164
|
{
|
|
154
|
-
if (!string.IsNullOrWhiteSpace(_userId))
|
|
155
|
-
{
|
|
156
|
-
OnUserIdChanged?.Invoke(_userId);
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
165
|
#if UNITY_ANDROID
|
|
161
166
|
if (!string.IsNullOrWhiteSpace(_gaid))
|
|
162
167
|
{
|
|
@@ -233,13 +238,15 @@ namespace Amanotes.Core
|
|
|
233
238
|
AndroidId = SystemInfo.deviceUniqueIdentifier;
|
|
234
239
|
break;
|
|
235
240
|
default:
|
|
236
|
-
Logging.
|
|
241
|
+
// Logging.Log($"[UserProfile] There is no advertising ID on {Application.platform}");
|
|
237
242
|
break;
|
|
238
243
|
}
|
|
239
244
|
}
|
|
240
245
|
|
|
241
246
|
private void GetAdvertisingId()
|
|
242
247
|
{
|
|
248
|
+
float time = Time.realtimeSinceStartup;
|
|
249
|
+
|
|
243
250
|
AdvertisingIdFetcher.RequestAdvertisingId(advertisingId =>
|
|
244
251
|
{
|
|
245
252
|
SetAdvertisingID(advertisingId);
|
|
@@ -269,6 +276,7 @@ namespace Amanotes.Core
|
|
|
269
276
|
AmaDeviceId = SystemInfo.deviceUniqueIdentifier;
|
|
270
277
|
break;
|
|
271
278
|
}
|
|
279
|
+
|
|
272
280
|
Logging.Log($"Generate AmaDeviceId completed: {_amaDeviceId}");
|
|
273
281
|
User.Save();
|
|
274
282
|
});
|