com.xd.sdk.common 6.23.7 → 6.23.8

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 (32) hide show
  1. package/Mobile/Plugins/Android/com/xd/common/bridge/XDGCoreServiceUnity.java +7 -0
  2. package/Mobile/Plugins/Android/com/xd/common/bridge/XDGCoreServiceUnityImpl.java +35 -2
  3. package/Mobile/Plugins/iOS/XDGCoreServiceUnity.h +4 -0
  4. package/Mobile/Plugins/iOS/XDGCoreServiceUnity.m +27 -0
  5. package/Mobile/XDGCommonMobile.cs +11 -1
  6. package/Mobile/XDGCommonMobileImpl.cs +43 -0
  7. package/Plugins/Android/libs/XDGCommon_6.23.8.aar +0 -0
  8. package/Plugins/iOS/XDCommonSDK.framework/Headers/NSDictionary+XDG.h +1 -0
  9. package/Plugins/iOS/XDCommonSDK.framework/Headers/NSError+XDG.h +6 -0
  10. package/Plugins/iOS/XDCommonSDK.framework/Headers/NSString+TDSGlobalTools.h +9 -0
  11. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDCommonSDK.h +3 -0
  12. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGAccessToken.h +2 -0
  13. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGBridgeWeb.h +32 -0
  14. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGConfig.h +3 -1
  15. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGHttpUtils.h +3 -0
  16. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGLogger.h +10 -0
  17. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGSDK.h +16 -0
  18. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGUser.h +1 -0
  19. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGWebDefines.h +38 -0
  20. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGWebFunctionHolder.h +33 -0
  21. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGWebParams.h +27 -0
  22. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGWebRequest.h +22 -0
  23. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDVersion.h +3 -2
  24. package/Plugins/iOS/XDCommonSDK.framework/Info.plist +0 -0
  25. package/Plugins/iOS/XDCommonSDK.framework/XDCommonSDK +0 -0
  26. package/Runtime/Internal/IXDGCommon.cs +9 -4
  27. package/Runtime/Internal/XDWebAction.cs +8 -0
  28. package/Runtime/Internal/XDWebAction.cs.meta +3 -0
  29. package/Runtime/XDGCommon.cs +114 -52
  30. package/package.json +1 -1
  31. package/Plugins/Android/libs/XDGCommon_6.23.7.aar +0 -0
  32. /package/Plugins/Android/libs/{XDGCommon_6.23.7.aar.meta → XDGCommon_6.23.8.aar.meta} +0 -0
@@ -11,4 +11,11 @@ public interface XDGCoreServiceUnity extends IBridgeService {
11
11
 
12
12
  @BridgeMethod("validateWithCaptcha")
13
13
  void validateWithCaptcha(@BridgeParam("scene") String scene, BridgeCallback callback);
14
+
15
+ @BridgeMethod("openWebUrl")
16
+ void openWebUrl(@BridgeParam("url") String url,BridgeCallback callback);
17
+
18
+ @BridgeMethod("preloadUrl")
19
+ void preloadWebPage(@BridgeParam("preloadUrl") String url);
20
+
14
21
  }
@@ -1,17 +1,22 @@
1
1
  package com.xd.common.bridge;
2
2
 
3
3
  import android.util.Log;
4
+
4
5
  import androidx.annotation.NonNull;
5
6
  import androidx.annotation.Nullable;
7
+
6
8
  import com.tds.common.bridge.BridgeCallback;
7
9
  import com.tds.common.bridge.utils.BridgeJsonHelper;
8
10
  import com.unity3d.player.UnityPlayer;
9
11
  import com.xd.intl.common.XDGSDK;
10
12
  import com.xd.intl.common.base.XDGError;
11
13
  import com.xd.intl.common.callback.XDGCaptchaResultCallback;
14
+
12
15
  import java.util.HashMap;
13
16
  import java.util.Map;
14
17
 
18
+ import com.xd.intl.common.callback.WebActionCallback;
19
+
15
20
  public class XDGCoreServiceUnityImpl implements XDGCoreServiceUnity {
16
21
 
17
22
  private static final String TAG = XDGCoreServiceUnity.class.getSimpleName();
@@ -19,7 +24,7 @@ public class XDGCoreServiceUnityImpl implements XDGCoreServiceUnity {
19
24
  @Override
20
25
  public void validateWithCaptcha(String scene, BridgeCallback callback) {
21
26
  Log.i(TAG, "validateWithCaptcha");
22
- if (UnityPlayer.currentActivity == null){
27
+ if (UnityPlayer.currentActivity == null) {
23
28
  callback.onResult("");
24
29
  return;
25
30
  }
@@ -28,7 +33,7 @@ public class XDGCoreServiceUnityImpl implements XDGCoreServiceUnity {
28
33
  public void onResult(@NonNull String verifyResult, @Nullable XDGError xdgError) {
29
34
  Map<String, Object> resultParams = new HashMap<>();
30
35
  resultParams.put("token", verifyResult);
31
- if(xdgError != null){
36
+ if (xdgError != null) {
32
37
  resultParams.put("code", xdgError.getCode());
33
38
  resultParams.put("message", xdgError.getMessage());
34
39
  resultParams.put("extra", xdgError.getErrorDataMap());
@@ -37,4 +42,32 @@ public class XDGCoreServiceUnityImpl implements XDGCoreServiceUnity {
37
42
  }
38
43
  });
39
44
  }
45
+
46
+ @Override
47
+ public void openWebUrl(String url, BridgeCallback callback) {
48
+ Log.i(TAG, "openWebUrl");
49
+ if (UnityPlayer.currentActivity == null) {
50
+ callback.onResult("");
51
+ return;
52
+ }
53
+ XDGSDK.openWebPage(UnityPlayer.currentActivity, url, new WebActionCallback() {
54
+ @Override
55
+ public void onAction(int type, @Nullable Map<String, ?> map) {
56
+ HashMap<String, Object> maps = new HashMap<>();
57
+ maps.put("webActionType", type);
58
+ maps.put("data", BridgeJsonHelper.object2JsonString(map));
59
+ callback.onResult(BridgeJsonHelper.object2JsonString(maps));
60
+ }
61
+ });
62
+ }
63
+
64
+ @Override
65
+ public void preloadWebPage(String url) {
66
+ Log.i(TAG, "openWebUrl");
67
+ if (UnityPlayer.currentActivity == null) {
68
+ return;
69
+ }
70
+ XDGSDK.preloadWebPage(UnityPlayer.currentActivity,url);
71
+ }
72
+
40
73
  }
@@ -15,6 +15,10 @@ NS_ASSUME_NONNULL_BEGIN
15
15
  @interface XDGCoreServiceUnity : NSObject
16
16
  // validateWithCaptcha
17
17
  + (void)scene:(NSString *)scene bridgeCallback:(void (^)(NSString *result))callback;
18
+
19
+ + (void)url:(NSString *)url bridgeCallback:(void (^)(NSString *result))callback;
20
+
21
+ + (void)preloadUrl:(NSString *)url;
18
22
  @end
19
23
 
20
24
  NS_ASSUME_NONNULL_END
@@ -9,6 +9,9 @@
9
9
  #import <Foundation/Foundation.h>
10
10
  #import "XDCommonSDK/XDGSDK.h"
11
11
  #import <XDCommonSDK/NSDictionary+TDSGlobalJson.h>
12
+ #import <XDCommonSDK/XDGWebDefines.h>
13
+ #import <XDCommonSDK/XDGLogger.h>
14
+ #import <TapCommonSDK/TapCommonSDK.h>
12
15
 
13
16
  @implementation XDGCoreServiceUnity
14
17
  + (void)scene:(NSString *)scene bridgeCallback:(void (^)(NSString *))callback {
@@ -40,4 +43,28 @@
40
43
  callback(result.tdsglobal_jsonString);
41
44
  }];
42
45
  }
46
+
47
+ + (void) url:(NSString *)url bridgeCallback:(void (^)(NSString * _Nonnull))callback{
48
+ NSLog(@"[XDGCoreServiceUnity] openWebUrl");
49
+ [XDGSDK openWebPageWithURL:url handler:^(XDGWebAction actionType, NSDictionary * _Nullable data){
50
+ NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
51
+
52
+ NSInteger type = (int)actionType;
53
+ [dict setObject:[NSNumber numberWithInteger:type] forKey:@"webActionType"];
54
+ if (data != nil) {
55
+ NSString *string = [TDSBridgeTool jsonStringWithMutaDic:data];
56
+ [dict setObject:string forKey:@"data"];
57
+ }
58
+
59
+ NSDictionary *result = [dict copy];
60
+ [XDGLogger commonLog:result.tdsglobal_jsonString];
61
+ callback(result.tdsglobal_jsonString);
62
+ }];
63
+ }
64
+
65
+ + (void)preloadUrl:(NSString *)url {
66
+ NSLog(@"[XDGCoreServiceUnity] preloadUrl");
67
+ [XDGSDK preloadWebPageWithURL:url];
68
+ }
69
+
43
70
  @end
@@ -5,7 +5,7 @@ using System.Collections.Generic;
5
5
  using UnityEngine;
6
6
  #endif
7
7
 
8
- namespace XD.SDK.Common{
8
+ namespace XD.SDK.Common {
9
9
  public class XDGCommonMobile : IXDGCommon
10
10
  {
11
11
  public string UserId { get; set; }
@@ -130,6 +130,16 @@ namespace XD.SDK.Common{
130
130
  XDGCommonMobileImpl.GetInstance().SetExitHandler(onExitHandler);
131
131
  }
132
132
 
133
+ public void OpenWebPage(string url, Action<WebActionEnum, Dictionary<string, object>> callback)
134
+ {
135
+ XDGCommonMobileImpl.GetInstance().OpenWebPage(url, callback);
136
+ }
137
+
138
+ public void PreloadWebPage(string url)
139
+ {
140
+ XDGCommonMobileImpl.GetInstance().PreloadWebPage(url);
141
+ }
142
+
133
143
  private void SetGameActivity()
134
144
  {
135
145
  #if UNITY_ANDROID
@@ -564,5 +564,48 @@ namespace XD.SDK.Common{
564
564
  Debug.LogErrorFormat($"SetExitHandler遇到错误!\n{e.Message}\n{e.StackTrace}");
565
565
  }
566
566
  }
567
+
568
+ public void OpenWebPage(string url, Action<WebActionEnum, Dictionary<string, object>> callback)
569
+ {
570
+ try
571
+ {
572
+ XDGLogger.Debug("[unity 打开 Web Url:");
573
+ var command = new Command.Builder()
574
+ .Service(COMMON_MODULE_UNITY_BRIDGE_NAME_UNITY)
575
+ .Method("openWebUrl")
576
+ .Args("url", url)
577
+ .Callback(true)
578
+ .OnceTime(true)
579
+ .CommandBuilder();
580
+ EngineBridge.GetInstance().CallHandler(command, result => {
581
+ XDGLogger.Debug("===> OpenWebPage: " + result.ToJSON());
582
+ if (!checkResultSuccess(result)){
583
+ return;
584
+ }
585
+ var content = result.content;
586
+ var dicStrStr = TapTap.Common.Json.Deserialize(content);
587
+ var dic = dicStrStr as Dictionary<string, object>;
588
+ var actionType = SafeDictionary.GetValue<int>(dic, "webActionType");
589
+ var dataStr = SafeDictionary.GetValue<string>(dic, "data");
590
+ var dataDic = TapTap.Common.Json.Deserialize(dataStr) as Dictionary<string, object>;
591
+ callback?.Invoke((WebActionEnum) actionType, dataDic);
592
+ });
593
+ }
594
+ catch (Exception e)
595
+ {
596
+ Debug.LogErrorFormat($"OpenWebUrl遇到错误!\n{e.Message}\n{e.StackTrace}");
597
+ }
598
+ }
599
+ public void PreloadWebPage(string url)
600
+ {
601
+ var command = new Command.Builder()
602
+ .Service(COMMON_MODULE_UNITY_BRIDGE_NAME_UNITY)
603
+ .Method("preloadUrl")
604
+ .Args("preloadUrl",url)
605
+ .OnceTime(true)
606
+ .CommandBuilder();
607
+ EngineBridge.GetInstance().CallHandler(command);
608
+ }
609
+
567
610
  }
568
611
  }
@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
14
14
  - (BOOL)xdg_boolForKey:(NSString *)key;
15
15
  - (BOOL)xdg_boolForKey:(NSString *)key defaultValue:(BOOL)defaultValue;
16
16
  - (NSInteger)xdg_integerForKey:(NSString *)key;
17
+ - (NSInteger)xdg_integerForKey:(NSString *)key defaultValue:(NSInteger)defaultValue;
17
18
  - (NSDictionary *)xdg_dicForKey:(NSString *)key;
18
19
  - (NSString *)xdg_stringForKey:(NSString *)key;
19
20
  - (NSArray *)xdg_arrayForKey:(NSString *)key;
@@ -26,6 +26,12 @@ static const int XDGErrorCodeAuthTypeNotAvailable = 62001; // Current auth type
26
26
  + (NSError *)XDGErrorPaymentWithCode:(NSInteger)code description:(NSString *)description;
27
27
 
28
28
  + (NSError *)XDGErrorCommonWithCode:(NSInteger)code description:(NSString *)description;
29
+
30
+ + (NSError *)XDGErrorWithDomain:(NSString *)domain code:(NSInteger)code description:(NSString *_Nullable)description;
31
+
32
+ + (NSError *)XDGErrorWithDomain:(NSString *)domain code:(NSInteger)code description:(NSString *_Nullable)description detail:(NSString *_Nullable)detail extraData:(NSDictionary *_Nullable)extraMap;
33
+
34
+ - (NSDictionary *)toDictionary;
29
35
  @end
30
36
 
31
37
  NS_ASSUME_NONNULL_END
@@ -19,6 +19,15 @@ NS_ASSUME_NONNULL_BEGIN
19
19
  + (BOOL)isEmptyForXD:(NSString *)string;
20
20
 
21
21
  + (BOOL)semanticVer:(NSString *)first greaterThan:(NSString *)second;
22
+
23
+ /// 将字符串编码为 Base64
24
+ - (NSString *)base64EncodedString;
25
+
26
+ /// 解码 Base64 字符串
27
+ - (NSString *)base64DecodedString;
28
+
29
+ /// 解码 Base64,如果不是有效 Base64,则返回原始字符串
30
+ - (NSString *)decodeBase64OrReturnOriginal;
22
31
  @end
23
32
 
24
33
  NS_ASSUME_NONNULL_END
@@ -102,3 +102,6 @@ FOUNDATION_EXPORT const unsigned char XDCommonSDKVersionString[];
102
102
  #import <XDCommonSDK/XDGTapTapShareParam.h>
103
103
  #import <XDCommonSDK/XDGAgreementManager.h>
104
104
 
105
+ #import <XDCommonSDK/XDGWebParams.h>
106
+ #import <XDCommonSDK/XDGWebRequest.h>
107
+ #import <XDCommonSDK/XDGWebFunctionHolder.h>
@@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
27
27
 
28
28
  + (XDGAccessToken *)createTokenByDataDic:(NSDictionary *)dataDic;
29
29
 
30
+ - (NSDictionary *)toDictionary;
31
+
30
32
  @end
31
33
 
32
34
  NS_ASSUME_NONNULL_END
@@ -0,0 +1,32 @@
1
+ //
2
+ // XDGBridgeWeb.h
3
+ // XDCommonSDK
4
+ //
5
+ // Created by Fattycat on 2025/1/3.
6
+ //
7
+
8
+ #import <WebKit/WebKit.h>
9
+
10
+ #import <XDCommonSDK/XDGWebDefines.h>
11
+
12
+ NS_ASSUME_NONNULL_BEGIN
13
+
14
+ @interface XDGBridgeWeb : NSObject
15
+
16
+ @property (nonatomic, strong, readonly) WKWebView *webView;
17
+
18
+ @property (nonatomic, weak) id<XDGBridgeIWebController> controller;
19
+
20
+ @property (nonatomic, copy) XDGWebActionHandler webHandler;
21
+
22
+ - (instancetype)initWithDefault:(BOOL)isPreload;
23
+
24
+ - (void)loadUrl:(NSString *)urlString;
25
+
26
+ - (WKWebView *)getWebView;
27
+
28
+ - (void)dismiss;
29
+
30
+ @end
31
+
32
+ NS_ASSUME_NONNULL_END
@@ -96,8 +96,10 @@ typedef NS_ENUM(NSInteger, XDSDKRegionType) {
96
96
  @property (nonatomic, copy) NSString *numberAuthToken;
97
97
  /// 头条
98
98
  @property (nonatomic, assign) BOOL ttEnable;
99
- // Tap后置授权
99
+ /// Tap后置授权
100
100
  @property (nonatomic, assign) BOOL enableTapPostAuth;
101
+ /// WebView 白名单
102
+ @property (nonatomic, strong) NSArray *webWhiteList;
101
103
 
102
104
  - (BOOL)isCN;
103
105
 
@@ -10,6 +10,9 @@
10
10
  NS_ASSUME_NONNULL_BEGIN
11
11
 
12
12
  @interface XDGHttpUtils : NSObject
13
+ + (BOOL)isUrlValid:(NSString *)urlString;
14
+ + (BOOL)isFileUrl:(NSString *)urlString;
15
+ + (BOOL)isHttpUrl:(NSString *)urlString;
13
16
  + (NSString *)connectUrl:(NSString *)url params:(NSDictionary *)params;
14
17
  @end
15
18
 
@@ -23,8 +23,18 @@ typedef void (^XDGLoggerCallback) (NSString *content);
23
23
 
24
24
  + (void)commonSecureLog:(NSString *)content;
25
25
 
26
+ + (void)logWithTag:(NSString *)tag content:(NSString *)content;
27
+
28
+ + (void)logSecureWithTag:(NSString *)tag content:(NSString *)content;
29
+
30
+ + (void)logWithTag:(NSString *)tag content:(NSString *)content secure:(BOOL)secure;
31
+
26
32
  + (void)logWithTag:(NSString *)tag sdkVersion:(NSString *)sdkVersion content:(NSString *)content secure:(BOOL)secure;
27
33
 
34
+ + (void)logWithTag:(NSString *)tag content:(NSString *_Nullable)content secureContent:(NSString *_Nullable)secureContent;
35
+
36
+ + (void)logWithTag:(NSString *)tag sdkVersion:(NSString *)sdkVersion content:(NSString *_Nullable)content secureContent:(NSString *_Nullable)secureContent;
37
+
28
38
  + (void)submitCurrentConfig;
29
39
 
30
40
  @end
@@ -6,6 +6,7 @@
6
6
  #import <XDCommonSDK/XDConfigManager.h>
7
7
  #import <XDCommonSDK/XDGEntryType.h>
8
8
  #import <XDCommonSDK/XDGRegionInfo.h>
9
+ #import <XDCommonSDK/XDGWebRequest.h>
9
10
 
10
11
  NS_ASSUME_NONNULL_BEGIN
11
12
 
@@ -36,9 +37,24 @@ NS_ASSUME_NONNULL_BEGIN
36
37
  // 获取当前用户位置
37
38
  + (void)getRegionInfo:(void (^)(XDGRegionInfo *result))completeHandler;
38
39
 
40
+
41
+ /// 开始人机验证
42
+ /// - Parameters:
43
+ /// - scene: 场景 ID
44
+ /// - handler: 人机验证结果回调
39
45
  + (void)validateWithCaptcha:(NSString *)scene
40
46
  handler:(XDGCaptchaResultHandler)handler;
41
47
 
48
+ /// 预加载网页
49
+ /// - Parameter url: 网页 url
50
+ + (void)preloadWebPageWithURL:(NSString *)url;
51
+
52
+ /// 打开网页
53
+ /// - Parameters:
54
+ /// - url: 网页 url
55
+ /// - handler: 网页事件回调
56
+ + (void)openWebPageWithURL:(NSString *)url handler:(XDGWebActionHandler _Nullable)handler;
57
+
42
58
  #pragma mark -- traker
43
59
  /// 跟踪用户
44
60
  + (void)trackUser;
@@ -63,6 +63,7 @@ The user's token.
63
63
  token:(XDGAccessToken *)token
64
64
  pushServiceEnable:(BOOL)enable;
65
65
 
66
+ - (NSDictionary *)toDictionary;
66
67
  @end
67
68
 
68
69
  NS_ASSUME_NONNULL_END
@@ -0,0 +1,38 @@
1
+ //
2
+ // XDGWebDefines.h
3
+ // XDCommonSDK
4
+ //
5
+ // Created by Fattycat on 2025/1/6.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ NS_ASSUME_NONNULL_BEGIN
11
+
12
+ extern NSString *const XDGBridgeWebFunctionCloseButton;
13
+ extern NSString *const XDGBridgeWebFunctionNavigation;
14
+ extern NSString *const XDGBridgeWebFunctionBgColor;
15
+ extern NSString *const XDGBridgeWebFunctionClosePage;
16
+
17
+ @protocol XDGBridgeIWebController <NSObject>
18
+
19
+ - (void)handleJsBridge:(NSString *)functionName dataDic:(NSDictionary *)data;
20
+
21
+ - (void)hideLoading;
22
+
23
+ - (void)loadError;
24
+
25
+ @end
26
+
27
+ typedef NS_ENUM(NSInteger, XDGWebAction) {
28
+ XDGWebActionCloseWeb = 0, // 网页关闭
29
+ XDGWebActionMessage // 网页消息
30
+ };
31
+
32
+ typedef void (^XDGWebActionHandler)(XDGWebAction actionType, NSDictionary * _Nullable data);
33
+
34
+ @interface XDGWebDefines : NSObject
35
+
36
+ @end
37
+
38
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,33 @@
1
+ //
2
+ // XDGWebFunctionHolder.h
3
+ // XDCommonSDK
4
+ //
5
+ // Created by Fattycat on 2025/1/3.
6
+ //
7
+
8
+ #import <WebKit/WebKit.h>
9
+ #import <XDCommonSDK/XDGBridgeWeb.h>
10
+
11
+ NS_ASSUME_NONNULL_BEGIN
12
+
13
+ @protocol XDGWebFunctionBase <NSObject>
14
+
15
+ - (NSString *)getName;
16
+
17
+ - (void)handler:(XDGBridgeWeb *)webView data:(NSString *_Nullable)data callback:(void (^_Nullable)(NSDictionary *_Nullable result))callback;
18
+ @end
19
+
20
+ @interface XDGWebFunctionHolder : NSObject
21
+
22
+ + (NSArray *)getDefaultHandlers;
23
+
24
+ + (NSMutableDictionary *)generateWebBridgeResponseWithData:(id _Nullable)data;
25
+
26
+ + (NSMutableDictionary *)generateWebBridgeResponseWithErrorMsg:(NSString *_Nullable)message;
27
+
28
+ + (NSMutableDictionary *)generateWebBridgeResponseWithError:(NSError *_Nullable)error;
29
+
30
+ + (NSMutableDictionary *)generateWebBridgeResponse:(BOOL)success data:(id _Nullable)data message:(NSString *)message;
31
+ @end
32
+
33
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,27 @@
1
+ //
2
+ // XDGWebParams.h
3
+ // XDCommonSDK
4
+ //
5
+ // Created by Fattycat on 2025/1/3.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ #import <XDCommonSDK/XDGWebDefines.h>
11
+
12
+ NS_ASSUME_NONNULL_BEGIN
13
+
14
+ /// 背景颜色支持 RGBA 格式的 hex string
15
+ @interface XDGWebParams : NSObject
16
+ @property (nonatomic, strong, nullable) NSString *targetUrl;
17
+ @property (nonatomic, strong, nullable) NSString *backgroundColor;
18
+ @property (nonatomic, strong, nullable) NSString *navigationTitle;
19
+ @property (nonatomic, assign) BOOL showNavigationBar;
20
+ @property (nonatomic, assign) BOOL showCloseButton;
21
+ @property (nonatomic, assign) BOOL showLoading;
22
+ @property (nonatomic, copy) XDGWebActionHandler webHandler;
23
+
24
+ + (XDGWebParams *)paramsWithUrl:(NSString *)url;
25
+ @end
26
+
27
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,22 @@
1
+ //
2
+ // XDGWebRequest.h
3
+ // XDCommonSDK
4
+ //
5
+ // Created by Fattycat on 2025/1/3.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <XDCommonSDK/XDGWebParams.h>
10
+ #import <XDCommonSDK/XDGWebDefines.h>
11
+
12
+ NS_ASSUME_NONNULL_BEGIN
13
+
14
+ @interface XDGWebRequest : NSObject
15
+
16
+ + (void)preloadWebPageWithURL:(NSString *)url;
17
+
18
+ + (void)openWebPageWithURL:(NSString *)url handler:(XDGWebActionHandler _Nullable)handler;
19
+
20
+ @end
21
+
22
+ NS_ASSUME_NONNULL_END
@@ -5,5 +5,6 @@
5
5
  // Created by Fattycat on 2022/5/13.
6
6
  //
7
7
 
8
- #define XDSDK_VERSION @"6.23.3"
9
- // HASH 21aa09f1
8
+ #define XDSDK_VERSION @"6.23.8"
9
+ #define XDSDK_VERSION_CODE @"6023080"
10
+ // HASH 838231ea
@@ -11,7 +11,7 @@ namespace XD.SDK.Common
11
11
  void InitSDK(Action<bool, string> callback);
12
12
 
13
13
  void IsInitialized(Action<bool> callback);
14
-
14
+
15
15
  void SetLanguage(LangType langType);
16
16
 
17
17
  void Share(ShareFlavors shareFlavors, string uri, XDGShareCallback callback);
@@ -24,10 +24,10 @@ namespace XD.SDK.Common
24
24
 
25
25
  void TrackUser(string userId = null);
26
26
 
27
- void TrackEvent(string eventName, Dictionary<string,object> properties = null);
27
+ void TrackEvent(string eventName, Dictionary<string, object> properties = null);
28
28
 
29
29
  void EventCompletedTutorial();
30
-
30
+
31
31
  void EventCreateRole();
32
32
 
33
33
  void GetVersionName(Action<string> callback);
@@ -55,7 +55,12 @@ namespace XD.SDK.Common
55
55
  void ShowDetailAgreement(string agreementUrl);
56
56
 
57
57
  void SetExitHandler(Action onExitHandler);
58
+
59
+ void ValidateWithCaptcha(string scene, Dictionary<string, string> additionalQuery,
60
+ Action<string, XDGError> callback);
61
+
62
+ void OpenWebPage(string url, Action<WebActionEnum, Dictionary<string, object>> callback);
58
63
 
59
- void ValidateWithCaptcha(string scene, Dictionary<string, string> additionalQuery, Action<string, XDGError> callback);
64
+ void PreloadWebPage(string url);
60
65
  }
61
66
  }
@@ -0,0 +1,8 @@
1
+ namespace XD.SDK.Common
2
+ {
3
+ public enum WebActionEnum
4
+ {
5
+ CLOSE = 0,
6
+ MESSAGE
7
+ }
8
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: e77dead93cf04e3697c4fe69898d0bee
3
+ timeCreated: 1736841085
@@ -9,101 +9,136 @@ using XD.SDK.Common.Internal;
9
9
 
10
10
  [assembly: Preserve]
11
11
  [assembly: AlwaysLinkAssembly]
12
- namespace XD.SDK.Common{
12
+
13
+ namespace XD.SDK.Common
14
+ {
13
15
  public class XDGCommon
14
16
  {
15
17
  public static IXDGCommon platformWrapper;
16
18
 
17
- static XDGCommon()
19
+ static XDGCommon()
18
20
  {
19
21
  var interfaceType = typeof(IXDGCommon);
20
22
  var platformInterfaceType = AppDomain.CurrentDomain.GetAssemblies()
21
23
  .SelectMany(assembly => assembly.GetTypes())
22
- .FirstOrDefault(clazz => interfaceType.IsAssignableFrom(clazz)&& clazz.IsClass);
23
- if (platformInterfaceType != null) {
24
+ .FirstOrDefault(clazz => interfaceType.IsAssignableFrom(clazz) && clazz.IsClass);
25
+ if (platformInterfaceType != null)
26
+ {
24
27
  platformWrapper = Activator.CreateInstance(platformInterfaceType) as IXDGCommon;
25
28
  XDCommonHttpConfig.Init();
26
29
 
27
30
  XDConfigs.Init();
28
31
  }
29
- else
32
+ else
30
33
  {
31
- 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.");
34
+ TapLogger.Error(
35
+ $"No class implements {interfaceType} Type. Current Platform: {Application.platform}, if you are using Editor, please check if you have installed XDSDK pc module.");
32
36
  }
33
37
  }
34
-
35
- public static string UserId {
36
- get
37
- {
38
- return platformWrapper?.UserId;
39
- }
38
+
39
+ public static string UserId
40
+ {
41
+ get { return platformWrapper?.UserId; }
40
42
  set
41
43
  {
42
44
  if (platformWrapper != null)
43
45
  platformWrapper.UserId = value;
44
46
  }
45
47
  }
46
-
48
+
47
49
  public static void InitSDK(Action<bool, string> callback)
48
50
  {
49
51
  platformWrapper.InitSDK(callback);
50
52
  }
51
53
 
52
- public static void IsInitialized(Action<bool> callback){
54
+ public static void IsInitialized(Action<bool> callback)
55
+ {
53
56
  platformWrapper.IsInitialized(callback);
54
57
  }
55
58
 
56
- public static void SetLanguage(LangType langType){
59
+ public static void SetLanguage(LangType langType)
60
+ {
57
61
  platformWrapper.SetLanguage(langType);
58
62
 
59
63
  //设置 TapCommon
60
64
  TapLanguage tType = TapLanguage.AUTO;
61
- if (langType == LangType.ZH_CN) {
65
+ if (langType == LangType.ZH_CN)
66
+ {
62
67
  tType = TapLanguage.ZH_HANS;
63
- } else if (langType == LangType.ZH_TW) {
68
+ }
69
+ else if (langType == LangType.ZH_TW)
70
+ {
64
71
  tType = TapLanguage.ZH_HANT;
65
- } else if (langType == LangType.EN) {
72
+ }
73
+ else if (langType == LangType.EN)
74
+ {
66
75
  tType = TapLanguage.EN;
67
- } else if (langType == LangType.TH) {
76
+ }
77
+ else if (langType == LangType.TH)
78
+ {
68
79
  tType = TapLanguage.TH;
69
- } else if (langType == LangType.ID) {
80
+ }
81
+ else if (langType == LangType.ID)
82
+ {
70
83
  tType = TapLanguage.ID;
71
- } else if (langType == LangType.KR) {
84
+ }
85
+ else if (langType == LangType.KR)
86
+ {
72
87
  tType = TapLanguage.KO;
73
- } else if (langType == LangType.JP) {
88
+ }
89
+ else if (langType == LangType.JP)
90
+ {
74
91
  tType = TapLanguage.JA;
75
- } else if (langType == LangType.DE) {
92
+ }
93
+ else if (langType == LangType.DE)
94
+ {
76
95
  tType = TapLanguage.DE;
77
- } else if (langType == LangType.FR) {
96
+ }
97
+ else if (langType == LangType.FR)
98
+ {
78
99
  tType = TapLanguage.FR;
79
- } else if (langType == LangType.PT) {
100
+ }
101
+ else if (langType == LangType.PT)
102
+ {
80
103
  tType = TapLanguage.PT;
81
- } else if (langType == LangType.ES) {
104
+ }
105
+ else if (langType == LangType.ES)
106
+ {
82
107
  tType = TapLanguage.ES;
83
- } else if (langType == LangType.TR) {
108
+ }
109
+ else if (langType == LangType.TR)
110
+ {
84
111
  tType = TapLanguage.TR;
85
- } else if (langType == LangType.RU) {
112
+ }
113
+ else if (langType == LangType.RU)
114
+ {
86
115
  tType = TapLanguage.RU;
87
- } else if (langType == LangType.VI) {
116
+ }
117
+ else if (langType == LangType.VI)
118
+ {
88
119
  tType = TapLanguage.VI;
89
120
  }
90
121
 
91
122
  TapCommon.SetLanguage(tType);
92
123
  }
93
124
 
94
- public static void Share(ShareFlavors shareFlavors, string uri, XDGShareCallback callback){
125
+ public static void Share(ShareFlavors shareFlavors, string uri, XDGShareCallback callback)
126
+ {
95
127
  platformWrapper.Share(shareFlavors, uri, callback);
96
128
  }
97
129
 
98
- public static void Share(ShareFlavors shareFlavors, string uri, string message, XDGShareCallback callback){
130
+ public static void Share(ShareFlavors shareFlavors, string uri, string message, XDGShareCallback callback)
131
+ {
99
132
  platformWrapper.Share(shareFlavors, uri, message, callback);
100
133
  }
101
134
 
102
- public static void Report(string serverId, string roleId, string roleName){
135
+ public static void Report(string serverId, string roleId, string roleName)
136
+ {
103
137
  platformWrapper.Report(serverId, roleId, roleName);
104
138
  }
105
139
 
106
- public static void TrackRole(string serverId, string roleId, string roleName, int level){
140
+ public static void TrackRole(string serverId, string roleId, string roleName, int level)
141
+ {
107
142
  platformWrapper.TrackRole(serverId, roleId, roleName, level);
108
143
  }
109
144
 
@@ -113,67 +148,83 @@ namespace XD.SDK.Common{
113
148
  {
114
149
  userId = UserId;
115
150
  }
151
+
116
152
  platformWrapper.TrackUser(userId);
117
153
  }
118
154
 
119
- public static void TrackEvent(string eventName, Dictionary<string,object> properties = null){
155
+ public static void TrackEvent(string eventName, Dictionary<string, object> properties = null)
156
+ {
120
157
  platformWrapper.TrackEvent(eventName, properties);
121
158
  }
122
159
 
123
- public static void EventCompletedTutorial(){
160
+ public static void EventCompletedTutorial()
161
+ {
124
162
  platformWrapper.EventCompletedTutorial();
125
163
  }
126
164
 
127
- public static void EventCreateRole(){
165
+ public static void EventCreateRole()
166
+ {
128
167
  platformWrapper.EventCreateRole();
129
168
  }
130
169
 
131
- public static void GetVersionName(Action<string> callback){
170
+ public static void GetVersionName(Action<string> callback)
171
+ {
132
172
  platformWrapper.GetVersionName(callback);
133
173
  }
134
174
 
135
- public static void TrackAchievement(){
175
+ public static void TrackAchievement()
176
+ {
136
177
  platformWrapper.TrackAchievement();
137
178
  }
138
179
 
139
- public static void SetCurrentUserPushServiceEnable(bool enable){
180
+ public static void SetCurrentUserPushServiceEnable(bool enable)
181
+ {
140
182
  platformWrapper.SetCurrentUserPushServiceEnable(enable);
141
183
  }
142
184
 
143
- public static void IsCurrentUserPushServiceEnable(Action<bool> callback){
185
+ public static void IsCurrentUserPushServiceEnable(Action<bool> callback)
186
+ {
144
187
  platformWrapper.IsCurrentUserPushServiceEnable(callback);
145
188
  }
146
189
 
147
- public static void StoreReview(){
190
+ public static void StoreReview()
191
+ {
148
192
  platformWrapper.StoreReview();
149
193
  }
150
194
 
151
- public static void ShowLoading(){
195
+ public static void ShowLoading()
196
+ {
152
197
  platformWrapper.ShowLoading();
153
198
  }
154
199
 
155
- public static void HideLoading(){
200
+ public static void HideLoading()
201
+ {
156
202
  platformWrapper.HideLoading();
157
203
  }
158
204
 
159
- public static void GetRegionInfo(Action<XDGRegionInfoWrapper> callback){
205
+ public static void GetRegionInfo(Action<XDGRegionInfoWrapper> callback)
206
+ {
160
207
  platformWrapper.GetRegionInfo(callback);
161
208
  }
162
-
163
- public static void DisableAgreementUI(){
209
+
210
+ public static void DisableAgreementUI()
211
+ {
164
212
  platformWrapper.DisableAgreementUI();
165
213
  }
166
214
 
167
- public static void ReplaceChannelAndVersion(string channel, string gameVersion){
215
+ public static void ReplaceChannelAndVersion(string channel, string gameVersion)
216
+ {
168
217
  platformWrapper.ReplaceChannelAndVersion(channel, gameVersion);
169
218
  }
170
-
219
+
171
220
  [Obsolete("GetAgreementList Obsolete since XDGSDK 6.21.0 and return empty List")]
172
- public static void GetAgreementList(Action<List<XDGAgreement>> callback){
221
+ public static void GetAgreementList(Action<List<XDGAgreement>> callback)
222
+ {
173
223
  platformWrapper.GetAgreementList(callback);
174
224
  }
175
-
176
- public static void ShowDetailAgreement(string agreementUrl){
225
+
226
+ public static void ShowDetailAgreement(string agreementUrl)
227
+ {
177
228
  platformWrapper.ShowDetailAgreement(agreementUrl);
178
229
  }
179
230
 
@@ -182,8 +233,19 @@ namespace XD.SDK.Common{
182
233
  platformWrapper.SetExitHandler(onExitHandler);
183
234
  }
184
235
 
185
- public static void ValidateWithCaptcha(string scene, Action<string, XDGError> callback){
236
+ public static void ValidateWithCaptcha(string scene, Action<string, XDGError> callback)
237
+ {
186
238
  platformWrapper.ValidateWithCaptcha(scene, null, callback);
187
239
  }
240
+
241
+ public static void OpenWebPage(string url, Action<WebActionEnum, Dictionary<string, object>> callback)
242
+ {
243
+ platformWrapper.OpenWebPage(url, callback);
244
+ }
245
+
246
+ public static void PreloadWebPage(string url)
247
+ {
248
+ platformWrapper.PreloadWebPage(url);
249
+ }
188
250
  }
189
251
  }
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.23.7",
4
+ "version": "6.23.8",
5
5
  "description": "XDSDK",
6
6
  "unity": "2018.3",
7
7
  "license": "MIT",