com.xd.sdk.common 7.1.1 → 7.2.0

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.
Files changed (141) hide show
  1. package/Editor/Android/XDCommonAndroidGradleProcessor.cs +2 -0
  2. package/Editor/XD.SDK.Common.Editor.asmdef +2 -1
  3. package/Plugins/Android/libs/XDGBridgeCommon_v7_7.2.0.aar +0 -0
  4. package/Plugins/Android/libs/XDGCommon_7.2.0.aar +0 -0
  5. package/Plugins/Android/libs/XDGTapTapWrapperInternal_7.2.0.aar +0 -0
  6. package/Plugins/Android/libs/{XDTapTapWrapper_7.1.0.aar → XDTapTapWrapper_7.2.0.aar} +0 -0
  7. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_chat.png +0 -0
  8. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_chat.png.meta +7 -0
  9. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_invite.png +0 -0
  10. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_invite.png.meta +7 -0
  11. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_unfollow.png +0 -0
  12. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_unfollow.png.meta +7 -0
  13. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark.meta +8 -0
  14. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_chat.png +0 -0
  15. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_chat.png.meta +7 -0
  16. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_invite.png +0 -0
  17. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_invite.png.meta +7 -0
  18. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_unfollow.png +0 -0
  19. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_unfollow.png.meta +7 -0
  20. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light.meta +8 -0
  21. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_achievement.png +0 -0
  22. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_achievement.png.meta +7 -0
  23. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_achievement_platinum.png +0 -0
  24. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_achievement_platinum.png.meta +7 -0
  25. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_arrow.png +0 -0
  26. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_arrow.png.meta +7 -0
  27. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_close.png +0 -0
  28. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_close.png.meta +7 -0
  29. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_default_background.png +0 -0
  30. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_default_background.png.meta +7 -0
  31. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_logo.png +0 -0
  32. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_logo.png.meta +7 -0
  33. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile.meta +8 -0
  34. package/Plugins/iOS/XDCommonSDK.framework/Headers/NSError+XDG.h +1 -0
  35. package/Plugins/iOS/XDCommonSDK.framework/Headers/TDSGlobalRouterSchemes.h +2 -0
  36. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDConfigManager.h +1 -1
  37. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGAnnouncementConfig.h.meta +7 -0
  38. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGAnnouncementManager.h.meta +7 -0
  39. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGCloudLogHelper.h +4 -0
  40. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGConfig.h +2 -0
  41. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGInitParam.h +5 -0
  42. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDTapTapInfo.h +7 -1
  43. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDVersion.h +3 -3
  44. package/Plugins/iOS/XDCommonSDK.framework/Info.plist +0 -0
  45. package/Plugins/iOS/XDCommonSDK.framework/XDCommonSDK +0 -0
  46. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Headers/XDTapSDK4WrapperSDK-Swift.h +1 -1
  47. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Headers/XDTapSDK4WrapperSDK.h +3 -3
  48. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Info.plist +0 -0
  49. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Modules/XDTapSDK4WrapperSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  50. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Modules/XDTapSDK4WrapperSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  51. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Modules/XDTapSDK4WrapperSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  52. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/XDTapSDK4WrapperSDK +0 -0
  53. package/Resources/Prefabs/AccountCell.prefab +24 -15
  54. package/Resources/Prefabs/AgreementOptionAll.prefab +15 -9
  55. package/Resources/Prefabs/AgreementOptionNormal.prefab +16 -10
  56. package/Resources/Prefabs/AreaCodeCell.prefab +13 -8
  57. package/Resources/Prefabs/CancelAccountAlert.prefab +23 -23
  58. package/Resources/Prefabs/CenterErrorView.prefab +8 -8
  59. package/Resources/Prefabs/ConfirmDialog.prefab +20 -20
  60. package/Resources/Prefabs/DeleteAccountAlert.prefab +48 -45
  61. package/Resources/Prefabs/DeleteCell.prefab +6 -6
  62. package/Resources/Prefabs/Dialog.prefab +24 -24
  63. package/Resources/Prefabs/DisagreeConfirmAlert.prefab +15 -15
  64. package/Resources/Prefabs/GeneralAgreementAlert.prefab +53 -31
  65. package/Resources/Prefabs/LoadFailedView.prefab +12 -12
  66. package/Resources/Prefabs/LoadingView.prefab +9 -6
  67. package/Resources/Prefabs/PayHintAlert.prefab +17 -15
  68. package/Resources/Prefabs/PayLoadFailedView.prefab +13 -13
  69. package/Resources/Prefabs/PaymentAlert.prefab +9 -5
  70. package/Resources/Prefabs/SmallLoadingView.prefab +4 -4
  71. package/Resources/Prefabs/UserCenterAlert.prefab +76 -46
  72. package/Resources/Prefabs/XDCodeUnbindAlert.prefab +56 -34
  73. package/Resources/Prefabs/XDEmailAlert.prefab +84 -49
  74. package/Resources/Prefabs/XDPhoneAlertIO.prefab +129 -65
  75. package/Resources/Prefabs/XDPhoneNumberInputAlert.prefab +46 -28
  76. package/Resources/Prefabs/XDRiskControlAlert.prefab +12 -7
  77. package/Resources/Prefabs/XDSDKUI.prefab +3 -3
  78. package/Resources/Prefabs/XDVerifyCodeInputAlert.prefab +47 -28
  79. package/Resources/Prefabs/XDWebBridgeView.prefab +11 -11
  80. package/Resources/Prefabs/XDWebViewAlert.prefab +10 -10
  81. package/Resources/Shaders/UI/UI-Default-Gamma.shader +129 -0
  82. package/Resources/Shaders/UI/UI-Default-Gamma.shader.meta +9 -0
  83. package/Resources/Shaders/UI/UI_Default-Gamma.mat +36 -0
  84. package/Resources/Shaders/UI/UI_Default-Gamma.mat.meta +8 -0
  85. package/Resources/Shaders/UI/UI_Default-Mask.mat +36 -0
  86. package/Resources/Shaders/UI/UI_Default-Mask.mat.meta +8 -0
  87. package/Resources/Shaders/UI.meta +8 -0
  88. package/Resources/Shaders.meta +8 -0
  89. package/Runtime/Internal/Events/XDGEventBus.cs +140 -17
  90. package/Runtime/Internal/Mobile/CommonFeaturesImpl.cs +11 -10
  91. package/Runtime/Internal/Mobile/Http/CommonParamsInterceptor.cs +1 -1
  92. package/Runtime/Internal/Standalone/Agreement/AgreementModule.cs +4 -4
  93. package/Runtime/Internal/Standalone/CommonFeaturesImpl.cs +7 -5
  94. package/Runtime/Internal/Standalone/Config/AppConfig.cs +3 -1
  95. package/Runtime/Internal/Standalone/Config/ConfigModule.cs +5 -2
  96. package/Runtime/Internal/Standalone/Http/Interceptor/MacAuthenticationInterceptor.cs +7 -7
  97. package/Runtime/Internal/Standalone/Http/Interceptor/StandaloneErrorHandlingInterceptor.cs +5 -5
  98. package/Runtime/Internal/Standalone/Http/XDHttpUtils.cs +39 -16
  99. package/Runtime/Internal/Standalone/IPInfo/IPInfoModule.cs +42 -20
  100. package/Runtime/Internal/Standalone/IPInfo/XDGAreaCode.cs +1 -1
  101. package/Runtime/Internal/Standalone/Persistence/Persistence.cs +42 -22
  102. package/Runtime/Internal/Standalone/Steam/SteamUtils.cs +14 -7
  103. package/Runtime/Internal/Standalone/Track/AliyunTrack.cs +41 -34
  104. package/Runtime/Internal/Standalone/UI/Base/UIManager.cs +4 -3
  105. package/Runtime/Internal/Standalone/UI/Base/XDGCommonUIResources.cs +107 -0
  106. package/Runtime/Internal/Standalone/UI/Base/XDGCommonUIResources.cs.meta +11 -0
  107. package/Runtime/Internal/Standalone/UI/Controllers/CancelAccountAlert.cs +69 -33
  108. package/Runtime/Internal/Standalone/UI/Controllers/GeneralAgreementAlert.cs +29 -22
  109. package/Runtime/Internal/Standalone/UI/Controllers/XDWebViewAlert.cs +4 -5
  110. package/Runtime/Internal/Standalone/Utils/SteamWrapper.cs +2 -2
  111. package/Runtime/Internal/Standalone/Utils/TaskDispatcher.cs +1 -1
  112. package/Runtime/Internal/Standalone/Utils/WindowsRegistryAccess.cs +7 -7
  113. package/Runtime/Internal/Standalone/Web/Function/BackgroundColorWebFunction.cs +1 -1
  114. package/Runtime/Internal/Standalone/Web/Function/ClipboardWebFunction.cs +1 -1
  115. package/Runtime/Internal/Standalone/Web/Function/CloseWebFunction.cs +13 -4
  116. package/Runtime/Internal/Standalone/Web/Function/DeviceInfoWebFunction.cs +1 -1
  117. package/Runtime/Internal/Standalone/Web/Function/GameMessageWebFunction.cs +1 -1
  118. package/Runtime/Internal/Standalone/Web/Function/GetSafeAreaWebFunction.cs +1 -1
  119. package/Runtime/Internal/Standalone/Web/Function/GetStorageWebFunction.cs +1 -1
  120. package/Runtime/Internal/Standalone/Web/Function/HttpRequestWebFunction.cs +1 -1
  121. package/Runtime/Internal/Standalone/Web/Function/LoadingWebFunction.cs +1 -1
  122. package/Runtime/Internal/Standalone/Web/Function/LogWebFunction.cs +5 -5
  123. package/Runtime/Internal/Standalone/Web/Function/NavigationWebFunction.cs +1 -1
  124. package/Runtime/Internal/Standalone/Web/Function/OpenPageWebFunction.cs +1 -1
  125. package/Runtime/Internal/Standalone/Web/Function/PutStorageWebFunction.cs +1 -1
  126. package/Runtime/Internal/Standalone/Web/Function/ToastWebFunction.cs +1 -1
  127. package/Runtime/Internal/Standalone/Web/Function/TrackEventWebFunction.cs +1 -1
  128. package/Runtime/Internal/Standalone/Web/WebBridgeController.cs +6 -7
  129. package/Runtime/Internal/Standalone/Web/WebRequest.cs +3 -3
  130. package/Runtime/Internal/Standalone/Web/XDWebBridgeView.cs +1 -1
  131. package/Runtime/Internal/XDGCommonInternal.cs +1 -1
  132. package/package.json +2 -2
  133. package/Plugins/Android/libs/XDGBridgeCommon_v7_7.1.0.aar +0 -0
  134. package/Plugins/Android/libs/XDGCommon_7.1.0.aar +0 -0
  135. package/Plugins/Android/libs/XDGTapTapWrapperInternal_7.1.0.aar +0 -0
  136. package/Runtime/Internal/Core/ReflectionUtils.cs +0 -640
  137. package/Runtime/Internal/Core/ReflectionUtils.cs.meta +0 -3
  138. /package/Plugins/Android/libs/{XDGBridgeCommon_v7_7.1.0.aar.meta → XDGBridgeCommon_v7_7.2.0.aar.meta} +0 -0
  139. /package/Plugins/Android/libs/{XDGCommon_7.1.0.aar.meta → XDGCommon_7.2.0.aar.meta} +0 -0
  140. /package/Plugins/Android/libs/{XDGTapTapWrapperInternal_7.1.0.aar.meta → XDGTapTapWrapperInternal_7.2.0.aar.meta} +0 -0
  141. /package/Plugins/Android/libs/{XDTapTapWrapper_7.1.0.aar.meta → XDTapTapWrapper_7.2.0.aar.meta} +0 -0
