com.xd.sdk.common 6.29.5 → 6.31.1

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.
@@ -29,6 +29,7 @@ namespace XD.SDK.Common.Editor
29
29
  private const string OkHttp = " implementation \"com.squareup.okhttp3:okhttp:4.7.2\"";
30
30
  private const string Okio = " implementation \"com.squareup.okio:okio:2.6.0\"";
31
31
  private const string ZXing = " implementation \"com.google.zxing:core:3.5.3\"";
32
+ private const string LocalBroadcastManager = " implementation \"androidx.localbroadcastmanager:localbroadcastmanager:1.0.0\"";
32
33
 
33
34
  private const string ANDROIDX = "android.useAndroidX=true";
34
35
  private const string ANDROID_JET = "android.enableJetifier=true";
@@ -47,6 +48,7 @@ namespace XD.SDK.Common.Editor
47
48
  GSON_DEP,
48
49
  KOTLIN_DEP,
49
50
  ADX_COMPAT_DEP,
51
+ LocalBroadcastManager,
50
52
  RETROFIT2,
51
53
  RETROFIT2_RX,
52
54
  RETROFIT2_CONVERTER,
@@ -0,0 +1,32 @@
1
+ #import <Foundation/Foundation.h>
2
+ #if __has_include(<XDCommonSDK/XDGCoreService.h>)
3
+ #import <XDCommonSDK/XDGCloudLogHelper.h>
4
+ #else
5
+ #import "XDGCoreService.h"
6
+ #endif
7
+
8
+ extern "C" const char* XDGCoreService_logCommonEvent(const char *propertiesJson) {
9
+ @autoreleasepool {
10
+ NSString *jsonString = propertiesJson ? [NSString stringWithUTF8String:propertiesJson] : nil;
11
+
12
+ if (jsonString == nil) {
13
+ return nil;
14
+ }
15
+ NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
16
+ NSError *err;
17
+ NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
18
+ options:NSJSONReadingMutableContainers
19
+ error:&err];
20
+ if (err) {
21
+ return nil;
22
+ }
23
+
24
+ NSString *result = [XDGCloudLogHelper logCommonEvent:dic];
25
+ if (result == nil) {
26
+ result = @"";
27
+ }
28
+ const char *utf8 = [result UTF8String];
29
+ char *ret = strdup(utf8 ? utf8 : "");
30
+ return ret;
31
+ }
32
+ }
@@ -0,0 +1,42 @@
1
+ fileFormatVersion: 2
2
+ guid: 53a58dc1e660049a7b0cc6c860f67d10
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
+ VisionOS: VisionOS
27
+ second:
28
+ enabled: 1
29
+ settings: {}
30
+ - first:
31
+ iPhone: iOS
32
+ second:
33
+ enabled: 1
34
+ settings: {}
35
+ - first:
36
+ tvOS: tvOS
37
+ second:
38
+ enabled: 1
39
+ settings: {}
40
+ userData:
41
+ assetBundleName:
42
+ assetBundleVariant:
@@ -143,6 +143,11 @@ namespace XD.SDK.Common {
143
143
  {
144
144
  XDGCommonMobileImpl.GetInstance().PreloadWebPage(url);
145
145
  }
146
+
147
+ public string GetPackageType()
148
+ {
149
+ return XDGPackageType.PackageTypeDefault;
150
+ }
146
151
 
147
152
  private void SetGameActivity()
148
153
  {
@@ -606,6 +606,6 @@ namespace XD.SDK.Common{
606
606
  .CommandBuilder();
607
607
  EngineBridge.GetInstance().CallHandler(command);
608
608
  }
609
-
609
+
610
610
  }
611
611
  }
