com.xd.sdk.share 0.0.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.
- package/Editor/XD.SDK.Share.Editor.asmdef +17 -0
- package/Editor/XD.SDK.Share.Editor.asmdef.meta +7 -0
- package/Editor/XDShareProcessBuild.cs +17 -0
- package/Editor/XDShareProcessBuild.cs.meta +11 -0
- package/Editor.meta +8 -0
- package/Mobile/Editor/XD.SDK.Share.Mobile.Editor.asmdef +17 -0
- package/Mobile/Editor/XD.SDK.Share.Mobile.Editor.asmdef.meta +7 -0
- package/Mobile/Editor/XDShareMobileProcessBuild.cs +17 -0
- package/Mobile/Editor/XDShareMobileProcessBuild.cs.meta +11 -0
- package/Mobile/Editor.meta +8 -0
- package/Mobile/Plugins/Android/com/share/bridge/XDGShareBridge.java +17 -0
- package/Mobile/Plugins/Android/com/share/bridge/XDGShareBridge.java.meta +32 -0
- package/Mobile/Plugins/Android/com/share/bridge.meta +8 -0
- package/Mobile/Plugins/Android/com/share.meta +8 -0
- package/Mobile/Plugins/Android/com.meta +8 -0
- package/Mobile/Plugins/Android.meta +8 -0
- package/Mobile/Plugins/iOS/XDGShareBridge.m +13 -0
- package/Mobile/Plugins/iOS/XDGShareBridge.m.meta +37 -0
- package/Mobile/Plugins/iOS.meta +8 -0
- package/Mobile/Plugins.meta +8 -0
- package/Mobile/Runtime/ShareBridgeResponse.cs +17 -0
- package/Mobile/Runtime/ShareBridgeResponse.cs.meta +11 -0
- package/Mobile/Runtime/XD.SDK.Share.Mobile.asmdef +20 -0
- package/Mobile/Runtime/XD.SDK.Share.Mobile.asmdef.meta +7 -0
- package/Mobile/Runtime/XDGShareMobile.cs +88 -0
- package/Mobile/Runtime/XDGShareMobile.cs.meta +11 -0
- package/Mobile/Runtime.meta +8 -0
- package/Mobile.meta +8 -0
- package/Plugins/Android/libs/XDGSharing_6.21.1.aar +0 -0
- package/Plugins/Android/libs/XDGSharing_6.21.1.aar.meta +32 -0
- package/Plugins/Android/libs.meta +8 -0
- package/Plugins/Android.meta +8 -0
- package/Plugins.meta +8 -0
- package/README.md +0 -0
- package/README.md.meta +7 -0
- package/Runtime/Internal/IXDGSharePlatform.cs +7 -0
- package/Runtime/Internal/IXDGSharePlatform.cs.meta +11 -0
- package/Runtime/Internal.meta +8 -0
- package/Runtime/Public/XDGBaseShareParam.cs +39 -0
- package/Runtime/Public/XDGBaseShareParam.cs.meta +11 -0
- package/Runtime/Public/XDGDouYinShareParam.cs +19 -0
- package/Runtime/Public/XDGDouYinShareParam.cs.meta +11 -0
- package/Runtime/Public/XDGFacebookShareParam.cs +29 -0
- package/Runtime/Public/XDGFacebookShareParam.cs.meta +11 -0
- package/Runtime/Public/XDGLineShareParam.cs +19 -0
- package/Runtime/Public/XDGLineShareParam.cs.meta +11 -0
- package/Runtime/Public/XDGQQShareParam.cs +51 -0
- package/Runtime/Public/XDGQQShareParam.cs.meta +11 -0
- package/Runtime/Public/XDGShareCallback.cs +9 -0
- package/Runtime/Public/XDGShareCallback.cs.meta +11 -0
- package/Runtime/Public/XDGSharePlatformType.cs +14 -0
- package/Runtime/Public/XDGSharePlatformType.cs.meta +11 -0
- package/Runtime/Public/XDGSharing.cs +28 -0
- package/Runtime/Public/XDGSharing.cs.meta +11 -0
- package/Runtime/Public/XDGTapTapShareParam.cs +48 -0
- package/Runtime/Public/XDGTapTapShareParam.cs.meta +3 -0
- package/Runtime/Public/XDGTwitterShareParam.cs +19 -0
- package/Runtime/Public/XDGTwitterShareParam.cs.meta +11 -0
- package/Runtime/Public/XDGWeChatShareParam.cs +46 -0
- package/Runtime/Public/XDGWeChatShareParam.cs.meta +11 -0
- package/Runtime/Public/XDGWeiboShareParam.cs +40 -0
- package/Runtime/Public/XDGWeiboShareParam.cs.meta +11 -0
- package/Runtime/Public/XDGXHSShareParam.cs +24 -0
- package/Runtime/Public/XDGXHSShareParam.cs.meta +11 -0
- package/Runtime/Public.meta +8 -0
- package/Runtime/XD.SDK.Share.asmdef +3 -0
- package/Runtime/XD.SDK.Share.asmdef.meta +7 -0
- package/Runtime.meta +8 -0
- package/package.json +11 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "XD.SDK.Share.Editor",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:616cea76def2d4f059b94440fc8cc03d"
|
|
5
|
+
],
|
|
6
|
+
"includePlatforms": [
|
|
7
|
+
"Editor"
|
|
8
|
+
],
|
|
9
|
+
"excludePlatforms": [],
|
|
10
|
+
"allowUnsafeCode": false,
|
|
11
|
+
"overrideReferences": false,
|
|
12
|
+
"precompiledReferences": [],
|
|
13
|
+
"autoReferenced": true,
|
|
14
|
+
"defineConstraints": [],
|
|
15
|
+
"versionDefines": [],
|
|
16
|
+
"noEngineReferences": false
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using TapTap.Common.Editor;
|
|
3
|
+
using UnityEditor.Build.Reporting;
|
|
4
|
+
|
|
5
|
+
namespace XD.SDK.Share.Editor {
|
|
6
|
+
public class XDShareProcessBuild : SDKLinkProcessBuild {
|
|
7
|
+
public override int callbackOrder => 7;
|
|
8
|
+
|
|
9
|
+
public override string LinkPath => "XDSDK/Gen/Share/link.xml";
|
|
10
|
+
|
|
11
|
+
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
12
|
+
new LinkedAssembly { Fullname = "XD.SDK.Share" },
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
public override Func<BuildReport, bool> IsTargetPlatform => (report) => true;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/Editor.meta
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "XD.SDK.Share.Mobile.Editor",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:616cea76def2d4f059b94440fc8cc03d"
|
|
5
|
+
],
|
|
6
|
+
"includePlatforms": [
|
|
7
|
+
"Editor"
|
|
8
|
+
],
|
|
9
|
+
"excludePlatforms": [],
|
|
10
|
+
"allowUnsafeCode": false,
|
|
11
|
+
"overrideReferences": false,
|
|
12
|
+
"precompiledReferences": [],
|
|
13
|
+
"autoReferenced": true,
|
|
14
|
+
"defineConstraints": [],
|
|
15
|
+
"versionDefines": [],
|
|
16
|
+
"noEngineReferences": false
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using TapTap.Common.Editor;
|
|
3
|
+
using UnityEditor.Build.Reporting;
|
|
4
|
+
|
|
5
|
+
namespace XD.SDK.Share.Mobile.Editor {
|
|
6
|
+
public class XDShareMobileProcessBuild : SDKLinkProcessBuild {
|
|
7
|
+
public override int callbackOrder => 8;
|
|
8
|
+
|
|
9
|
+
public override string LinkPath => "XDSDK/Gen/Share/Mobile/link.xml";
|
|
10
|
+
|
|
11
|
+
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
12
|
+
new LinkedAssembly { Fullname = "XD.SDK.Share.Mobile" },
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
public override Func<BuildReport, bool> IsTargetPlatform => (report) => true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.xd.share.bridge;
|
|
2
|
+
|
|
3
|
+
import com.unity3d.player.UnityPlayer;
|
|
4
|
+
import com.xd.sharing.mix.XDGSharing;
|
|
5
|
+
import com.xd.sharing.mix.base.SharePlatformType;
|
|
6
|
+
import com.xd.sharing.mix.util.ShareInternalUtility;
|
|
7
|
+
|
|
8
|
+
public class XDGShareBridge {
|
|
9
|
+
public static boolean isAppInstalled(int platformType) {
|
|
10
|
+
SharePlatformType type = ShareInternalUtility.getSharePlatformByType(platformType);
|
|
11
|
+
if (type != null) {
|
|
12
|
+
return XDGSharing.isAppInstalled(UnityPlayer.currentActivity, type);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: eb9bc82ded485430bbaa06dc994f6c8f
|
|
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
|
+
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:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// XDGShareBridge.m
|
|
3
|
+
// Unity-iPhone
|
|
4
|
+
//
|
|
5
|
+
// Created by oneRain on 2024/2/5.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "XDCommonSDK/XDGSharingService.h"
|
|
10
|
+
|
|
11
|
+
const bool XDShareBridgeIsAppInstalled(int platformType) {
|
|
12
|
+
return [XDGSharingService isAppInstalled: [NSNumber numberWithInt:platformType]];
|
|
13
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 9362a1df2b02e46ea93c0b8c6fbe6d5c
|
|
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
|
+
iPhone: iOS
|
|
27
|
+
second:
|
|
28
|
+
enabled: 1
|
|
29
|
+
settings: {}
|
|
30
|
+
- first:
|
|
31
|
+
tvOS: tvOS
|
|
32
|
+
second:
|
|
33
|
+
enabled: 1
|
|
34
|
+
settings: {}
|
|
35
|
+
userData:
|
|
36
|
+
assetBundleName:
|
|
37
|
+
assetBundleVariant:
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using LC.Newtonsoft.Json;
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Share.Mobile {
|
|
4
|
+
public class ShareBridgeResponse {
|
|
5
|
+
[JsonProperty("code")]
|
|
6
|
+
public int Code { get; set; }
|
|
7
|
+
|
|
8
|
+
[JsonProperty("message")]
|
|
9
|
+
public string Message { get; set; }
|
|
10
|
+
|
|
11
|
+
[JsonIgnore]
|
|
12
|
+
public bool IsSuccess => Code == 0;
|
|
13
|
+
|
|
14
|
+
[JsonIgnore]
|
|
15
|
+
public bool IsCancelled => Code == 60010;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "XD.SDK.Share.Mobile",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:00d91cffc64e74f1bb6d5330a0f5caee",
|
|
5
|
+
"GUID:43c632eee0a6f42cdaf21080b154f3a1",
|
|
6
|
+
"GUID:271a06ab0780d4a5ea46c9c3be2ab5dc"
|
|
7
|
+
],
|
|
8
|
+
"includePlatforms": [
|
|
9
|
+
"Android",
|
|
10
|
+
"iOS"
|
|
11
|
+
],
|
|
12
|
+
"excludePlatforms": [],
|
|
13
|
+
"allowUnsafeCode": false,
|
|
14
|
+
"overrideReferences": false,
|
|
15
|
+
"precompiledReferences": [],
|
|
16
|
+
"autoReferenced": true,
|
|
17
|
+
"defineConstraints": [],
|
|
18
|
+
"versionDefines": [],
|
|
19
|
+
"noEngineReferences": false
|
|
20
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using System.Runtime.InteropServices;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using LC.Newtonsoft.Json;
|
|
6
|
+
using XD.SDK.Common;
|
|
7
|
+
using XD.SDK.Share.Internal;
|
|
8
|
+
using TapTap.Common;
|
|
9
|
+
|
|
10
|
+
namespace XD.SDK.Share.Mobile {
|
|
11
|
+
public class XDGShareMobile : IXDSharePlatform {
|
|
12
|
+
private static readonly string SHARE_SERVICE_NAME = "com.xd.sharing.mix.unitybridge.XDGSharingService";
|
|
13
|
+
private static readonly string SHARE_SERVICE_IMPL = "com.xd.sharing.mix.unitybridge.XDGSharingServiceImpl";
|
|
14
|
+
|
|
15
|
+
private static readonly string MOBILE_SHARE_SERVICE = "XDGSharingService";
|
|
16
|
+
|
|
17
|
+
public XDGShareMobile() {
|
|
18
|
+
EngineBridge.GetInstance()
|
|
19
|
+
.Register(SHARE_SERVICE_NAME, SHARE_SERVICE_IMPL);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public void Share(XDGBaseShareParam platformParam, XDGShareCallback callback) {
|
|
23
|
+
Dictionary<string, object> dict = platformParam.ToDictionary();
|
|
24
|
+
// 保证参数完整有序
|
|
25
|
+
Dictionary<string, object> args = new Dictionary<string, object> {
|
|
26
|
+
{ "shareWithType", dict.TryGetValue("shareWithType", out object shareWithType) ? shareWithType : 0 },
|
|
27
|
+
{ "scene", dict.TryGetValue("scene", out object scene) ? scene : 0 },
|
|
28
|
+
{ "contentText", dict.TryGetValue("contentText", out object contentText) ? contentText : string.Empty },
|
|
29
|
+
{ "videoUrl", dict.TryGetValue("videoUrl", out object videoUrl) ? videoUrl : string.Empty },
|
|
30
|
+
{ "imageUrl", dict.TryGetValue("imageUrl", out object imageUrl) ? imageUrl : string.Empty },
|
|
31
|
+
{ "imageData", dict.TryGetValue("imageData", out object imageData) ? imageData : string.Empty },
|
|
32
|
+
{ "title", dict.TryGetValue("title", out object title) ? title : string.Empty },
|
|
33
|
+
{ "linkUrl", dict.TryGetValue("linkUrl", out object linkUrl) ? linkUrl : string.Empty },
|
|
34
|
+
{ "linkTitle", dict.TryGetValue("linkTitle", out object linkTitle) ? linkTitle : string.Empty },
|
|
35
|
+
{ "linkSummary", dict.TryGetValue("linkSummary", out object linkSummary) ? linkSummary : string.Empty },
|
|
36
|
+
{ "linkThumbUri", dict.TryGetValue("linkThumbUri", out object linkThumbUri) ? linkThumbUri : string.Empty },
|
|
37
|
+
{ "linkThumbData", dict.TryGetValue("linkThumbData", out object linkThumbData) ? linkThumbData : string.Empty },
|
|
38
|
+
{ "superGroupName", dict.TryGetValue("superGroupName", out object superGroupName) ? superGroupName : string.Empty },
|
|
39
|
+
{ "superGroupSection", dict.TryGetValue("superGroupSection", out object superGroupSection) ? superGroupSection : string.Empty },
|
|
40
|
+
{ "superGroupExtras", dict.TryGetValue("superGroupExtras", out object superGroupExtras) ? superGroupExtras : string.Empty },
|
|
41
|
+
{ "tapAppId", dict.TryGetValue("tapAppId", out object tapAppId) ? tapAppId : string.Empty },
|
|
42
|
+
{ "tapGroupLabelId", dict.TryGetValue("tapGroupLabelId", out object tapGroupLabelId) ? tapGroupLabelId : string.Empty },
|
|
43
|
+
{ "tapHashtagIds", dict.TryGetValue("tapHashtagIds", out object tapHashtagIds) ? tapHashtagIds : string.Empty },
|
|
44
|
+
{ "failUrl", dict.TryGetValue("failUrl", out object failUrl) ? failUrl : string.Empty },
|
|
45
|
+
};
|
|
46
|
+
Command command = new Command.Builder()
|
|
47
|
+
.Service(MOBILE_SHARE_SERVICE)
|
|
48
|
+
.Method("shareWithType")
|
|
49
|
+
.Args(args)
|
|
50
|
+
.Callback(true)
|
|
51
|
+
.OnceTime(true)
|
|
52
|
+
.CommandBuilder();
|
|
53
|
+
|
|
54
|
+
EngineBridge.GetInstance().CallHandler(command, result => {
|
|
55
|
+
XDGLogger.Debug("Share 方法结果: " + result.ToJSON());
|
|
56
|
+
if (result.code == Result.RESULT_SUCCESS) {
|
|
57
|
+
ShareBridgeResponse response = JsonConvert.DeserializeObject<ShareBridgeResponse>(result.content);
|
|
58
|
+
if (response.IsSuccess) {
|
|
59
|
+
callback?.OnSuccess?.Invoke();
|
|
60
|
+
} else if (response.IsCancelled) {
|
|
61
|
+
callback?.OnCancel?.Invoke();
|
|
62
|
+
} else {
|
|
63
|
+
callback?.OnFailed?.Invoke(response.Code, response.Message);
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
callback?.OnFailed?.Invoke(result.code, result.message);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public bool IsAppInstalled(XDGSharePlatformType platformType) {
|
|
72
|
+
#if UNITY_ANDROID
|
|
73
|
+
using (AndroidJavaClass ShareBridgeClass = new AndroidJavaClass("com.xd.share.bridge.XDGShareBridge")) {
|
|
74
|
+
return ShareBridgeClass.CallStatic<bool>("isAppInstalled", (int)platformType);
|
|
75
|
+
}
|
|
76
|
+
#elif UNITY_IOS
|
|
77
|
+
return XDShareBridgeIsAppInstalled((int)platformType);
|
|
78
|
+
#else
|
|
79
|
+
return false;
|
|
80
|
+
#endif
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
#if UNITY_IOS
|
|
84
|
+
[DllImport("__Internal")]
|
|
85
|
+
private static extern bool XDShareBridgeIsAppInstalled(int platformType);
|
|
86
|
+
#endif
|
|
87
|
+
}
|
|
88
|
+
}
|
package/Mobile.meta
ADDED
|
Binary file
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 0eb47cdf004a44cc6907756fe778d07c
|
|
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
|
+
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:
|
package/Plugins.meta
ADDED
package/README.md
ADDED
|
File without changes
|
package/README.md.meta
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
|
|
4
|
+
namespace XD.SDK.Share {
|
|
5
|
+
public abstract class XDGBaseShareParam {
|
|
6
|
+
public string ContentText { get; set; }
|
|
7
|
+
|
|
8
|
+
public string ImageUrl { get; set; }
|
|
9
|
+
|
|
10
|
+
public byte[] ImageData { get; set; }
|
|
11
|
+
|
|
12
|
+
public abstract XDGSharePlatformType SharePlatformType { get; }
|
|
13
|
+
|
|
14
|
+
public virtual Dictionary<string, object> ToDictionary() {
|
|
15
|
+
Dictionary<string, object> dict = new Dictionary<string, object> {
|
|
16
|
+
{ "shareWithType", (int) SharePlatformType }
|
|
17
|
+
};
|
|
18
|
+
if (!string.IsNullOrWhiteSpace(ContentText)) {
|
|
19
|
+
dict["contentText"] = ContentText;
|
|
20
|
+
}
|
|
21
|
+
if (!string.IsNullOrWhiteSpace(ImageUrl)) {
|
|
22
|
+
dict["imageUrl"] = ImageUrl;
|
|
23
|
+
}
|
|
24
|
+
if (ImageData != null) {
|
|
25
|
+
dict["imageData"] = BytesToBase64(ImageData);
|
|
26
|
+
}
|
|
27
|
+
return dict;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
protected static string BytesToBase64(byte[] bytes) {
|
|
31
|
+
if (bytes == null) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
string base64String = Convert.ToBase64String(bytes);
|
|
36
|
+
return base64String;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Share {
|
|
4
|
+
public class XDGDouYinShareParam : XDGBaseShareParam {
|
|
5
|
+
public string VideoUrl { get; set; }
|
|
6
|
+
|
|
7
|
+
public override XDGSharePlatformType SharePlatformType => XDGSharePlatformType.DouYin;
|
|
8
|
+
|
|
9
|
+
public override Dictionary<string, object> ToDictionary() {
|
|
10
|
+
Dictionary<string, object> dict = base.ToDictionary();
|
|
11
|
+
|
|
12
|
+
if (!string.IsNullOrWhiteSpace(VideoUrl)) {
|
|
13
|
+
dict["videoUrl"] = VideoUrl;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return dict;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Share {
|
|
4
|
+
public class XDGFacebookShareParam : XDGBaseShareParam {
|
|
5
|
+
public string LinkUrl { get; set; }
|
|
6
|
+
|
|
7
|
+
public string LinkSummary { get; set; }
|
|
8
|
+
|
|
9
|
+
public string VideoUrl { get; set; }
|
|
10
|
+
|
|
11
|
+
public override XDGSharePlatformType SharePlatformType => XDGSharePlatformType.Facebook;
|
|
12
|
+
|
|
13
|
+
public override Dictionary<string, object> ToDictionary() {
|
|
14
|
+
Dictionary<string, object> dict = base.ToDictionary();
|
|
15
|
+
|
|
16
|
+
if (!string.IsNullOrWhiteSpace(LinkUrl)) {
|
|
17
|
+
dict["linkUrl"] = LinkUrl;
|
|
18
|
+
}
|
|
19
|
+
if (!string.IsNullOrWhiteSpace(LinkSummary)) {
|
|
20
|
+
dict["linkSummary"] = LinkSummary;
|
|
21
|
+
}
|
|
22
|
+
if (!string.IsNullOrWhiteSpace(VideoUrl)) {
|
|
23
|
+
dict["videoUrl"] = VideoUrl;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return dict;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Share {
|
|
4
|
+
public class XDGLineShareParam : XDGBaseShareParam {
|
|
5
|
+
public string LinkUrl { get; set; }
|
|
6
|
+
|
|
7
|
+
public override XDGSharePlatformType SharePlatformType => XDGSharePlatformType.Line;
|
|
8
|
+
|
|
9
|
+
public override Dictionary<string, object> ToDictionary() {
|
|
10
|
+
Dictionary<string, object> dict = base.ToDictionary();
|
|
11
|
+
|
|
12
|
+
if (!string.IsNullOrWhiteSpace(LinkUrl)) {
|
|
13
|
+
dict["linkUrl"] = LinkUrl;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return dict;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Share {
|
|
4
|
+
public class XDGQQShareParam : XDGBaseShareParam {
|
|
5
|
+
public static readonly int Session = 0;
|
|
6
|
+
public static readonly int Timeline = 1;
|
|
7
|
+
|
|
8
|
+
public string LinkTitle { get; set; }
|
|
9
|
+
|
|
10
|
+
public string LinkUrl { get; set; }
|
|
11
|
+
|
|
12
|
+
public string LinkSummary { get; set; }
|
|
13
|
+
|
|
14
|
+
public string LinkThumbUri { get; set; }
|
|
15
|
+
|
|
16
|
+
public byte[] LinkThumbData { get; set; }
|
|
17
|
+
|
|
18
|
+
public string VideoUrl { get; set; }
|
|
19
|
+
|
|
20
|
+
public int SceneType { get; set; }
|
|
21
|
+
|
|
22
|
+
public override XDGSharePlatformType SharePlatformType => XDGSharePlatformType.QQ;
|
|
23
|
+
|
|
24
|
+
public override Dictionary<string, object> ToDictionary() {
|
|
25
|
+
Dictionary<string, object> dict = base.ToDictionary();
|
|
26
|
+
|
|
27
|
+
if (!string.IsNullOrWhiteSpace(LinkTitle)) {
|
|
28
|
+
dict["linkTitle"] = LinkTitle;
|
|
29
|
+
}
|
|
30
|
+
if (!string.IsNullOrWhiteSpace(LinkUrl)) {
|
|
31
|
+
dict["linkUrl"] = LinkUrl;
|
|
32
|
+
}
|
|
33
|
+
if (!string.IsNullOrWhiteSpace(LinkSummary)) {
|
|
34
|
+
dict["linkSummary"] = LinkSummary;
|
|
35
|
+
}
|
|
36
|
+
if (!string.IsNullOrWhiteSpace(VideoUrl)) {
|
|
37
|
+
dict["videoUrl"] = VideoUrl;
|
|
38
|
+
}
|
|
39
|
+
if (!string.IsNullOrWhiteSpace(LinkThumbUri)) {
|
|
40
|
+
dict["linkThumbUri"] = LinkThumbUri;
|
|
41
|
+
}
|
|
42
|
+
if (LinkThumbData != null) {
|
|
43
|
+
dict["linkThumbData"] = BytesToBase64(LinkThumbData);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
dict["scene"] = SceneType;
|
|
47
|
+
|
|
48
|
+
return dict;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Linq;
|
|
3
|
+
using XD.SDK.Share.Internal;
|
|
4
|
+
|
|
5
|
+
namespace XD.SDK.Share {
|
|
6
|
+
public static class XDGSharing {
|
|
7
|
+
private static readonly IXDSharePlatform sharePlatform = null;
|
|
8
|
+
|
|
9
|
+
static XDGSharing() {
|
|
10
|
+
var interfaceType = typeof(IXDSharePlatform);
|
|
11
|
+
Type platformInterfaceType = AppDomain.CurrentDomain.GetAssemblies()
|
|
12
|
+
.Where(asssembly => asssembly.GetName().FullName.StartsWith("XD.SDK.Share"))
|
|
13
|
+
.SelectMany(assembly => assembly.GetTypes())
|
|
14
|
+
.SingleOrDefault(clazz => interfaceType.IsAssignableFrom(clazz) && clazz.IsClass);
|
|
15
|
+
if (platformInterfaceType != null) {
|
|
16
|
+
sharePlatform = Activator.CreateInstance(platformInterfaceType) as IXDSharePlatform;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public static void Share(XDGBaseShareParam shareParam, XDGShareCallback callback) {
|
|
21
|
+
sharePlatform?.Share(shareParam, callback);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public static bool IsAppInstalled(XDGSharePlatformType platformType) {
|
|
25
|
+
return sharePlatform?.IsAppInstalled(platformType) ?? false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Share
|
|
4
|
+
{
|
|
5
|
+
public class XDGTapTapShareParam : XDGBaseShareParam
|
|
6
|
+
{
|
|
7
|
+
public string AppId { get; set; }
|
|
8
|
+
|
|
9
|
+
public string GroupLabelId { get; set; }
|
|
10
|
+
|
|
11
|
+
public string HashtagIds { get; set; }
|
|
12
|
+
|
|
13
|
+
public string Title { get; set; }
|
|
14
|
+
|
|
15
|
+
public string FailUrl { get; set; }
|
|
16
|
+
public override XDGSharePlatformType SharePlatformType => XDGSharePlatformType.TapTap;
|
|
17
|
+
|
|
18
|
+
public override Dictionary<string, object> ToDictionary() {
|
|
19
|
+
Dictionary<string, object> dict = base.ToDictionary();
|
|
20
|
+
|
|
21
|
+
if (!string.IsNullOrWhiteSpace(AppId)) {
|
|
22
|
+
dict["tapAppId"] = AppId;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!string.IsNullOrWhiteSpace(GroupLabelId))
|
|
26
|
+
{
|
|
27
|
+
dict["tapGroupLabelId"] = GroupLabelId;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!string.IsNullOrWhiteSpace(HashtagIds))
|
|
31
|
+
{
|
|
32
|
+
dict["tapHashtagIds"] = HashtagIds;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!string.IsNullOrWhiteSpace(Title))
|
|
36
|
+
{
|
|
37
|
+
dict["title"] = Title;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!string.IsNullOrWhiteSpace(FailUrl))
|
|
41
|
+
{
|
|
42
|
+
dict["failUrl"] = FailUrl;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return dict;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Share {
|
|
4
|
+
public class XDGTwitterShareParam : XDGBaseShareParam {
|
|
5
|
+
public string LinkUrl { get; set; }
|
|
6
|
+
|
|
7
|
+
public override XDGSharePlatformType SharePlatformType => XDGSharePlatformType.Twitter;
|
|
8
|
+
|
|
9
|
+
public override Dictionary<string, object> ToDictionary() {
|
|
10
|
+
Dictionary<string, object> dict = base.ToDictionary();
|
|
11
|
+
|
|
12
|
+
if (!string.IsNullOrWhiteSpace(LinkUrl)) {
|
|
13
|
+
dict["linkUrl"] = LinkUrl;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return dict;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Share {
|
|
4
|
+
public class XDGWeChatShareParam : XDGBaseShareParam {
|
|
5
|
+
public static readonly int Session = 0;
|
|
6
|
+
public static readonly int Timeline = 1;
|
|
7
|
+
|
|
8
|
+
public string LinkTitle { get; set; }
|
|
9
|
+
|
|
10
|
+
public string LinkUrl { get; set; }
|
|
11
|
+
|
|
12
|
+
public string LinkSummary { get; set; }
|
|
13
|
+
|
|
14
|
+
public string LinkThumbUri { get; set; }
|
|
15
|
+
|
|
16
|
+
public byte[] LinkThumbData { get; set; }
|
|
17
|
+
|
|
18
|
+
public int SceneType { get; set; }
|
|
19
|
+
|
|
20
|
+
public override XDGSharePlatformType SharePlatformType => XDGSharePlatformType.WeChat;
|
|
21
|
+
|
|
22
|
+
public override Dictionary<string, object> ToDictionary() {
|
|
23
|
+
Dictionary<string, object> dict = base.ToDictionary();
|
|
24
|
+
|
|
25
|
+
if (!string.IsNullOrWhiteSpace(LinkTitle)) {
|
|
26
|
+
dict["linkTitle"] = LinkTitle;
|
|
27
|
+
}
|
|
28
|
+
if (!string.IsNullOrWhiteSpace(LinkUrl)) {
|
|
29
|
+
dict["linkUrl"] = LinkUrl;
|
|
30
|
+
}
|
|
31
|
+
if (!string.IsNullOrWhiteSpace(LinkSummary)) {
|
|
32
|
+
dict["linkSummary"] = LinkSummary;
|
|
33
|
+
}
|
|
34
|
+
if (!string.IsNullOrWhiteSpace(LinkThumbUri)) {
|
|
35
|
+
dict["linkThumbUri"] = LinkThumbUri;
|
|
36
|
+
}
|
|
37
|
+
if (LinkThumbData != null) {
|
|
38
|
+
dict["linkThumbData"] = BytesToBase64(LinkThumbData);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
dict["scene"] = SceneType;
|
|
42
|
+
|
|
43
|
+
return dict;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Share {
|
|
4
|
+
public class XDGWeiboShareParam : XDGBaseShareParam {
|
|
5
|
+
public string VideoUrl { get; set; }
|
|
6
|
+
|
|
7
|
+
public string SuperGroupName { get; set; }
|
|
8
|
+
|
|
9
|
+
public string SuperGroupSection { get; set; }
|
|
10
|
+
|
|
11
|
+
public string SuperGroupExtras { get; set; }
|
|
12
|
+
|
|
13
|
+
public override XDGSharePlatformType SharePlatformType => XDGSharePlatformType.Weibo;
|
|
14
|
+
|
|
15
|
+
public override Dictionary<string, object> ToDictionary() {
|
|
16
|
+
Dictionary<string, object> dict = base.ToDictionary();
|
|
17
|
+
|
|
18
|
+
if (!string.IsNullOrWhiteSpace(VideoUrl)) {
|
|
19
|
+
dict["videoUrl"] = VideoUrl;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!string.IsNullOrWhiteSpace(SuperGroupName))
|
|
23
|
+
{
|
|
24
|
+
dict["superGroupName"] = SuperGroupName;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!string.IsNullOrWhiteSpace(SuperGroupSection))
|
|
28
|
+
{
|
|
29
|
+
dict["superGroupSection"] = SuperGroupSection;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!string.IsNullOrWhiteSpace(SuperGroupExtras))
|
|
33
|
+
{
|
|
34
|
+
dict["superGroupExtras"] = SuperGroupExtras;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return dict;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Share {
|
|
4
|
+
public class XDGXHSShareParam : XDGBaseShareParam {
|
|
5
|
+
public string Title { get; set; }
|
|
6
|
+
|
|
7
|
+
public string VideoUrl { get; set; }
|
|
8
|
+
|
|
9
|
+
public override XDGSharePlatformType SharePlatformType => XDGSharePlatformType.XHS;
|
|
10
|
+
|
|
11
|
+
public override Dictionary<string, object> ToDictionary() {
|
|
12
|
+
Dictionary<string, object> dict = base.ToDictionary();
|
|
13
|
+
|
|
14
|
+
if (!string.IsNullOrWhiteSpace(Title)) {
|
|
15
|
+
dict["title"] = Title;
|
|
16
|
+
}
|
|
17
|
+
if (!string.IsNullOrWhiteSpace(VideoUrl)) {
|
|
18
|
+
dict["videoUrl"] = VideoUrl;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return dict;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
package/Runtime.meta
ADDED
package/package.json
ADDED