@@ -0,0 +1,36 @@
1
+ %YAML 1.1
2
+ %TAG !u! tag:unity3d.com,2011:
3
+ --- !u!21 &2100000
4
+ Material:
5
+ serializedVersion: 6
6
+ m_ObjectHideFlags: 0
7
+ m_CorrespondingSourceObject: {fileID: 0}
8
+ m_PrefabInstance: {fileID: 0}
9
+ m_PrefabAsset: {fileID: 0}
10
+ m_Name: UI_Default-Gamma
11
+ m_Shader: {fileID: 4800000, guid: 09659b2e9120d6a4490f5e5a7f7619c0, type: 3}
12
+ m_ShaderKeywords:
13
+ m_LightmapFlags: 4
14
+ m_EnableInstancingVariants: 0
15
+ m_DoubleSidedGI: 0
16
+ m_CustomRenderQueue: -1
17
+ stringTagMap: {}
18
+ disabledShaderPasses: []
19
+ m_SavedProperties:
20
+ serializedVersion: 3
21
+ m_TexEnvs:
22
+ - _MainTex:
23
+ m_Texture: {fileID: 0}
24
+ m_Scale: {x: 1, y: 1}
25
+ m_Offset: {x: 0, y: 0}
26
+ m_Floats:
27
+ - _ColorMask: 15
28
+ - _Stencil: 0
29
+ - _StencilComp: 8
30
+ - _StencilOp: 0
31
+ - _StencilReadMask: 255
32
+ - _StencilWriteMask: 255
33
+ - _UseUIAlphaClip: 0
34
+ m_Colors:
35
+ - _Color: {r: 1, g: 1, b: 1, a: 1}
36
+ m_BuildTextureStacks: []
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: cb7e1a0e9ae57274b80858a808d7c9ba
3
+ NativeFormatImporter:
4
+ externalObjects: {}
5
+ mainObjectFileID: 2100000
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,36 @@
1
+ %YAML 1.1
2
+ %TAG !u! tag:unity3d.com,2011:
3
+ --- !u!21 &2100000
4
+ Material:
5
+ serializedVersion: 6
6
+ m_ObjectHideFlags: 0
7
+ m_CorrespondingSourceObject: {fileID: 0}
8
+ m_PrefabInstance: {fileID: 0}
9
+ m_PrefabAsset: {fileID: 0}
10
+ m_Name: UI_Default-Mask
11
+ m_Shader: {fileID: 4800000, guid: 09659b2e9120d6a4490f5e5a7f7619c0, type: 3}
12
+ m_ShaderKeywords:
13
+ m_LightmapFlags: 4
14
+ m_EnableInstancingVariants: 0
15
+ m_DoubleSidedGI: 0
16
+ m_CustomRenderQueue: -1
17
+ stringTagMap: {}
18
+ disabledShaderPasses: []
19
+ m_SavedProperties:
20
+ serializedVersion: 3
21
+ m_TexEnvs:
22
+ - _MainTex:
23
+ m_Texture: {fileID: 0}
24
+ m_Scale: {x: 1, y: 1}
25
+ m_Offset: {x: 0, y: 0}
26
+ m_Floats:
27
+ - _ColorMask: 15
28
+ - _Stencil: 1
29
+ - _StencilComp: 8
30
+ - _StencilOp: 3
31
+ - _StencilReadMask: 255
32
+ - _StencilWriteMask: 255
33
+ - _UseUIAlphaClip: 0
34
+ m_Colors:
35
+ - _Color: {r: 1, g: 1, b: 1, a: 1}
36
+ m_BuildTextureStacks: []
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: a950954ffa1698d4094aaf27b366d2b1
3
+ NativeFormatImporter:
4
+ externalObjects: {}
5
+ mainObjectFileID: 2100000
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: ec1f9b439431f0b48bef66f6de8c3c4a
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: ecee73b12a3c5984083e9dc5559a0a1a
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -2,9 +2,90 @@ using System;
2
2
  using System.Collections.Generic;
