com.taptap.sdk.core 4.6.2 → 4.7.0-alpha.14

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.
@@ -4,6 +4,8 @@ using TapSDK.Core.Standalone.Internal;
4
4
  using System.Collections.Generic;
5
5
  using System.Text.RegularExpressions;
6
6
  using UnityEngine;
7
+ using TapSDK.Core.Internal.Utils;
8
+ using TapSDK.Core.Internal.Log;
7
9
 
8
10
  namespace TapSDK.Core.Standalone
9
11
  {
@@ -12,16 +14,29 @@ namespace TapSDK.Core.Standalone
12
14
  /// </summary>
13
15
  public class TapEventStandalone : ITapEventPlatform
14
16
  {
15
- private readonly Tracker Tracker = TapCoreStandalone.Tracker;
17
+ internal static Tracker Tracker;
16
18
  private readonly User User = TapCoreStandalone.User;
17
19
 
20
+ private TapTapEventOptions eventOptions;
21
+
22
+ public void Init(TapTapEventOptions eventOptions)
23
+ {
24
+ this.eventOptions = eventOptions;
25
+ if (eventOptions == null || !eventOptions.enableTapTapEvent)
26
+ {
27
+ return;
28
+ }
29
+ Tracker = new Tracker();
30
+ Tracker.Init();
31
+ }
32
+
18
33
  /// <summary>
19
34
  /// Sets the user ID for tracking events.
20
35
  /// </summary>
21
36
  /// <param name="userID">The user ID to set.</param>
22
37
  public void SetUserID(string userID)
23
38
  {
24
- if (!TapCoreStandalone.CheckInitState())
39
+ if (!CheckInitAndEnableState())
25
40
  {
26
41
  return;
27
42
  }
@@ -35,7 +50,7 @@ namespace TapSDK.Core.Standalone
35
50
  /// <param name="properties">Additional properties to associate with the user.</param>
36
51
  public void SetUserID(string userID, string properties)
37
52
  {
38
- if (!TapCoreStandalone.CheckInitState())
53
+ if (!CheckInitAndEnableState())
39
54
  {
40
55
  return;
41
56
  }
@@ -54,7 +69,7 @@ namespace TapSDK.Core.Standalone
54
69
  /// </summary>
55
70
  public void ClearUser()
56
71
  {
57
- if (!TapCoreStandalone.CheckInitState())
72
+ if (!CheckInitAndEnableState())
58
73
  {
59
74
  return;
60
75
  }
@@ -67,7 +82,7 @@ namespace TapSDK.Core.Standalone
67
82
  /// <returns>The device ID.</returns>
68
83
  public string GetDeviceId()
69
84
  {
70
- if (!TapCoreStandalone.CheckInitState())
85
+ if (!CheckInitAndEnableState())
71
86
  {
72
87
  return "";
73
88
  }
@@ -81,7 +96,7 @@ namespace TapSDK.Core.Standalone
81
96
  /// <param name="properties">Additional properties to associate with the event.</param>
82
97
  public void LogEvent(string name, string properties)
83
98
  {
84
- if (!TapCoreStandalone.CheckInitState())
99
+ if (!CheckInitAndEnableState())
85
100
  {
86
101
  return;
87
102
  }
@@ -101,7 +116,7 @@ namespace TapSDK.Core.Standalone
101
116
  /// <param name="properties">Additional properties to associate with the device initialization.</param>
102
117
  public void DeviceInitialize(string properties)
103
118
  {
104
- if (!TapCoreStandalone.CheckInitState())
119
+ if (!CheckInitAndEnableState())
105
120
  {
106
121
  return;
107
122
  }
@@ -115,7 +130,7 @@ namespace TapSDK.Core.Standalone
115
130
  /// <param name="properties">Additional properties to associate with the device update.</param>
116
131
  public void DeviceUpdate(string properties)
117
132
  {
118
- if (!TapCoreStandalone.CheckInitState())
133
+ if (!CheckInitAndEnableState())
119
134
  {
120
135
  return;
121
136
  }
@@ -129,7 +144,7 @@ namespace TapSDK.Core.Standalone
129
144
  /// <param name="properties">Additional properties to associate with the device addition.</param>
130
145
  public void DeviceAdd(string properties)
131
146
  {
132
- if (!TapCoreStandalone.CheckInitState())
147
+ if (!CheckInitAndEnableState())
133
148
  {
134
149
  return;
135
150
  }
@@ -143,7 +158,7 @@ namespace TapSDK.Core.Standalone
143
158
  /// <param name="properties">Additional properties to associate with the user initialization.</param>
144
159
  public void UserInitialize(string properties)
145
160
  {
146
- if (!TapCoreStandalone.CheckInitState())
161
+ if (!CheckInitAndEnableState())
147
162
  {
148
163
  return;
149
164
  }
@@ -157,7 +172,7 @@ namespace TapSDK.Core.Standalone
157
172
  /// <param name="properties">Additional properties to associate with the user update.</param>
158
173
  public void UserUpdate(string properties)
159
174
  {
160
- if (!TapCoreStandalone.CheckInitState())
175
+ if (!CheckInitAndEnableState())
161
176
  {
162
177
  return;
163
178
  }
@@ -171,7 +186,7 @@ namespace TapSDK.Core.Standalone
171
186
  /// <param name="properties">Additional properties to associate with the user addition.</param>
172
187
  public void UserAdd(string properties)
173
188
  {
174
- if (!TapCoreStandalone.CheckInitState())
189
+ if (!CheckInitAndEnableState())
175
190
  {
176
191
  return;
177
192
  }
@@ -186,7 +201,7 @@ namespace TapSDK.Core.Standalone
186
201
  /// <param name="value">The value of the common property.</param>
187
202
  public void AddCommonProperty(string key, string value)
188
203
  {
189
- if (!TapCoreStandalone.CheckInitState())
204
+ if (!CheckInitAndEnableState())
190
205
  {
191
206
  return;
192
207
  }
@@ -209,7 +224,7 @@ namespace TapSDK.Core.Standalone
209
224
  /// <param name="properties">The JSON string containing the common properties.</param>
210
225
  public void AddCommon(string properties)
211
226
  {
212
- if (!TapCoreStandalone.CheckInitState())
227
+ if (!CheckInitAndEnableState())
213
228
  {
214
229
  return;
215
230
  }
@@ -223,7 +238,7 @@ namespace TapSDK.Core.Standalone
223
238
  /// <param name="key">The key of the common property to clear.</param>
224
239
  public void ClearCommonProperty(string key)
225
240
  {
226
- if (!TapCoreStandalone.CheckInitState())
241
+ if (!CheckInitAndEnableState())
227
242
  {
228
243
  return;
229
244
  }
@@ -236,7 +251,7 @@ namespace TapSDK.Core.Standalone
236
251
  /// <param name="keys">The keys of the common properties to clear.</param>
237
252
  public void ClearCommonProperties(string[] keys)
238
253
  {
239
- if (!TapCoreStandalone.CheckInitState())
254
+ if (!CheckInitAndEnableState())
240
255
  {
241
256
  return;
242
257
  }
@@ -248,7 +263,7 @@ namespace TapSDK.Core.Standalone
248
263
  /// </summary>
249
264
  public void ClearAllCommonProperties()
250
265
  {
251
- if (!TapCoreStandalone.CheckInitState())
266
+ if (!CheckInitAndEnableState())
252
267
  {
253
268
  return;
254
269
  }
@@ -266,7 +281,7 @@ namespace TapSDK.Core.Standalone
266
281
  /// <param name="properties">Additional properties to associate with the charge event.</param>
267
282
  public void LogChargeEvent(string orderID, string productName, long amount, string currencyType, string paymentMethod, string properties)
268
283
  {
269
- if (!TapCoreStandalone.CheckInitState())
284
+ if (!CheckInitAndEnableState())
270
285
  {
271
286
  return;
272
287
  }
@@ -284,7 +299,7 @@ namespace TapSDK.Core.Standalone
284
299
  /// <param name="callback">The callback function that returns a JSON string containing the dynamic properties.</param>
285
300
  public void RegisterDynamicProperties(Func<string> callback)
286
301
  {
287
- if (!TapCoreStandalone.CheckInitState())
302
+ if (!CheckInitAndEnableState())
288
303
  {
289
304
  return;
290
305
  }
@@ -298,11 +313,7 @@ namespace TapSDK.Core.Standalone
298
313
  /// <param name="value">oaid</param>
299
314
  public void SetOAID(string value)
300
315
  {
301
- if (!TapCoreStandalone.CheckInitState())
302
- {
303
- return;
304
- }
305
-
316
+ Debug.Log("SetOAID called in PC platform (empty implementation)");
306
317
  }
307
318
 
308
319
  /// <summary>
@@ -310,12 +321,6 @@ namespace TapSDK.Core.Standalone
310
321
  /// </summary>
311
322
  public void LogDeviceLoginEvent()
312
323
  {
313
- // PC端空实现
314
- if (!TapCoreStandalone.CheckInitState())
315
- {
316
- return;
317
- }
318
-
319
324
  Debug.Log("LogDeviceLoginEvent called in PC platform (empty implementation)");
320
325
  }
321
326
 
@@ -363,10 +368,36 @@ namespace TapSDK.Core.Standalone
363
368
  return regex.IsMatch(userID);
364
369
  }
365
370
 
371
+ /// <summary>
372
+ /// 检查是否 Core模块初始化及 TapEvent 启用
373
+ /// </summary>
374
+ /// <returns></returns>
375
+ private bool CheckInitAndEnableState()
376
+ {
377
+ if (!TapCoreStandalone.CheckInitState())
378
+ {
379
+ return false;
380
+ }
381
+ else
382
+ {
383
+ if (eventOptions == null || !eventOptions.enableTapTapEvent)
384
+ {
385
+ string tip = "当前应用已关闭 TapTapEvent 开关,请开启后再调用相关接口";
386
+ TapLog.Error(tip + " 开启方式:enableTapTapEvent = true");
387
+ return false;
388
+ }
389
+ else
390
+ {
391
+ return true;
392
+ }
393
+ }
394
+ }
395
+
366
396
  private Dictionary<string, object> filterProperties(Dictionary<string, object> properties)
367
397
  {
368
398
  Dictionary<string, object> filteredProperties = new Dictionary<string, object>();
369
- if(properties != null) {
399
+ if (properties != null)
400
+ {
370
401
  foreach (var property in properties)
371
402
  {
372
403
  if (property.Key.Length <= 0 || property.Key.Length > 256)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "com.taptap.sdk.core",
3
3
  "displayName": "TapTapSDK Core",
4
4
  "description": "TapTapSDK Core",
5
- "version": "4.6.2",
5
+ "version": "4.7.0-alpha.14",
6
6
  "unity": "2019.4",
7
7
  "license": "MIT",
8
8
  "dependencies": {
package/link.xml DELETED
@@ -1,4 +0,0 @@
1
- <linker>
2
- <assembly fullname="TapSDK.Core.Runtime" preserve="all" />
3
- <assembly fullname="TapSDK.Core.Mobile.Runtime" preserve="all" />
4
- </linker>
package/link.xml.meta DELETED
@@ -1,7 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 3dcabf4e5ea8a4de2b78153078c62c5f
3
- TextScriptImporter:
4
- externalObjects: {}
5
- userData:
6
- assetBundleName:
7
- assetBundleVariant: