com.amanotes.gdk 0.2.16 → 0.2.18
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 +7 -0
- package/Editor/MatchSDKVersion.cs +1 -4
- package/Editor/UserProfile.PostBuild.cs +72 -0
- package/{Runtime/AmaGDK.AmaPassport.cs.meta → Editor/UserProfile.PostBuild.cs.meta} +1 -1
- package/Editor/UserProfileDependencies.xml +5 -0
- package/Editor/UserProfileDependencies.xml.meta +7 -0
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AmaGDKProject.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage.meta +0 -1
- 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_v5.1.3.unitypackage +0 -0
- package/Packages/{AmaPassport.ATTSupport.unitypackage.meta → RevenueCatAdapter_v5.1.3.unitypackage.meta} +1 -1
- package/Runtime/AmaGDK.IAP.cs +83 -30
- package/Runtime/AmaGDK.UserProfile.cs +95 -2
- package/Runtime/AmaGDK.cs +2 -2
- package/Runtime/UserProfile/Plugins/Android/AdvertisingIdCallback.java +7 -0
- package/Runtime/UserProfile/Plugins/Android/AdvertisingIdCallback.java.meta +32 -0
- package/Runtime/UserProfile/Plugins/Android/AdvertisingIdFetcher.cs +57 -0
- package/Runtime/UserProfile/Plugins/Android/AdvertisingIdFetcher.cs.meta +11 -0
- package/Runtime/UserProfile/Plugins/Android/AdvertisingIdFetcher.java +79 -0
- package/Runtime/UserProfile/Plugins/Android/AdvertisingIdFetcher.java.meta +32 -0
- package/Runtime/UserProfile/Plugins/Android.meta +8 -0
- package/Runtime/UserProfile/Plugins/iOS/KeyChain.cs +53 -0
- package/Runtime/UserProfile/Plugins/iOS/KeyChain.cs.meta +11 -0
- package/Runtime/UserProfile/Plugins/iOS/KeyChainPlugin.mm +52 -0
- package/Runtime/UserProfile/Plugins/iOS/KeyChainPlugin.mm.meta +33 -0
- package/Runtime/UserProfile/Plugins/iOS/UICKeyChainStore.h +281 -0
- package/Runtime/UserProfile/Plugins/iOS/UICKeyChainStore.h.meta +33 -0
- package/Runtime/UserProfile/Plugins/iOS/UICKeyChainStore.m +1393 -0
- package/Runtime/UserProfile/Plugins/iOS/UICKeyChainStore.m.meta +33 -0
- package/Runtime/UserProfile/Plugins/iOS.meta +8 -0
- package/Runtime/UserProfile/Plugins.meta +8 -0
- package/{Packages/AmaPassportAdapter_v1.0.0.unitypackage.meta → Runtime/UserProfile.meta} +2 -1
- package/package.json +1 -1
- package/Packages/AmaPassport.ATTSupport.unitypackage +0 -0
- package/Packages/AmaPassportAdapter_v1.0.0.unitypackage +0 -0
- package/Packages/IronsourceAdapter_v7.2.6.unitypackage +0 -0
- package/Runtime/AmaGDK.AmaPassport.cs +0 -440
- /package/Packages/{IronsourceAdapter_v7.2.6.unitypackage.meta → IronSourceAdapter_v7.2.6.unitypackage.meta} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: f5eab373a4ad14a2590d74502cabe422
|
|
3
|
+
PluginImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
iconMap: {}
|
|
7
|
+
executionOrder: {}
|
|
8
|
+
defineConstraints: []
|
|
9
|
+
isPreloaded: 0
|
|
10
|
+
isOverridable: 0
|
|
11
|
+
isExplicitlyReferenced: 0
|
|
12
|
+
validateReferences: 1
|
|
13
|
+
platformData:
|
|
14
|
+
- first:
|
|
15
|
+
Any:
|
|
16
|
+
second:
|
|
17
|
+
enabled: 0
|
|
18
|
+
settings: {}
|
|
19
|
+
- first:
|
|
20
|
+
Editor: Editor
|
|
21
|
+
second:
|
|
22
|
+
enabled: 0
|
|
23
|
+
settings:
|
|
24
|
+
DefaultValueInitialized: true
|
|
25
|
+
- first:
|
|
26
|
+
iPhone: iOS
|
|
27
|
+
second:
|
|
28
|
+
enabled: 1
|
|
29
|
+
settings:
|
|
30
|
+
AddToEmbeddedBinaries: false
|
|
31
|
+
userData:
|
|
32
|
+
assetBundleName:
|
|
33
|
+
assetBundleVariant:
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
using Amanotes.Core.Internal;
|
|
2
|
-
using System;
|
|
3
|
-
using System.Collections;
|
|
4
|
-
using System.Collections.Generic;
|
|
5
|
-
using UnityEngine;
|
|
6
|
-
using UnityEngine.Networking;
|
|
7
|
-
using static Amanotes.Core.Internal.Logging;
|
|
8
|
-
|
|
9
|
-
namespace Amanotes.Core.Internal
|
|
10
|
-
{
|
|
11
|
-
public interface IAmaPassportAdapter
|
|
12
|
-
{ }
|
|
13
|
-
|
|
14
|
-
[Serializable] public class AmaPassportAdapterConfig
|
|
15
|
-
{
|
|
16
|
-
public string secretKey;
|
|
17
|
-
public bool enableAmaPassport;
|
|
18
|
-
public bool injectLocation;
|
|
19
|
-
public bool injectAdvertisingId;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public class AmaPassportSupport
|
|
23
|
-
{
|
|
24
|
-
public static void SetAdvertisingID(string id)
|
|
25
|
-
{
|
|
26
|
-
AmaGDK.DeviceInfo device = AmaGDK.User.amaPassport.device;
|
|
27
|
-
switch (Application.platform)
|
|
28
|
-
{
|
|
29
|
-
case RuntimePlatform.IPhonePlayer:
|
|
30
|
-
device.idfa = id;
|
|
31
|
-
break;
|
|
32
|
-
|
|
33
|
-
case RuntimePlatform.Android:
|
|
34
|
-
device.gaid = id;
|
|
35
|
-
break;
|
|
36
|
-
|
|
37
|
-
default:
|
|
38
|
-
LogWarning("Unsupported platform: " + Application.platform);
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public static void SetAmaDeviceId(string id)
|
|
44
|
-
{
|
|
45
|
-
AmaGDK.User.amaPassport.device.amaDeviceId = id;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
namespace Amanotes.Core
|
|
50
|
-
{
|
|
51
|
-
public partial class AmaGDK // UserProfile
|
|
52
|
-
{
|
|
53
|
-
public partial class UserProfile
|
|
54
|
-
{
|
|
55
|
-
[SerializeField]
|
|
56
|
-
internal AmaPassportInfo amaPassport = new AmaPassportInfo();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
[Serializable]
|
|
60
|
-
internal class AmaPassportInfo
|
|
61
|
-
{
|
|
62
|
-
[SerializeField] internal DeviceInfo device = new DeviceInfo();
|
|
63
|
-
[SerializeField] internal SocialInfo social = new SocialInfo();
|
|
64
|
-
|
|
65
|
-
public long expireTime;
|
|
66
|
-
public string accessToken = "";
|
|
67
|
-
public string refreshToken = "";
|
|
68
|
-
|
|
69
|
-
internal bool isTokenExpired()
|
|
70
|
-
{
|
|
71
|
-
if (DateTimeOffset.Now.ToUnixTimeMilliseconds() < expireTime)
|
|
72
|
-
{
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
accessToken = "";
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
[Serializable]
|
|
82
|
-
internal class DeviceInfo
|
|
83
|
-
{
|
|
84
|
-
public string amaId = "";
|
|
85
|
-
public string amaDeviceId;
|
|
86
|
-
|
|
87
|
-
public string androidId;
|
|
88
|
-
public string deviceModel;
|
|
89
|
-
public string deviceName;
|
|
90
|
-
public int graphicsDeviceId;
|
|
91
|
-
public int graphicsDeviceVendorId;
|
|
92
|
-
public string operatingSystem;
|
|
93
|
-
public string processorType;
|
|
94
|
-
public int systemMemorySize;
|
|
95
|
-
|
|
96
|
-
public string firebaseUserPseudoId;
|
|
97
|
-
public string appsflyerId;
|
|
98
|
-
public string ironsourceId;
|
|
99
|
-
|
|
100
|
-
public string ipAddress;
|
|
101
|
-
public Location location = new Location();
|
|
102
|
-
public string country;
|
|
103
|
-
public string idfa;
|
|
104
|
-
public string gaid;
|
|
105
|
-
public string idfv;
|
|
106
|
-
public string deviceUniqueId;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
[Serializable]
|
|
110
|
-
internal class Location
|
|
111
|
-
{
|
|
112
|
-
public string lat;
|
|
113
|
-
public string lon;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
[Serializable]
|
|
117
|
-
internal class SocialInfo
|
|
118
|
-
{
|
|
119
|
-
public string socialToken;
|
|
120
|
-
public string socialPlatform;
|
|
121
|
-
|
|
122
|
-
internal bool hasLinkSocial => !string.IsNullOrEmpty(socialPlatform);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
[Serializable]
|
|
126
|
-
internal class GeoDataRes
|
|
127
|
-
{
|
|
128
|
-
public string country;
|
|
129
|
-
public string lat;
|
|
130
|
-
public string lon;
|
|
131
|
-
public string query;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
public partial class AmaGDK // AmaPassport
|
|
136
|
-
{
|
|
137
|
-
public partial class AmaPassport // Token Requesting Logic
|
|
138
|
-
{
|
|
139
|
-
[Serializable] private class TokenData
|
|
140
|
-
{
|
|
141
|
-
public string expiresIn;
|
|
142
|
-
public string accessToken;
|
|
143
|
-
public string refreshToken;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
[Serializable] private class AmaIDData
|
|
147
|
-
{
|
|
148
|
-
public string amaId;
|
|
149
|
-
public string amaDeviceId;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
private const string API_URL = "https://passport.staging.amanotes.io/api/v3/";
|
|
153
|
-
private const string PASSPORT_URL = API_URL + "passport/";
|
|
154
|
-
private const string TOKEN_URL = API_URL + "token/";
|
|
155
|
-
|
|
156
|
-
private const string GET_AMA_ID_URL = PASSPORT_URL + "get-ama-id";
|
|
157
|
-
private const string SOCIAL_UNLINK_URL = PASSPORT_URL + "logout";
|
|
158
|
-
private const string INIT_URL = TOKEN_URL + "init";
|
|
159
|
-
private const string REFRESH_URL = TOKEN_URL + "refresh-token";
|
|
160
|
-
|
|
161
|
-
private static IEnumerator RequestTokenRoutine()
|
|
162
|
-
{
|
|
163
|
-
string appSecret = _ampConfig.secretKey;
|
|
164
|
-
AmaPassportInfo passport = User.amaPassport;
|
|
165
|
-
bool isRefresh = !string.IsNullOrEmpty(passport.refreshToken);
|
|
166
|
-
|
|
167
|
-
var request = new JsonWebRequest<TokenData>(
|
|
168
|
-
isRefresh ? REFRESH_URL : INIT_URL,
|
|
169
|
-
isRefresh ? JsonUtils.KeyValueToJson("refreshToken", passport.refreshToken)
|
|
170
|
-
: JsonUtils.KeyValueToJson("appSecret", appSecret)
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
yield return _instance.StartCoroutine(request.Send());
|
|
174
|
-
|
|
175
|
-
TokenData data = request.data;
|
|
176
|
-
if (data == null) Debug.LogWarning("data should not be null!");
|
|
177
|
-
|
|
178
|
-
if (data?.expiresIn != null)
|
|
179
|
-
{
|
|
180
|
-
long expireTime = DateTimeOffset.Now.ToUnixTimeMilliseconds() + int.Parse(data.expiresIn);
|
|
181
|
-
Log("RequestTokenRoutine complete --> accessToken = " + data.accessToken);
|
|
182
|
-
|
|
183
|
-
// Update & save
|
|
184
|
-
passport.accessToken = data.accessToken;
|
|
185
|
-
passport.refreshToken = data.refreshToken;
|
|
186
|
-
passport.expireTime = expireTime;
|
|
187
|
-
}
|
|
188
|
-
User.Save();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
private static IEnumerator GetAmaIDRoutine()
|
|
192
|
-
{
|
|
193
|
-
AmaPassportInfo passport = User.amaPassport;
|
|
194
|
-
if (string.IsNullOrEmpty(passport.accessToken) || passport.isTokenExpired()) yield return _instance.StartCoroutine(RequestTokenRoutine());
|
|
195
|
-
|
|
196
|
-
var requestData = new Dictionary<string, object>
|
|
197
|
-
{
|
|
198
|
-
{ "amaId", passport.device.amaId },
|
|
199
|
-
{ "social", passport.social },
|
|
200
|
-
{ "ids", passport.device }
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
var request = new JsonWebRequest<AmaIDData>(
|
|
204
|
-
GET_AMA_ID_URL,
|
|
205
|
-
JsonUtils.DictionaryToJson(requestData),
|
|
206
|
-
passport.accessToken
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
yield return _instance.StartCoroutine(request.Send());
|
|
210
|
-
AmaIDData data = request.data;
|
|
211
|
-
|
|
212
|
-
Log("GetAmaIDRoutine complete --> amaId = " + data.amaId);
|
|
213
|
-
|
|
214
|
-
// Update & Save
|
|
215
|
-
passport.device.amaId = data.amaId;
|
|
216
|
-
OnGetAmaIdComplete?.Invoke(data.amaId);
|
|
217
|
-
User.Save();
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
private static IEnumerator UnlinkSocialRoutine()
|
|
221
|
-
{
|
|
222
|
-
AmaPassportInfo amaPassport = User.amaPassport;
|
|
223
|
-
if (string.IsNullOrEmpty(amaPassport.accessToken) || amaPassport.isTokenExpired()) yield return _instance.StartCoroutine(RequestTokenRoutine());
|
|
224
|
-
|
|
225
|
-
SocialInfo social = amaPassport.social;
|
|
226
|
-
social.socialPlatform = string.Empty;
|
|
227
|
-
social.socialToken = string.Empty;
|
|
228
|
-
|
|
229
|
-
var request = new JsonWebRequest<AmaIDData>(
|
|
230
|
-
SOCIAL_UNLINK_URL,
|
|
231
|
-
JsonUtils.KeyValueToJson("ids", amaPassport.device),
|
|
232
|
-
amaPassport.accessToken
|
|
233
|
-
);
|
|
234
|
-
|
|
235
|
-
yield return _instance.StartCoroutine(request.Send());
|
|
236
|
-
AmaIDData data = request.data;
|
|
237
|
-
|
|
238
|
-
// Update & Save
|
|
239
|
-
Log("[Unlink] amaId: " + data.amaId);
|
|
240
|
-
amaPassport.device.amaId = data.amaId;
|
|
241
|
-
User.Save();
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Internal static
|
|
245
|
-
private static void LinkSocialAccount(string platform, string token)
|
|
246
|
-
{
|
|
247
|
-
if (User.amaPassport.social.hasLinkSocial)
|
|
248
|
-
{
|
|
249
|
-
LogWarning("Social has been linked");
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (string.IsNullOrEmpty(AmaId))
|
|
254
|
-
{
|
|
255
|
-
OnGetAmaIdComplete += LinkSocialRequestAmaId;
|
|
256
|
-
void LinkSocialRequestAmaId(string amaId)
|
|
257
|
-
{
|
|
258
|
-
OnGetAmaIdComplete -= LinkSocialRequestAmaId;
|
|
259
|
-
if (string.IsNullOrEmpty(amaId))
|
|
260
|
-
{
|
|
261
|
-
LogWarning("Can not link social");
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
SendLinkSocial(platform, token);
|
|
265
|
-
}
|
|
266
|
-
RequestAmaID();
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
SendLinkSocial(platform, token);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
private static void SendLinkSocial(string platform, string token)
|
|
274
|
-
{
|
|
275
|
-
SocialInfo social = User.amaPassport.social;
|
|
276
|
-
social.socialPlatform = platform;
|
|
277
|
-
social.socialToken = token;
|
|
278
|
-
_instance.StartCoroutine(GetAmaIDRoutine());
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
private static void DoRequestAmaID()
|
|
282
|
-
{
|
|
283
|
-
isInQueue = false;
|
|
284
|
-
_instance.StartCoroutine(GetAmaIDRoutine());
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
public partial class AmaPassport // Location support
|
|
288
|
-
{
|
|
289
|
-
internal static void GetLocation(Action oncomplete)
|
|
290
|
-
{
|
|
291
|
-
_instance.StartCoroutine(GetIP(oncomplete));
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
private static IEnumerator GetIP(Action onComplete)
|
|
295
|
-
{
|
|
296
|
-
UnityWebRequest request = UnityWebRequest.Get("http://ip-api.com/json");
|
|
297
|
-
yield return request.SendWebRequest();
|
|
298
|
-
if (string.IsNullOrWhiteSpace(request.error))
|
|
299
|
-
{
|
|
300
|
-
string json = request.downloadHandler.text.Trim();
|
|
301
|
-
var geoData = JsonUtility.FromJson<GeoDataRes>(json);
|
|
302
|
-
if (geoData == null)
|
|
303
|
-
{
|
|
304
|
-
onComplete?.Invoke();
|
|
305
|
-
yield break;
|
|
306
|
-
}
|
|
307
|
-
DeviceInfo device = User.amaPassport.device;
|
|
308
|
-
device.country = geoData.country;
|
|
309
|
-
device.ipAddress = geoData.query;
|
|
310
|
-
device.location = new Location
|
|
311
|
-
{ lat = geoData.lat, lon = geoData.lon };
|
|
312
|
-
} else
|
|
313
|
-
LogWarning("Get location failed: " + request.error);
|
|
314
|
-
Log("Get GeoData completed");
|
|
315
|
-
onComplete?.Invoke();
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
public partial class AmaPassport // public APIs
|
|
320
|
-
{
|
|
321
|
-
private static AmaPassportAdapterConfig _ampConfig;
|
|
322
|
-
|
|
323
|
-
private static ActionQueue actionQueue;
|
|
324
|
-
public static Action<Action> GetAdvertisingIdHook;
|
|
325
|
-
public static Action<Action> GetLocationHook;
|
|
326
|
-
public static Action<Action> ATTHook;
|
|
327
|
-
public static Action<string> OnGetAmaIdComplete;
|
|
328
|
-
private static bool isInQueue;
|
|
329
|
-
|
|
330
|
-
public static string AmaId => User.amaPassport.device.amaId;
|
|
331
|
-
public static string GAId => User.amaPassport.device.gaid;
|
|
332
|
-
public static string IDFA => User.amaPassport.device.idfa;
|
|
333
|
-
public static string IDFV => User.amaPassport.device.idfv;
|
|
334
|
-
public static string AndroidId => User.amaPassport.device.androidId;
|
|
335
|
-
public static string AmaDeviceId => User.amaPassport.device.amaDeviceId;
|
|
336
|
-
public static string IpAddress => User.amaPassport.device.ipAddress;
|
|
337
|
-
public static string Country => User.amaPassport.device.country;
|
|
338
|
-
public static string DeviceUniqueId => User.amaPassport.device.deviceUniqueId;
|
|
339
|
-
public static string AppsflyerId => User.amaPassport.device.appsflyerId;
|
|
340
|
-
|
|
341
|
-
internal static void Init()
|
|
342
|
-
{
|
|
343
|
-
var adapter = Adapter.GetSingleAdapter<IAmaPassportAdapter>();
|
|
344
|
-
_ampConfig = (adapter as AdapterContext)?.GetAdapterConfig<AmaPassportAdapterConfig>();
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
public static void LinkWithFacebook(string accessToken)
|
|
348
|
-
{
|
|
349
|
-
if (_ampConfig == null) return;
|
|
350
|
-
LinkSocialAccount("facebook", accessToken);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
public static void LinkWithGoogle(string idToken)
|
|
354
|
-
{
|
|
355
|
-
if (_ampConfig == null) return;
|
|
356
|
-
LinkSocialAccount("google", idToken);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
public static void LinkWithApple(string identityToken)
|
|
360
|
-
{
|
|
361
|
-
if (_ampConfig == null) return;
|
|
362
|
-
LinkSocialAccount("apple", identityToken);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
public static void UnlinkSocialAccount()
|
|
366
|
-
{
|
|
367
|
-
if (_ampConfig == null) return;
|
|
368
|
-
if (!User.amaPassport.social.hasLinkSocial)
|
|
369
|
-
{
|
|
370
|
-
LogWarning("Social has not linked");
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
if (string.IsNullOrEmpty(AmaId))
|
|
375
|
-
{
|
|
376
|
-
LogWarning("No available AmaId to unlink");
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
_instance.StartCoroutine(UnlinkSocialRoutine());
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
public static void RequestAmaID()
|
|
384
|
-
{
|
|
385
|
-
if (_ampConfig == null) return;
|
|
386
|
-
DeviceInfo device = User.amaPassport.device;
|
|
387
|
-
|
|
388
|
-
if (string.IsNullOrEmpty(_ampConfig.secretKey))
|
|
389
|
-
{
|
|
390
|
-
LogWarning($"Invalid secretKey: {_ampConfig.secretKey}");
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
if (!_ampConfig.enableAmaPassport)
|
|
395
|
-
{
|
|
396
|
-
LogWarning("AmaPassport is disabled!");
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
if (!string.IsNullOrEmpty(device.amaId))
|
|
401
|
-
{
|
|
402
|
-
Log($"AmaId is already exist: {device.amaId}");
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
GetDeviceInfo(DoRequestAmaID);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
private static void GetDeviceInfo(Action getDeviceInfoComplete)
|
|
410
|
-
{
|
|
411
|
-
if (isInQueue)
|
|
412
|
-
{
|
|
413
|
-
LogWarning("Request AmaId under process");
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
isInQueue = true;
|
|
417
|
-
|
|
418
|
-
DeviceInfo device = User.amaPassport.device;
|
|
419
|
-
device.deviceModel = SystemInfo.deviceModel;
|
|
420
|
-
device.deviceName = SystemInfo.deviceName;
|
|
421
|
-
device.processorType = SystemInfo.processorType;
|
|
422
|
-
device.systemMemorySize = SystemInfo.systemMemorySize;
|
|
423
|
-
device.graphicsDeviceId = SystemInfo.graphicsDeviceID;
|
|
424
|
-
device.graphicsDeviceVendorId = SystemInfo.graphicsDeviceVendorID;
|
|
425
|
-
device.operatingSystem = SystemInfo.operatingSystem;
|
|
426
|
-
device.deviceUniqueId = SystemInfo.deviceUniqueIdentifier;
|
|
427
|
-
if (Application.platform == RuntimePlatform.Android)
|
|
428
|
-
device.androidId = SystemInfo.deviceUniqueIdentifier;
|
|
429
|
-
else if (Application.platform == RuntimePlatform.IPhonePlayer) device.idfv = SystemInfo.deviceUniqueIdentifier;
|
|
430
|
-
|
|
431
|
-
actionQueue = new ActionQueue(getDeviceInfoComplete);
|
|
432
|
-
actionQueue.EnqueueAction(ATTHook);
|
|
433
|
-
|
|
434
|
-
if (_ampConfig.injectLocation) actionQueue.EnqueueAction(GetLocationHook ?? GetLocation);
|
|
435
|
-
if (_ampConfig.injectAdvertisingId) actionQueue.EnqueueAction(GetAdvertisingIdHook);
|
|
436
|
-
actionQueue.StartQueue();
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
File without changes
|