3
3
  using System.Threading.Tasks;
4
4
  using UnityEngine;
5
+ using XD.SDK.Common;
5
6
 
6
7
  namespace XD.SDK.Common.Internal.Events
7
8
  {
9
+ /// <summary>
10
+ /// 事件执行结果包装类,使用 XDGError 统一封装错误信息。
11
+ /// </summary>
12
+ /// <typeparam name="T">返回值类型</typeparam>
13
+ public class EventResult<T>
14
+ {
15
+ public bool IsSuccess { get; private set; }
16
+
17
+ public T Value { get; private set; }
18
+
19
+ /// <summary>
20
+ /// 业务错误信息(包含错误码、错误文案等)。
21
+ /// </summary>
22
+ public XDGError Error { get; private set; }
23
+
24
+ public string ErrorMessage
25
+ {
26
+ get { return Error != null ? Error.ErrorMsg : null; }
27
+ }
28
+
29
+ private EventResult(bool isSuccess, T value, XDGError error)
30
+ {
31
+ IsSuccess = isSuccess;
32
+ Value = value;
33
+ Error = error;
34
+ }
35
+
36
+ public static EventResult<T> Success(T value)
37
+ {
38
+ return new EventResult<T>(true, value, null);
39
+ }
40
+
41
+ public static EventResult<T> Failure(XDGError error)
42
+ {
43
+ return new EventResult<T>(false, default(T), error);
44
+ }
45
+
46
+ public static EventResult<T> Failure(Exception exception)
47
+ {
48
+ if (exception is XDGError xdError)
49
+ {
50
+ return Failure(xdError);
51
+ }
52
+
53
+ // 非 XDGError 的异常,统一包装成一个 UnknownError,detail 中保留原始异常信息
54
+ var wrapped = new XDGError(
55
+ code: ResponseCode.Common.Failed,
56
+ errorMsg: exception != null ? exception.Message : "Unknown error",
57
+ detail: exception != null ? exception.ToString() : null);
58
+
59
+ return Failure(wrapped);
60
+ }
61
+
62
+ public static EventResult<T> Failure(string errorMessage)
63
+ {
64
+ return Failure(new XDGError(errorMessage));
65
+ }
66
+
67
+ /// <summary>
68
+ /// 获取值,如果失败则抛出 XDGError。
69
+ /// </summary>
70
+ public T GetValueOrThrow()
71
+ {
72
+ if (!IsSuccess)
73
+ {
74
+ throw Error ?? new XDGError("Event execution failed.");
75
+ }
76
+
77
+ return Value;
78
+ }
79
+
80
+ /// <summary>
81
+ /// 获取值,如果失败则返回默认值。
82
+ /// </summary>
83
+ public T GetValueOrDefault(T defaultValue = default(T))
84
+ {
85
+ return IsSuccess ? Value : defaultValue;
86
+ }
87
+ }
88
+
8
89
  public static class XDGEventBus
9
90
  {
10
91
  private static readonly Dictionary<string, List<Func<object[], object>>> SyncHandlers = new Dictionary<string, List<Func<object[], object>>>();
@@ -31,29 +112,50 @@ namespace XD.SDK.Common.Internal.Events
31
112
  });