@@ -0,0 +1,44 @@
1
+ using System.Collections.Generic;
2
+ using UnityEngine;
3
+ using System.Runtime.InteropServices;
4
+ using LC.Newtonsoft.Json;
5
+
6
+ namespace XD.SDK.Common
7
+ {
8
+ public class XDGTrackMobileImpl : IXDGTracker
9
+ {
10
+ public string LogCommonEvent(Dictionary<string, string> properties)
11
+ {
12
+ #if UNITY_ANDROID
13
+ using (AndroidJavaClass clz = new AndroidJavaClass("com.xd.intl.common.tracker.aliyun.CloudLogHelper")) {
14
+ AndroidJavaObject map = null;
15
+ if (properties != null && properties.Count > 0)
16
+ {
17
+ map = new AndroidJavaObject("java.util.HashMap");
18
+ foreach (var kv in properties)
19
+ {
20
+ var key = kv.Key ?? string.Empty;
21
+ var val = kv.Value ?? string.Empty;
22
+ map.Call<AndroidJavaObject>("put", key, val);
23
+ }
24
+ }
25
+ return clz.CallStatic<string>("logEvent", map);
26
+ }
27
+ #elif UNITY_IOS
28
+ string json = null;
29
+ if (properties != null && properties.Count > 0)
30
+ {
31
+ json = JsonConvert.SerializeObject(properties);
32
+ }
33
+ System.IntPtr ret = XDGCoreService_logCommonEvent(json);
34
+ return Marshal.PtrToStringAnsi(ret);
35
+ #else
36
+ throw new System.NotImplementedException();
37
+ #endif
38
+ }
39
+
40
+ #if UNITY_IOS
41
+ [DllImport("__Internal")] private static extern System.IntPtr XDGCoreService_logCommonEvent(string propertiesJson);
42
+ #endif
43
+ }
44
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 98cac68f91e54588b0af74e96e2ef8c9
3
+ timeCreated: 1762933234
@@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
26
26
  + (NSString *)gameLaunchTime;
27
27
 
28
28
  + (NSString *)getTapDBDeviceID;
29
+
30
+ + (NSString *)logCommonEvent:(NSDictionary *)properties;
29
31
  @end
30
32
 
31
33
  NS_ASSUME_NONNULL_END
@@ -5,6 +5,6 @@
5
5
  // Created by Fattycat on 2022/5/13.
6
6
  //
7
7
 
8
- #define XDSDK_VERSION @"6.29.3"
9
- #define XDSDK_VERSION_CODE @"6029030"
10
- // HASH 6ccd542
8
+ #define XDSDK_VERSION @"6.31.0"
9
+ #define XDSDK_VERSION_CODE @"6031000"
10
+ // HASH 13f77e9f
@@ -10,6 +10,8 @@ namespace XD.SDK.Common.Internal
10
10
  public static readonly string BASE_HOST_CN_ROLLBACK = "https://xdsdk-cn-prod-gateway2.xd.cn";
11
11
  public static readonly string BASE_HOST_GLOBAL_DEFAULT = "https://xdsdk-os-prod-gateway.xd.com";
12
12
  public static readonly string BASE_HOST_GLOBAL_ROLLBACK = "https://xdsdk-os-prod-gateway2.xd.com";
13
+ public static readonly string XD_PERSONAL_INFO_CN = "https://accounts.xd.cn";
14
+ public static readonly string XD_PERSONAL_INFO_IO = "https://accounts.xd.com";
13
15
  }
