com.amanotes.gdk 0.2.46-1 → 0.2.46-2
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 +2 -1
- package/Runtime/AmaGDK.UserProfile.cs +56 -66
- package/Runtime/AmaGDK.cs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -14,18 +14,8 @@ namespace Amanotes.Core
|
|
|
14
14
|
[Serializable]
|
|
15
15
|
public partial class UserProfile : IJsonFile
|
|
16
16
|
{
|
|
17
|
-
private const string FILE_NAME = nameof(UserProfile);
|
|
18
|
-
[NonSerialized] internal bool _dirty;
|
|
19
|
-
|
|
20
17
|
private void Save()
|
|
21
18
|
{
|
|
22
|
-
GDKFileUtils.Save(FILE_NAME, JsonUtility.ToJson(this));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
internal void SaveIfDirty()
|
|
26
|
-
{
|
|
27
|
-
if (!_dirty) return;
|
|
28
|
-
_dirty = false;
|
|
29
19
|
this.SaveJsonToFile();
|
|
30
20
|
}
|
|
31
21
|
}
|
|
@@ -116,63 +106,8 @@ namespace Amanotes.Core
|
|
|
116
106
|
get => _installationId;
|
|
117
107
|
set => _installationId = ValidateId(value, ALPHANUMERIC_PATTERN);
|
|
118
108
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
public partial class UserProfile //INTERNAL
|
|
122
|
-
{
|
|
123
|
-
[SerializeField]
|
|
124
|
-
private string _userId;
|
|
125
|
-
[SerializeField]
|
|
126
|
-
private string _gaid;
|
|
127
|
-
[SerializeField]
|
|
128
|
-
private string _idfa;
|
|
129
|
-
[SerializeField]
|
|
130
|
-
private string _idfv;
|
|
131
|
-
[SerializeField]
|
|
132
|
-
private string _androidId;
|
|
133
|
-
[SerializeField]
|
|
134
|
-
private string _pseudoId;
|
|
135
|
-
[SerializeField]
|
|
136
|
-
private string _amaDeviceId;
|
|
137
|
-
[SerializeField]
|
|
138
|
-
private string _appsFlyerId;
|
|
139
|
-
[SerializeField]
|
|
140
|
-
private string _installationId;
|
|
141
|
-
|
|
142
|
-
private const string ALPHANUMERIC_HYPHEN_PATTERN = @"^(?=.*\d)(?=.*[a-zA-Z])(?=.*-).+$";
|
|
143
|
-
private const string ALPHANUMERIC_PATTERN = @"^(?=.*\d)(?=.*[a-zA-Z])[a-zA-Z\d]+$";
|
|
144
|
-
private const string NUMERIC_HYPHEN_PATTERN = @"^(?=.*\d)(?=.*-)[\d-]+$";
|
|
145
109
|
|
|
146
|
-
|
|
147
|
-
private const float TIME_OUT = 5f;
|
|
148
|
-
private const float WAIT_TIME = 0.5f;
|
|
149
|
-
private WaitForSecondsRealtime waitForDuration = new WaitForSecondsRealtime(WAIT_TIME);
|
|
150
|
-
|
|
151
|
-
internal IEnumerator Init()
|
|
152
|
-
{
|
|
153
|
-
User.LoadJsonFromFile();
|
|
154
|
-
|
|
155
|
-
#if UNITY_ANDROID
|
|
156
|
-
AndroidId = SystemInfo.deviceUniqueIdentifier;
|
|
157
|
-
#elif UNITY_IOS
|
|
158
|
-
IDFV = SystemInfo.deviceUniqueIdentifier;
|
|
159
|
-
#endif
|
|
160
|
-
|
|
161
|
-
// Always get the latest advertising id
|
|
162
|
-
GetAdvertisingId();
|
|
163
|
-
|
|
164
|
-
float time = 0;
|
|
165
|
-
while (!User.IsAmaDeviceIdExist())
|
|
166
|
-
{
|
|
167
|
-
yield return waitForDuration;
|
|
168
|
-
time += WAIT_TIME;
|
|
169
|
-
if (time <= TIME_OUT) continue;
|
|
170
|
-
Logging.LogWarning($"| UserProfile <init> timeout: {TIME_OUT} (ama_device_id not exist)");
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
internal void UpdateUserId()
|
|
110
|
+
public void UpdateUserId()
|
|
176
111
|
{
|
|
177
112
|
#if UNITY_ANDROID
|
|
178
113
|
if (!string.IsNullOrWhiteSpace(_gaid))
|
|
@@ -228,7 +163,62 @@ namespace Amanotes.Core
|
|
|
228
163
|
return;
|
|
229
164
|
}
|
|
230
165
|
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public partial class UserProfile //INTERNAL
|
|
169
|
+
{
|
|
170
|
+
[SerializeField]
|
|
171
|
+
private string _userId;
|
|
172
|
+
[SerializeField]
|
|
173
|
+
private string _gaid;
|
|
174
|
+
[SerializeField]
|
|
175
|
+
private string _idfa;
|
|
176
|
+
[SerializeField]
|
|
177
|
+
private string _idfv;
|
|
178
|
+
[SerializeField]
|
|
179
|
+
private string _androidId;
|
|
180
|
+
[SerializeField]
|
|
181
|
+
private string _pseudoId;
|
|
182
|
+
[SerializeField]
|
|
183
|
+
private string _amaDeviceId;
|
|
184
|
+
[SerializeField]
|
|
185
|
+
private string _appsFlyerId;
|
|
186
|
+
[SerializeField]
|
|
187
|
+
private string _installationId;
|
|
188
|
+
|
|
189
|
+
private const string ALPHANUMERIC_HYPHEN_PATTERN = @"^(?=.*\d)(?=.*[a-zA-Z])(?=.*-).+$";
|
|
190
|
+
private const string ALPHANUMERIC_PATTERN = @"^(?=.*\d)(?=.*[a-zA-Z])[a-zA-Z\d]+$";
|
|
191
|
+
private const string NUMERIC_HYPHEN_PATTERN = @"^(?=.*\d)(?=.*-)[\d-]+$";
|
|
231
192
|
|
|
193
|
+
private const string AMA_DEVICE_ID_KEY = "ama_device_id";
|
|
194
|
+
private const float TIME_OUT = 5f;
|
|
195
|
+
private const float WAIT_TIME = 0.5f;
|
|
196
|
+
private WaitForSecondsRealtime waitForDuration = new WaitForSecondsRealtime(WAIT_TIME);
|
|
197
|
+
|
|
198
|
+
internal IEnumerator Init()
|
|
199
|
+
{
|
|
200
|
+
User.LoadJsonFromFile();
|
|
201
|
+
|
|
202
|
+
#if UNITY_ANDROID
|
|
203
|
+
AndroidId = SystemInfo.deviceUniqueIdentifier;
|
|
204
|
+
#elif UNITY_IOS
|
|
205
|
+
IDFV = SystemInfo.deviceUniqueIdentifier;
|
|
206
|
+
#endif
|
|
207
|
+
|
|
208
|
+
// Always get the latest advertising id
|
|
209
|
+
GetAdvertisingId();
|
|
210
|
+
|
|
211
|
+
float time = 0;
|
|
212
|
+
while (!User.IsAmaDeviceIdExist())
|
|
213
|
+
{
|
|
214
|
+
yield return waitForDuration;
|
|
215
|
+
time += WAIT_TIME;
|
|
216
|
+
if (time <= TIME_OUT) continue;
|
|
217
|
+
Logging.LogWarning($"| UserProfile <init> timeout: {TIME_OUT} (ama_device_id not exist)");
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
232
222
|
private bool IsAmaDeviceIdExist()
|
|
233
223
|
{
|
|
234
224
|
if (!string.IsNullOrEmpty(_amaDeviceId))
|
package/Runtime/AmaGDK.cs
CHANGED