32
113
  }
33
114
 
34
- public static T Publish<T>(string eventName, params object[] args)
115
+ /// <summary>
116
+ /// 发布带返回值的同步事件,直接返回 EventResult(破坏性变更:原来返回 T)。
117
+ /// </summary>
118
+ public static EventResult<T> Publish<T>(string eventName, params object[] args)
35
119
  {
36
120
  if (SyncHandlers.TryGetValue(eventName, out var handlers) && handlers.Count > 0)
37
121
  {
38
122
  try
39
123
  {
40
124
  var result = handlers[0](args);
41
- return result is T ? (T)result : default(T);
125
+ var typedResult = result is T ? (T)result : default(T);
126
+ return EventResult<T>.Success(typedResult);
42
127
  }
43
128
  catch (Exception ex)
44
129
  {
45
- XDGLogger.Error($"[XDEventBus] Error publishing sync event {eventName}: {ex.Message}");
46
- return default(T);
130
+ XDGLogger.Error($"[XDEventBus] Error publishing sync event {eventName}: {ex}", XDGLoggerTag.Common);
131
+ return EventResult<T>.Failure(ex);
47
132
  }
48
133
  }
49
134
 
50
- XDGLogger.Debug($"[XDEventBus] No handler found for sync event: {eventName}");
51
- return default(T);
135
+ XDGLogger.Debug($"[XDEventBus] No handler found for sync event: {eventName}", XDGLoggerTag.Common);
136
+ return EventResult<T>.Failure($"No handler found for event: {eventName}");
52
137
  }
53
138
 
139
+ /// <summary>
140
+ /// 发布不关心返回值的同步事件,保持原有 fire-and-forget 行为。
141
+ /// </summary>
54
142
  public static void Publish(string eventName, params object[] args)
55
143
  {
56
- Publish<object>(eventName, args);
144
+ if (SyncHandlers.TryGetValue(eventName, out var handlers) && handlers.Count > 0)
145
+ {
146
+ try
147
+ {
148
+ handlers[0](args);
149
+ }
150
+ catch (Exception ex)
151
+ {
152
+ XDGLogger.Error($"[XDEventBus] Error publishing sync event {eventName}: {ex}", XDGLoggerTag.Common);
153
+ }
154
+ }
155
+ else
156
+ {
157
+ XDGLogger.Debug($"[XDEventBus] No handler found for sync event: {eventName}", XDGLoggerTag.Common);
158
+ }
57
159
  }
58
160
 
59
161
  #endregion
