com.xd.sdk.common 0.0.15-alpha → 0.0.16-alpha
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/Editor/XDGScriptHandlerProcessor.cs +2 -2
- package/Editor/iOS/XDGIOSCommonProcessor.cs +5 -5
- package/Plugins/Android/libs/XDGCommon_7.0.0.aar +0 -0
- package/Plugins/Android/libs/XDGCommon_7.0.0.aar.meta +30 -1
- package/Plugins/Android/libs/XDTapTapWrapper_7.0.0.aar +0 -0
- package/Plugins/Android/libs/XDTapTapWrapper_7.0.0.aar.meta +3 -0
- package/Plugins/iOS/XDCommonSDK.framework/Headers/XDCommonSDK.h +0 -1
- package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGTapSDK.h +0 -15
- package/Plugins/iOS/XDCommonSDK.framework/Headers/XDVersion.h +1 -1
- package/Plugins/iOS/XDCommonSDK.framework/XDCommonSDK +0 -0
- package/Plugins/iOS/XDCommonSDK.framework/XDResources.bundle/zh-Hant.lproj/Localizable.strings +3 -3
- package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Headers/XDTapSDK4WrapperSDK.h +1 -1
- package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/XDTapSDK4WrapperSDK +0 -0
- package/Runtime/Internal/Mobile/Bridge/BridgeAndroid.cs +0 -2
- package/Runtime/Internal/Mobile/Bridge/BridgeConstants.cs +1 -0
- package/Runtime/Internal/Mobile/Bridge/EngineBridge.cs +61 -26
- package/Runtime/Internal/Standalone/CommonFeaturesImpl.cs +4 -2
- package/package.json +2 -2
- package/Runtime/Internal/Standalone/Interfaces.meta +0 -8
|
@@ -36,7 +36,7 @@ namespace XD.SDK.Common.Editor
|
|
|
36
36
|
int beginIndex = all.IndexOf(below, StringComparison.Ordinal);
|
|
37
37
|
if (beginIndex == -1)
|
|
38
38
|
{
|
|
39
|
-
Debug.
|
|
39
|
+
Debug.LogError(filePath + "中没有找到字符串" + below);
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -72,7 +72,7 @@ namespace XD.SDK.Common.Editor
|
|
|
72
72
|
startIndex = all.IndexOf(start, startIndex + 1, StringComparison.Ordinal);
|
|
73
73
|
if (startIndex == -1)
|
|
74
74
|
{
|
|
75
|
-
Debug.
|
|
75
|
+
Debug.LogError(filePath + "中没有找到相邻的 start 和 end");
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -670,16 +670,16 @@ namespace XD.SDK.Common.Editor
|
|
|
670
670
|
UnityAppController.WriteBelow(@"#include <assert.h>", @"#import <XDCommonSDK/XDCommonSDK.h>");
|
|
671
671
|
|
|
672
672
|
UnityAppController.WriteBelow(@"applicationDidFinishLaunching",
|
|
673
|
-
@"
|
|
673
|
+
@" [XDGSDK application:application didFinishLaunchingWithOptions:launchOptions];");
|
|
674
674
|
UnityAppController.WriteBelow(@"AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);",
|
|
675
|
-
@"
|
|
675
|
+
@" [XDGSDK application:app openURL:url options:options];");
|
|
676
676
|
UnityAppController.WriteBelow(@"AppController_SendNotificationWithArg(kUnityDidRegisterForRemoteNotificationsWithDeviceToken, deviceToken);", @" [XDGSDK application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];");
|
|
677
|
-
UnityAppController.
|
|
678
|
-
|
|
677
|
+
UnityAppController.WriteBelow(@"didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
|
|
678
|
+
{"," [XDGSDK application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:handler];");
|
|
679
679
|
if (CheckoutUniversalLinkHolder(unityAppControllerPath, @"NSURL* url = userActivity.webpageURL;"))
|
|
680
680
|
{
|
|
681
681
|
UnityAppController.WriteBelow(@"NSURL* url = userActivity.webpageURL;",
|
|
682
|
-
@"
|
|
682
|
+
@" [XDGSDK application:application continueUserActivity:userActivity restorationHandler:restorationHandler];");
|
|
683
683
|
}
|
|
684
684
|
else
|
|
685
685
|
{
|
|
Binary file
|
|
@@ -1,3 +1,32 @@
|
|
|
1
1
|
fileFormatVersion: 2
|
|
2
2
|
guid: 0a0110a88bdc4305b920b6b058daaa09
|
|
3
|
-
|
|
3
|
+
PluginImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
iconMap: {}
|
|
7
|
+
executionOrder: {}
|
|
8
|
+
defineConstraints: []
|
|
9
|
+
isPreloaded: 0
|
|
10
|
+
isOverridable: 1
|
|
11
|
+
isExplicitlyReferenced: 0
|
|
12
|
+
validateReferences: 1
|
|
13
|
+
platformData:
|
|
14
|
+
- first:
|
|
15
|
+
Android: Android
|
|
16
|
+
second:
|
|
17
|
+
enabled: 1
|
|
18
|
+
settings: {}
|
|
19
|
+
- first:
|
|
20
|
+
Any:
|
|
21
|
+
second:
|
|
22
|
+
enabled: 0
|
|
23
|
+
settings: {}
|
|
24
|
+
- first:
|
|
25
|
+
Editor: Editor
|
|
26
|
+
second:
|
|
27
|
+
enabled: 0
|
|
28
|
+
settings:
|
|
29
|
+
DefaultValueInitialized: true
|
|
30
|
+
userData:
|
|
31
|
+
assetBundleName:
|
|
32
|
+
assetBundleVariant:
|
|
Binary file
|
|
@@ -34,21 +34,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
34
34
|
|
|
35
35
|
+ (BOOL)isPreApproved;
|
|
36
36
|
|
|
37
|
-
/// moment
|
|
38
|
-
+ (void)setMomentDelegate:(XDGCommonCodeMsgHandler)delegate;
|
|
39
|
-
|
|
40
|
-
+ (void)fetchMomentNotification;
|
|
41
|
-
|
|
42
|
-
+ (void)openMoment;
|
|
43
|
-
|
|
44
|
-
+ (void)openMomentWithScene:(NSString *)sceneId;
|
|
45
|
-
|
|
46
|
-
+ (void)closeMomentWithData:(NSDictionary *_Nullable)data;
|
|
47
|
-
|
|
48
|
-
+ (void)publishMomentWithData:(NSDictionary *)data;
|
|
49
|
-
|
|
50
|
-
+ (void)needDeferSystemGestures;
|
|
51
|
-
|
|
52
37
|
/// support
|
|
53
38
|
+ (void)openSupportWeb:(NSString *)url
|
|
54
39
|
viewController:(UIViewController *)viewController
|
|
Binary file
|
package/Plugins/iOS/XDCommonSDK.framework/XDResources.bundle/zh-Hant.lproj/Localizable.strings
CHANGED
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"tds_refund_login_restrict_title"= "暫時無法進入遊戲";
|
|
43
43
|
"tds_refund_login_restrict_sub_title"= "將所有退款訂單補款完成後即可進入遊戲";
|
|
44
44
|
"tds_refund_ios_pay_tip"= "您有剩餘退款訂單無法在此系統進行補款,需要使用iOS系統登錄遊戲後進行補款";
|
|
45
|
-
"tds_pay_success"= "
|
|
46
|
-
"tds_pay_fail"= "
|
|
45
|
+
"tds_pay_success"= "儲值成功";
|
|
46
|
+
"tds_pay_fail"= "儲值失敗";
|
|
47
47
|
"tds_pay_cancel"="已取消儲值";
|
|
48
48
|
"tds_button_confirm"= "確認";
|
|
49
49
|
"tds_promotion_exchange_title"= "領取商品";
|
|
50
50
|
"tds_promotion_exchange_desc"= "你已經擁有該商品 ,是否發放給本角色";
|
|
51
51
|
"tds_refund_android_pay_tip"= "您有剩餘退款訂單無法在此系統進行補款,需要使用Android系統登錄遊戲後進行補款";
|
|
52
|
-
"tds_pay_net_fail"= "
|
|
52
|
+
"tds_pay_net_fail"= "網路異常,儲值失敗";
|
|
53
53
|
"tds_refund_net_fail"= "網路異常,補款失敗";
|
|
54
54
|
"tds_purchase_processing"= "該訂單正在處理中,請稍後";
|
|
55
55
|
"tds_confirm_agreement"= "同意";
|
|
Binary file
|
|
@@ -109,8 +109,8 @@ namespace XD.SDK.Common.Internal.Mobile.Bridge
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
#if UNITY_IOS
|
|
112
|
-
[MonoPInvokeCallback(typeof(Action<string, string, string>))]
|
|
113
|
-
private static void CSharpFunctionHandler(string functionName, string jsonData, string callbackId)
|
|
112
|
+
[MonoPInvokeCallback(typeof(Action<string, string, string, bool>))]
|
|
113
|
+
private static void CSharpFunctionHandler(string functionName, string jsonData, string callbackId, bool onceTime)
|
|
114
114
|
{
|
|
115
115
|
MainThreadDispatcher.RunOnMainThread(() =>
|
|
116
116
|
{
|
|
@@ -118,21 +118,21 @@ namespace XD.SDK.Common.Internal.Mobile.Bridge
|
|
|
118
118
|
{
|
|
119
119
|
if (!string.IsNullOrEmpty(callbackId))
|
|
120
120
|
{
|
|
121
|
-
MainThreadDispatcher.RunOnMainThread(() =>
|
|
122
|
-
{
|
|
123
|
-
XDG_CompleteEngineCallback(callbackId, resultJson);
|
|
124
|
-
});
|
|
121
|
+
MainThreadDispatcher.RunOnMainThread(() => { XDG_CompleteEngineCallback(callbackId, resultJson, onceTime); });
|
|
125
122
|
}
|
|
126
123
|
});
|
|
127
124
|
});
|
|
128
125
|
}
|
|
129
126
|
|
|
130
127
|
[DllImport("__Internal")]
|
|
131
|
-
private static extern void XDG_RegisterEngineFunction(Action<string, string, string> handler);
|
|
128
|
+
private static extern void XDG_RegisterEngineFunction(Action<string, string, string, bool> handler);
|
|
129
|
+
|
|
130
|
+
[DllImport("__Internal")]
|
|
131
|
+
private static extern void XDG_CompleteEngineCallback(string callbackId, string result, bool onceTime);
|
|
132
132
|
|
|
133
133
|
[DllImport("__Internal")]
|
|
134
|
-
private static extern void
|
|
135
|
-
|
|
134
|
+
private static extern void XDG_CancelEngineCallback(string callbackId);
|
|
135
|
+
|
|
136
136
|
private void InitializeIOSEngineHandler()
|
|
137
137
|
{
|
|
138
138
|
try
|
|
@@ -146,12 +146,32 @@ namespace XD.SDK.Common.Internal.Mobile.Bridge
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
#endif
|
|
149
|
+
|
|
150
|
+
#if UNITY_IOS
|
|
151
|
+
public static void CancelEngineCallback(string callbackId)
|
|
152
|
+
{
|
|
153
|
+
if (string.IsNullOrEmpty(callbackId))
|
|
154
|
+
{
|
|
155
|
+
Debug.LogWarning("[EngineBridge] CancelEngineCallback called with empty callbackId");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
try
|
|
160
|
+
{
|
|
161
|
+
XDG_CancelEngineCallback(callbackId);
|
|
162
|
+
}
|
|
163
|
+
catch (Exception ex)
|
|
164
|
+
{
|
|
165
|
+
Debug.LogError($"[EngineBridge] CancelEngineCallback failed: {ex.Message}");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
#endif
|
|
149
169
|
public async void HandleEngineFunction(string functionName, string jsonData, Action<string> callback)
|
|
150
170
|
{
|
|
151
171
|
try
|
|
152
172
|
{
|
|
153
173
|
Debug.Log($"[EngineBridgeHelper] Handling function: {functionName} with data: {jsonData}");
|
|
154
|
-
|
|
174
|
+
|
|
155
175
|
EngineHandler handler;
|
|
156
176
|
lock (engineFunctions)
|
|
157
177
|
{
|
|
@@ -216,13 +236,13 @@ namespace XD.SDK.Common.Internal.Mobile.Bridge
|
|
|
216
236
|
|
|
217
237
|
if (!IsValidArguments(args))
|
|
218
238
|
{
|
|
219
|
-
Debug.LogError($"[AndroidEngineHandler] Invalid arguments count: {args?.Length ?? 0}, expected
|
|
239
|
+
Debug.LogError($"[AndroidEngineHandler] Invalid arguments count: {args?.Length ?? 0}, expected 4");
|
|
220
240
|
return null;
|
|
221
241
|
}
|
|
222
242
|
|
|
223
243
|
try
|
|
224
244
|
{
|
|
225
|
-
var (functionName, dataString, callback) = ExtractArguments(args);
|
|
245
|
+
var (functionName, dataString, callback, onceTime) = ExtractArguments(args);
|
|
226
246
|
|
|
227
247
|
if (string.IsNullOrEmpty(functionName))
|
|
228
248
|
{
|
|
@@ -231,7 +251,7 @@ namespace XD.SDK.Common.Internal.Mobile.Bridge
|
|
|
231
251
|
return null;
|
|
232
252
|
}
|
|
233
253
|
|
|
234
|
-
Debug.Log($"[AndroidEngineHandler] Calling engine function: {functionName} with data: {dataString}");
|
|
254
|
+
Debug.Log($"[AndroidEngineHandler] Calling engine function: {functionName} with data: {dataString}, onceTime={onceTime}");
|
|
235
255
|
|
|
236
256
|
// 使用主线程调度器确保HandleEngineFunction在主线程中执行
|
|
237
257
|
MainThreadDispatcher.RunOnMainThread(() =>
|
|
@@ -241,19 +261,12 @@ namespace XD.SDK.Common.Internal.Mobile.Bridge
|
|
|
241
261
|
try
|
|
242
262
|
{
|
|
243
263
|
Debug.Log($"[AndroidEngineHandler] Engine function result: {resultJson}");
|
|
244
|
-
|
|
245
|
-
MainThreadDispatcher.RunOnMainThread(() =>
|
|
246
|
-
{
|
|
247
|
-
InvokeCallback(callback, resultJson);
|
|
248
|
-
});
|
|
264
|
+
MainThreadDispatcher.RunOnMainThread(() => { InvokeCallback(callback, resultJson); });
|
|
249
265
|
}
|
|
250
266
|
catch (Exception ex)
|
|
251
267
|
{
|
|
252
268
|
Debug.LogError($"[AndroidEngineHandler] Callback invocation failed: {ex.Message}");
|
|
253
|
-
MainThreadDispatcher.RunOnMainThread(() =>
|
|
254
|
-
{
|
|
255
|
-
InvokeCallback(callback, $"Callback error: {ex.Message}");
|
|
256
|
-
});
|
|
269
|
+
MainThreadDispatcher.RunOnMainThread(() => { InvokeCallback(callback, $"Callback error: {ex.Message}"); });
|
|
257
270
|
}
|
|
258
271
|
});
|
|
259
272
|
});
|
|
@@ -275,7 +288,6 @@ namespace XD.SDK.Common.Internal.Mobile.Bridge
|
|
|
275
288
|
try
|
|
276
289
|
{
|
|
277
290
|
callback.Call(OnResultMethod, result);
|
|
278
|
-
Debug.Log($"[AndroidEngineHandler] Callback invoked successfully with result length: {result?.Length ?? 0}");
|
|
279
291
|
}
|
|
280
292
|
catch (Exception ex)
|
|
281
293
|
{
|
|
@@ -288,10 +300,33 @@ namespace XD.SDK.Common.Internal.Mobile.Bridge
|
|
|
288
300
|
}
|
|
289
301
|
}
|
|
290
302
|
|
|
291
|
-
private static bool IsValidArguments(object[] args) => args?.Length ==
|
|
303
|
+
private static bool IsValidArguments(object[] args) => args?.Length == 4;
|
|
304
|
+
|
|
305
|
+
private static (string functionName, string dataString, AndroidJavaObject callback, bool onceTime) ExtractArguments(object[] args)
|
|
306
|
+
{
|
|
307
|
+
var functionName = args[0] as string;
|
|
308
|
+
var dataString = args[1] as string;
|
|
309
|
+
bool onceTime = false;
|
|
310
|
+
AndroidJavaObject callback = null;
|
|
311
|
+
try
|
|
312
|
+
{
|
|
313
|
+
if (args[2] is bool b)
|
|
314
|
+
{
|
|
315
|
+
onceTime = b;
|
|
316
|
+
}
|
|
317
|
+
else if (args[2] is AndroidJavaObject jBool)
|
|
318
|
+
{
|
|
319
|
+
onceTime = jBool.Call<bool>("booleanValue");
|
|
320
|
+
}
|
|
292
321
|
|
|
293
|
-
|
|
294
|
-
|
|
322
|
+
callback = args[3] as AndroidJavaObject;
|
|
323
|
+
}
|
|
324
|
+
catch (Exception)
|
|
325
|
+
{
|
|
326
|
+
|
|
327
|
+
}
|
|
328
|
+
return (functionName, dataString, callback, onceTime);
|
|
329
|
+
}
|
|
295
330
|
}
|
|
296
331
|
}
|
|
297
332
|
}
|
|
@@ -206,13 +206,14 @@ namespace XD.SDK.Common.Internal.Standalone
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
private static void InitTap(XDGInitParam initParam)
|
|
209
|
+
private static async void InitTap(XDGInitParam initParam)
|
|
210
210
|
{
|
|
211
211
|
var tapConfig = ConfigModule.TapConfig;
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
await XDGEventBus.PublishAsync(XDGEvents.TapSDKInit,
|
|
214
214
|
tapConfig.ClientId,
|
|
215
215
|
tapConfig.ClientToken,
|
|
216
|
+
tapConfig.ClientPublicKey,
|
|
216
217
|
initParam.Lang.FormatToXDLangString(),
|
|
217
218
|
ConfigModule.IsGlobal,
|
|
218
219
|
true, // enableLog - TODO: 根据配置判断
|
|
@@ -223,6 +224,7 @@ namespace XD.SDK.Common.Internal.Standalone
|
|
|
223
224
|
XDGEventBus.Publish(XDGEvents.TdsSDKInit, tapConfig.ClientId,
|
|
224
225
|
tapConfig.ClientToken,
|
|
225
226
|
tapConfig.ServerUrl);
|
|
227
|
+
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
private static string GetChannel(string defaultChannel)
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.xd.sdk.common",
|
|
3
3
|
"displayName": "XDGSDK Common",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.16-alpha",
|
|
5
5
|
"description": "XDGSDK",
|
|
6
6
|
"unity": "2019.3",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"com.xd.sdk.foundation": "0.0.
|
|
9
|
+
"com.xd.sdk.foundation": "0.0.16-alpha"
|
|
10
10
|
}
|
|
11
11
|
}
|