com.xd.sdk.common 7.3.1 → 7.3.2
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.
|
@@ -668,8 +668,26 @@ namespace XD.SDK.Common.Editor
|
|
|
668
668
|
UnityAppController.WriteBelow(@"AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);",
|
|
669
669
|
@" [XDGSDK application:app openURL:url options:options];");
|
|
670
670
|
UnityAppController.WriteBelow(@"AppController_SendNotificationWithArg(kUnityDidRegisterForRemoteNotificationsWithDeviceToken, deviceToken);", @" [XDGSDK application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];");
|
|
671
|
+
// 为 iOS 远程通知的 completion handler 添加一次性包装,避免多次调用
|
|
671
672
|
UnityAppController.WriteBelow(@"didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
|
|
672
|
-
{",
|
|
673
|
+
{",
|
|
674
|
+
@" __block BOOL hasCalledHandler = NO;
|
|
675
|
+
void (^safeHandler)(UIBackgroundFetchResult) = ^(UIBackgroundFetchResult result) {
|
|
676
|
+
if (!hasCalledHandler) {
|
|
677
|
+
hasCalledHandler = YES;
|
|
678
|
+
if (handler) {
|
|
679
|
+
handler(result);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
[XDGSDK application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:safeHandler];");
|
|
684
|
+
|
|
685
|
+
// 将后续直接调用 handler(...) 的代码替换为调用 safeHandler(...),确保只触发一次
|
|
686
|
+
UnityAppController.Replace(@" if (handler)
|
|
687
|
+
{
|
|
688
|
+
handler(UIBackgroundFetchResultNoData);
|
|
689
|
+
}",
|
|
690
|
+
@" safeHandler(UIBackgroundFetchResultNoData);");
|
|
673
691
|
if (CheckoutUniversalLinkHolder(unityAppControllerPath, @"NSURL* url = userActivity.webpageURL;"))
|
|
674
692
|
{
|
|
675
693
|
UnityAppController.WriteBelow(@"NSURL* url = userActivity.webpageURL;",
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.xd.sdk.common",
|
|
3
3
|
"displayName": "XDGSDK Common",
|
|
4
|
-
"version": "7.3.
|
|
4
|
+
"version": "7.3.2",
|
|
5
5
|
"description": "XDGSDK",
|
|
6
6
|
"unity": "2019.3",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"com.xd.sdk.foundation": "7.3.
|
|
9
|
+
"com.xd.sdk.foundation": "7.3.2"
|
|
10
10
|
}
|
|
11
11
|
}
|