@@ -66,7 +168,7 @@ namespace XD.SDK.Common.Internal.Events
66
168
  AsyncHandlers[eventName] = new List<Func<object[], Task<object>>>();
67
169
 
68
170
  AsyncHandlers[eventName].Add(handler);
69
- XDGLogger.Debug($"[XDEventBus] Subscribed to async event: {eventName}");
171
+ XDGLogger.Debug($"[XDEventBus] Subscribed to async event: {eventName}", XDGLoggerTag.Common);
70
172
  }
71
173
 
72
174
  public static void SubscribeAsync(string eventName, Func<object[], Task> handler)
@@ -78,29 +180,50 @@ namespace XD.SDK.Common.Internal.Events
78
180
  });
79
181
  }
80
182
 
81
- public static async Task<T> PublishAsync<T>(string eventName, params object[] args)
183
+ /// <summary>
184
+ /// 发布带返回值的异步事件,直接返回 EventResult(破坏性变更:原来返回 Task&lt;T&gt;)。
185
+ /// </summary>
186
+ public static async Task<EventResult<T>> PublishAsync<T>(string eventName, params object[] args)
82
187
  {
83
188
  if (AsyncHandlers.TryGetValue(eventName, out var handlers) && handlers.Count > 0)
84
189
  {
85
190
  try
86
191
  {
87
192
  var result = await handlers[0](args);
88
- return result is T ? (T)result : default(T);
193
+ var typedResult = result is T ? (T)result : default(T);
194
+ return EventResult<T>.Success(typedResult);
89
195
  }
90
196
  catch (Exception ex)
91
197
  {
92
- XDGLogger.Error($"[XDEventBus] Error publishing async event {eventName}: {ex.Message}");
93
- return default(T);
198
+ XDGLogger.Warn($"[XDEventBus] Error publishing async event {eventName}: {ex}", XDGLoggerTag.Common);
199
+ return EventResult<T>.Failure(ex);
94
200
  }
95
201
  }
96
202
 
97
- XDGLogger.Debug($"[XDEventBus] No handler found for async event: {eventName}");
98
- return default(T);
203
+ XDGLogger.Debug($"[XDEventBus] No handler found for async event: {eventName}", XDGLoggerTag.Common);
204
+ return EventResult<T>.Failure($"No handler found for event: {eventName}");
99
205
  }
100
206
 
207
+ /// <summary>
208
+ /// 发布不关心返回值的异步事件,保持原有 fire-and-forget 行为。
209
+ /// </summary>
101
210
  public static async Task PublishAsync(string eventName, params object[] args)
102
211
  {
103
- await PublishAsync<object>(eventName, args);
212
+ if (AsyncHandlers.TryGetValue(eventName, out var handlers) && handlers.Count > 0)
213
+ {
214
+ try
215
+ {
216
+ await handlers[0](args);
217
+ }
218
+ catch (Exception ex)
219
+ {
220
+ XDGLogger.Error($"[XDEventBus] Error publishing async event {eventName}: {ex}", XDGLoggerTag.Common);
221
+ }
222
+ }
223
+ else
224
+ {
225
+ XDGLogger.Debug($"[XDEventBus] No handler found for async event: {eventName}", XDGLoggerTag.Common);
226
+ }
104
227
  }
105
228
 
106
229
  #endregion
@@ -116,14 +239,14 @@ namespace XD.SDK.Common.Internal.Events
116
239
  {
117
240
  SyncHandlers.Remove(eventName);
118
241
  AsyncHandlers.Remove(eventName);
119
- XDGLogger.Debug($"[XDEventBus] Unsubscribed from event: {eventName}");
242
+ XDGLogger.Debug($"[XDEventBus] Unsubscribed from event: {eventName}", XDGLoggerTag.Common);
120
243
  }
121
244
 
122
245
  public static void Clear()
123
246
  {
124
247
  SyncHandlers.Clear();
125
248
  AsyncHandlers.Clear();
126
- XDGLogger.Debug("[XDEventBus] Cleared all event handlers");
249
+ XDGLogger.Debug("[XDEventBus] Cleared all event handlers", XDGLoggerTag.Common);
127
250
  }
128
251
 
129
252
  #endregion
@@ -54,12 +54,12 @@ namespace XD.SDK.Common.Internal.Mobile
54
54
 