14
16
  /*
15
17
  * 管理多个域名,通过 权重(weight)和 默认顺序(defaultOrder)来决定优先级
@@ -64,5 +64,7 @@ namespace XD.SDK.Common
64
64
  void OpenWebPage(string url, Action<WebActionEnum, Dictionary<string, object>> callback);
65
65
 
66
66
  void PreloadWebPage(string url);
67
+
68
+ string GetPackageType();
67
69
  }
68
70
  }
@@ -0,0 +1 @@
1
+ using System.Collections.Generic;
2
  public interface IXDGTracker
1
3
  {
2
4
  string LogCommonEvent(Dictionary<string, string> properties);
3
5
  }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 7f4a025e26de4022a90e767d1b76ba80
3
+ timeCreated: 1762932760
@@ -8,19 +8,19 @@ namespace XD.SDK.Common
8
8
  public const string PackageTypeDefault = "Default";
9
9
 
10
10
  // App Store 包
11
- public const string PackageTypeAppStore = "AppStore";
11
+ // public const string PackageTypeAppStore = "AppStore";
12
12
 
13
13
  // 普通 Android 包
14
- public const string PackageTypeAndroidNormal = "Android-Normal";
14
+ // public const string PackageTypeAndroidNormal = "Android-Normal";
15
15
 
16
16
  // GooglePlay 包
17
- public const string PackageTypeAndroidGooglePlay = "Android-GooglePlay";
17
+ // public const string PackageTypeAndroidGooglePlay = "Android-GooglePlay";
18
18
 
19
19
  // TapTap 国内包
20
- public const string PackageTypeAndroidTapTap = "Android-TapTap";
20
+ // public const string PackageTypeAndroidTapTap = "Android-TapTap";
21
21
 
22
22
  // TapTap 海外包
23
- public const string PackageTypeAndroidTapIO = "Android-TapIO";
23
+ // public const string PackageTypeAndroidTapIO = "Android-TapIO";
24
24
 
25
25
  // 普通 PC 包
26
26
  public const string PackageTypePCNormal = "PC-Normal";
@@ -0,0 +1 @@
1
+ using System;
2
  public class XDGTracker
1
3
  {
2
4
  private static readonly IXDGTracker platformWrapper;
3
5
  static XDGTracker()
4
6
  {
5
7
  var interfaceType = typeof(IXDGTracker);
6
8
  var platformInterfaceType = AppDomain.CurrentDomain.GetAssemblies()
7
9
  .SelectMany(assembly => assembly.GetTypes())
8
10
  .FirstOrDefault(clazz => interfaceType.IsAssignableFrom(clazz) && clazz.IsClass);
9
11
  if (platformInterfaceType != null)
10
12
  {
11
13
  platformWrapper = Activator.CreateInstance(platformInterfaceType) as IXDGTracker;
12
14
  }
13
15
  else
14
16
  {
15
17
  TapLogger.Error($"No class implements {interfaceType} Type. Current Platform: {Application.platform}, if you are using Editor, please check if you have installed XDSDK pc module.");
16
18
  }
17
19
  }
18
20
  public static string LogCommonEvent(Dictionary<string, string> properties)
19
21
  {
20
22
  return platformWrapper?.LogCommonEvent(properties);
21
23
  }
22
24
  }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: e1626c3e0ddc479cbfb8d8e3af1ebd29
3
+ timeCreated: 1762932797
@@ -252,5 +252,18 @@ namespace XD.SDK.Common
252
252
  {
253
253
  platformWrapper.PreloadWebPage(url);
254
254
  }
255
+
256
+ /// <summary>
257
+ /// 获取当前包体类型
258
+ /// 仅在 PC 平台可用
259
+ /// 1. 当 Steam SDK 启用时,优先返回 XDGPackageType.PackageTypePCSteam
260
+ /// 2. 当 TapTap 平台启用时,返回 XDGPackageType.PackageTypePCTapTap
261
+ /// 3. 否则返回默认 XDGPackageType.PackageTypePCNormal
262
+ /// </summary>
263
+ /// <returns>包体类型</returns>
264
+ public static string GetPackageType()
265
+ {
266
+ return platformWrapper.GetPackageType();
267
+ }
255
268
  }
256
269
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "com.xd.sdk.common",
3
3
  "displayName": "XDSDK Common",
4
- "version": "6.29.5",
4
+ "version": "6.31.1",
5
5
  "description": "XDSDK",
6
6
  "unity": "2018.3",
7
7
  "license": "MIT",