55
55
  EngineBridge.GetInstance().CallHandler(command, (result) =>
56
56
  {
57
- XDGLogger.Debug("===> Init XDG SDK result: " + result.ToJson());
57
+ XDGLogger.Debug("===> Init XDG SDK result: " + result.ToJson(), XDGLoggerTag.Bridge);
58
58
  var xdgError = result.Parse2XDGError();
59
59
  if (!XDGTool.CheckResultSuccess(result))
60
60
  {
61
61
  callback(false, xdgError?.ErrorMsg ?? "Init SDK Fail");
62
- XDGLogger.Error("初始化失败 result:" + result.ToJson());
62
+ XDGLogger.Error("初始化失败 result:" + result.ToJson(), XDGLoggerTag.Bridge);
63
63
  return;
64
64
  }
65
65
 
@@ -84,7 +84,7 @@ namespace XD.SDK.Common.Internal.Mobile
84
84
  #if UNITY_ANDROID
85
85
  using (var commonBridgeClass = new AndroidJavaClass(BridgeConstants.Common.BridgeStaticImpl))
86
86
  {
87
- config = commonBridgeClass.CallStatic<string>("getTapSDKConfig");
87
+ config = commonBridgeClass.CallStatic<string>("getTapSDKConfig");
88
88
  }
89
89
  #elif UNITY_IOS
90
90
  IntPtr ptr = XDCommonConfigs();
@@ -92,9 +92,10 @@ namespace XD.SDK.Common.Internal.Mobile
92
92
  #endif
93
93
  if (string.IsNullOrEmpty(config))
94
94
  {
95
- XDGLogger.Warn("[CommonFeature] get Mobile TapSDK Config Empty!");
95
+ XDGLogger.Warn("[CommonFeature] get Mobile TapSDK Config Empty!", XDGLoggerTag.Bridge);
96
96
  return;
97
97
  }
98
+
98
99
  MainThreadDispatcher.RunOnMainThread(() =>
99
100
  {
100
101
  var commonConfig = JsonConvert.DeserializeObject<CommonConfig>(config);
@@ -144,7 +145,7 @@ namespace XD.SDK.Common.Internal.Mobile
144
145
 
145
146
  public void SetLanguage(LangType langType)
146
147
  {
147
- XDGLogger.Debug("===> SetLanguage langType: " + langType);
148
+ XDGLogger.Debug("===> SetLanguage langType: " + langType, XDGLoggerTag.Bridge);
148
149
  var command = new Command.Builder()
149
150
  .Service(BridgeConstants.Common.BridgeName)
150
151
  .Method("setLanguage")
@@ -162,7 +163,7 @@ namespace XD.SDK.Common.Internal.Mobile
162
163
  .OnceTime(true)
163
164
  .CommandBuilder();
164
165
  EngineBridge.GetInstance().CallHandler(command);
165
- XDGLogger.Debug("===> StoreReview");
166
+ XDGLogger.Debug("===> StoreReview", XDGLoggerTag.Bridge);
166
167
  }
167
168
 
168
169
  public void TrackRole(XDGRoleInfo role)
@@ -186,7 +187,7 @@ namespace XD.SDK.Common.Internal.Mobile
186
187
  .OnceTime(true)
187
188
  .CommandBuilder();
188
189
  EngineBridge.GetInstance().CallHandler(command);
189
- XDGLogger.Debug($"===> TrackEvent: {eventName} {properties}");
190
+ XDGLogger.Debug($"===> TrackEvent: {eventName} {properties}", XDGLoggerTag.Bridge);
190
191
  }
191
192
 
192
193
  public void PreloadWebPage(string url)
@@ -202,7 +203,7 @@ namespace XD.SDK.Common.Internal.Mobile
202
203
 
203
204
  public void OpenWebPage(string url, Action<WebActionEnum, Dictionary<string, object>> callback)
204
205
  {
205
- XDGLogger.Debug("[unity 打开 Web Url:");
206
+ XDGLogger.Debug("[unity 打开 Web Url:", XDGLoggerTag.Bridge);
206
207
  var command = new Command.Builder()
207
208
  .Service(BridgeConstants.Common.BridgeName)
208
209
  .Method("openWebPage")
@@ -212,7 +213,7 @@ namespace XD.SDK.Common.Internal.Mobile
212
213
  .CommandBuilder();
213
214
  EngineBridge.GetInstance().CallHandler(command, result =>
214
215
  {
215
- XDGLogger.Debug("===> OpenWebPage: " + result.ToJson());
216
+ XDGLogger.Debug("===> OpenWebPage: " + result.ToJson(), XDGLoggerTag.Bridge);
216
217
  if (!XDGTool.CheckResultSuccess(result))
217
218
  {
218
219
  return;
@@ -290,7 +291,7 @@ namespace XD.SDK.Common.Internal.Mobile
290
291
  [DllImport("__Internal")]
291
292
  private static extern void XDCommonTargetCountryOrRegion(string countryOrRegion);
292
293
  #endif
293
-
294
+
294
295
  public void DisableAgreementUI()
295
296
  {
296
297
  #if UNITY_ANDROID
@@ -29,7 +29,7 @@ namespace XD.SDK.Common.Internal.Mobile
29
29
  }
30
30
  }
31
31
 
32
- XDGLogger.Debug($"[CommonParamsInterceptor] commParams:{JsonConvert.SerializeObject(request.QueryParams)}");
32
+ XDGLogger.Debug($"[CommonParamsInterceptor] commParams:{JsonConvert.SerializeObject(request.QueryParams)}", XDGLoggerTag.Http);
33
33
  }
34
34
  }
35
35
  }
@@ -80,14 +80,14 @@ namespace XD.SDK.Common.Internal.Standalone
80
80
  }
81
81
  catch (Exception e)
82
82
  {
83
- XDGLogger.Warn($"拉取最新协议失败 {e}");
83
+ XDGLogger.Warn($"拉取最新协议失败 {e}", XDGLoggerTag.Common);
84
84
  }
85
85
 
86
86
  if (_latestAgreement == null
87
87
  || string.IsNullOrEmpty(_latestAgreement.Title)
88
88
  || string.IsNullOrEmpty(_latestAgreement.TitleFirst))
89
89
  {
90
- XDGLogger.Warn("fetch agreement failed, try to get cache. ");
90
+ XDGLogger.Warn("fetch agreement failed, try to get cache. ", XDGLoggerTag.Common);
91
91
  // 服务端拉取失败,读取本地缓存
92
92
  _latestAgreement = await LatestAgreementPersistence.Load<Agreement>();
93
93
  }
@@ -96,7 +96,7 @@ namespace XD.SDK.Common.Internal.Standalone
96
96
  || string.IsNullOrEmpty(_latestAgreement.Title)
97
97
  || string.IsNullOrEmpty(_latestAgreement.TitleFirst))
98
98
  {
99
- XDGLogger.Warn("get cache failed, try to get local. ");
99
+ XDGLogger.Warn("get cache failed, try to get local. ", XDGLoggerTag.Common);
100
100
  _latestAgreement = await LoadLocalConfig();
101
101
  }
102
102
 
@@ -184,7 +184,7 @@ namespace XD.SDK.Common.Internal.Standalone
184
184
  currentRegion = "DF";
185
185
  }
186
186
 
187
- XDGLogger.Warn("get local config : " + currentRegion);
187
+ XDGLogger.Warn("get local config : " + currentRegion, XDGLoggerTag.Common);
188
188
 
189
189
  if (currentRegion.Equals("KR", StringComparison.OrdinalIgnoreCase))
190
190
  {
@@ -67,7 +67,7 @@ namespace XD.SDK.Common.Internal.Standalone
67
67
 
68
68
  public void StoreReview()
69
69
  {
70
- XDGLogger.Warn("Standalone not support StoreReview");
70
+ XDGLogger.Warn("Standalone not support StoreReview", XDGLoggerTag.Common);
71
71
  }
72
72
 
73
73
  public void TrackUser(string userId)
@@ -156,13 +156,13 @@ namespace XD.SDK.Common.Internal.Standalone
156
156
  {
157
157
  if (isIniting)
158
158
  {
159
- XDGLogger.Warn("正在初始化...");
159
+ XDGLogger.Warn("正在初始化...", XDGLoggerTag.Common);
160
160
  return;
161
161
  }
162
162
 
163
163
  if (isInited)
164
164
  {
165
- XDGLogger.Warn("已经初始化");
165
+ XDGLogger.Warn("已经初始化", XDGLoggerTag.Common);
166
166
  return;
167
167
  }
168
168
 
@@ -212,8 +212,9 @@ namespace XD.SDK.Common.Internal.Standalone
212
212
 
213
213
  await XDGEventBus.PublishAsync(XDGEvents.TapSDKInit,
214
214
  initParam.Lang.FormatToXDLangString(),
215
- initParam.PackageType);
216
-
215
+ initParam.PackageType,
216
+ JsonConvert.SerializeObject(initParam.DbProperties));
217
+
217
218
  XDGEventBus.Publish(XDGEvents.TdsSDKInit, tapConfig.ClientId,
218
219
  tapConfig.ClientToken,
219
220
  tapConfig.ServerUrl);
@@ -240,6 +241,7 @@ namespace XD.SDK.Common.Internal.Standalone
240
241
  {
241
242
  // ignore
242
243
  }
244
+
243
245
  if (!ConfigModule.DisableWebPreload)
244
246
  {
245
247
  WebRequest.Preload(ConfigModule.IsGlobal ? "https://poster.xd.com/r/versions.html" : "https://poster.xd.cn/r/versions.html");
@@ -55,6 +55,8 @@ namespace XD.SDK.Common.Internal.Standalone
55
55
 
56
56
  [JsonIgnore] public bool DisableWebPreload { get; set; }
57
57
 
58
+ [JsonIgnore] public Dictionary<string, object> DbProperties { get; set; }
59
+
58
60
  /// <summary>
59
61
  /// 判断是否为海外
60
62
  /// </summary>
@@ -64,7 +66,7 @@ namespace XD.SDK.Common.Internal.Standalone
64
66
  {
65
67
  #if UNITY_STANDALONE_WIN
66
68
  // win 环境 + packageType 为 tapPC + clientPublicKey 不为空
67
- XDGLogger.Debug($"UsingTapPC:{IsGlobal} pacakgeType:{PackageType} TapConfig:{TapConfig != null} !clientPublicKey:{!string.IsNullOrEmpty(TapConfig?.ClientPublicKey)}");
69
+ XDGLogger.Debug($"UsingTapPC:{IsGlobal} pacakgeType:{PackageType} TapConfig:{TapConfig != null} !clientPublicKey:{!string.IsNullOrEmpty(TapConfig?.ClientPublicKey)}",XDGLoggerTag.Common);
68
70
  return !IsGlobal && string.Equals(PackageType, XDGPackageType.PackageTypePCTapTap) && TapConfig != null && !string.IsNullOrEmpty(TapConfig.ClientPublicKey);
69
71
  #endif
70
72
  return false;
@@ -35,7 +35,7 @@ namespace XD.SDK.Common.Internal.Standalone
35
35
  private static string LoadConfigText()
36
36
  {
37
37
  #if UNITY_EDITOR
38
- var xdConfigFilePath = GetXDConfigPath(ConfigFile);
38
+ var xdConfigFilePath = GetXDConfigPath(ConfigFile);
39
39
  #else
40
40
  var xdConfigFilePath = Path.Combine(Application.streamingAssetsPath, $"{ConfigFile}.json");
41
41
  #endif
@@ -92,6 +92,7 @@ namespace XD.SDK.Common.Internal.Standalone
92
92
  var txtAsset = LoadConfigText();
93
93
  _appConfig = JsonConvert.DeserializeObject<AppConfig>(txtAsset);
94
94
  _appConfig.PackageType = param?.PackageType;
95
+ _appConfig.DbProperties = param?.DbProperties;
95
96
  if (string.IsNullOrEmpty(_appConfig.WebPayUrl))
96
97
  {
97
98
  _appConfig.WebPayUrl = _appConfig.IsGlobal ? "https://sdkpay.xd.com" : "https://sdkpay.xd.cn";
@@ -140,7 +141,7 @@ namespace XD.SDK.Common.Internal.Standalone
140
141
  }
141
142
  catch (Exception e)
142
143
  {
143
- XDGLogger.Warn($"拉取配置失败: {e}");
144
+ XDGLogger.Warn($"拉取配置失败: {e}", XDGLoggerTag.Common);
144
145
  config = await Persistence.Load<Config>();
145
146
  }
146
147
 
@@ -253,6 +254,8 @@ namespace XD.SDK.Common.Internal.Standalone
253
254
  public static bool CustomerDisable => _appConfig.CustomerDisable;
254
255
 
255
256
  public static bool DisableWebPreload => _appConfig.DisableWebPreload;
257
+
258
+ public static Dictionary<string, object> DbProperties => _appConfig.DbProperties;
256
259
  }
257
260
  }
258
261
  #endif
@@ -36,12 +36,12 @@ namespace XD.SDK.Common.Internal.Standalone.Http.Interceptor
36
36
  {
37
37
  try
38
38
  {
39
- var accessToken = await XDGEventBus.PublishAsync<XDGAccessToken>(XDGEvents.AccountGetAccessToken);
39
+ var accessTokenResult = await XDGEventBus.PublishAsync<XDGAccessToken>(XDGEvents.AccountGetAccessToken);
40
+ var accessToken = accessTokenResult.GetValueOrThrow();
40
41
  if (accessToken == null)
41
42
  {
42
43
  return null;
43
44
  }
44
-
45
45
  var uri = new Uri(url);
46
46
  var timeStr = ServerTime.GetTimestamp();
47
47
  var nonce = GetRandomStr(5);
@@ -54,12 +54,12 @@ namespace XD.SDK.Common.Internal.Standalone.Http.Interceptor
54
54
  var dataStr = $"{timeStr}\n{nonce}\n{md}\n{pathAndQuery}\n{domain}\n{port}\n";
55
55
  var mac = Base64WithSecret(accessToken.MacKey, dataStr);
56
56
  var authToken = $"MAC id=\"{accessToken.Kid}\",ts=\"{timeStr}\",nonce=\"{nonce}\",mac=\"{mac}\"";
57
-
57
+ XDGLogger.Debug($"generate MAC token: {authToken}", XDGLoggerTag.Http);
58
58
  return authToken;
59
59
  }
60
- catch (Exception ex)
60
+ catch (XDGError ex)
61
61
  {
62
- XDGLogger.Error($"Failed to generate MAC token: {ex.Message}");
62
+ XDGLogger.Error($"Failed to generate MAC token: {ex.ErrorMsg}", XDGLoggerTag.Http);
63
63
  return null;
64
64
  }
65
65
  }
@@ -68,7 +68,7 @@ namespace XD.SDK.Common.Internal.Standalone.Http.Interceptor
68
68
  {
69
69
  var sb = new StringBuilder();
70
70
  var random = new System.Random();
71
-
71
+
72
72
  for (int i = 0; i < length; i++)
73
73
  {
74
74
  sb.Append(LetterStr.Substring(random.Next(0, LetterStr.Length), 1));
@@ -89,4 +89,4 @@ namespace XD.SDK.Common.Internal.Standalone.Http.Interceptor
89
89
  }
90
90
  }
91
91
  }
92
- #endif
92
+ #endif
@@ -76,14 +76,14 @@ namespace XD.SDK.Common.Internal.Standalone.Http.Interceptor
76
76
  });
77
77
 
78
78
  UIManager.DismissLoading();
79
-
79
+
80
80
  // 等待用户交互完成
81
81
  await tcs.Task;
82
82
  }
83
83
  }
84
84
  catch (Exception ex)
85
85
  {
86
- XDGLogger.Error($"Failed to handle dialog error: {ex.Message}");
86
+ XDGLogger.Error($"Failed to handle dialog error: {ex.Message}", XDGLoggerTag.Http);
87
87
  }
88
88
  }
89
89
  }
@@ -100,7 +100,7 @@ namespace XD.SDK.Common.Internal.Standalone.Http.Interceptor
100
100
  {
101
101
  int httpStatusCode = (int)statusCode;
102
102
  string message = responseContent;
103
-
103
+
104
104
  try
105
105
  {
106
106
  // 尝试解析 LeanCloud 返回的错误信息
@@ -112,7 +112,7 @@ namespace XD.SDK.Common.Internal.Standalone.Http.Interceptor
112
112
  }
113
113
  catch (Exception ex)
114
114
  {
115
- XDGLogger.Debug($"Failed to parse error response: {ex}");
115
+ XDGLogger.Debug($"Failed to parse error response: {ex}", XDGLoggerTag.Http);
116
116
  }
117
117
 
118
118
  // 如果解析失败,创建基本的异常
@@ -120,4 +120,4 @@ namespace XD.SDK.Common.Internal.Standalone.Http.Interceptor
120
120
  }
121
121
  }
122
122
  }
123
- #endif
123
+ #endif