com.taptap.sdk.compliance 4.3.0-aplha.5
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/Mobile/Editor/NativeDependencies.xml +18 -0
- package/Mobile/Editor/NativeDependencies.xml.meta +7 -0
- package/Mobile/Editor/TapComplianceMobileProcessBuild.cs +21 -0
- package/Mobile/Editor/TapComplianceMobileProcessBuild.cs.meta +3 -0
- package/Mobile/Editor/TapSDK.Compliance.Mobile.Editor.asmdef +17 -0
- package/Mobile/Editor/TapSDK.Compliance.Mobile.Editor.asmdef.meta +7 -0
- package/Mobile/Editor/iOS/BuidPostProcessor.cs +45 -0
- package/Mobile/Editor/iOS/BuidPostProcessor.cs.meta +11 -0
- package/Mobile/Editor/iOS.meta +8 -0
- package/Mobile/Editor.meta +8 -0
- package/Mobile/Runtime/ComplianceMobileBridge.cs +319 -0
- package/Mobile/Runtime/ComplianceMobileBridge.cs.meta +11 -0
- package/Mobile/Runtime/ComplianceMobileOldJob.cs +81 -0
- package/Mobile/Runtime/ComplianceMobileOldJob.cs.meta +11 -0
- package/Mobile/Runtime/TapSDK.Compliance.Mobile.Runtime.asmdef +19 -0
- package/Mobile/Runtime/TapSDK.Compliance.Mobile.Runtime.asmdef.meta +7 -0
- package/Mobile/Runtime.meta +3 -0
- package/Mobile.meta +8 -0
- package/Resources/BillingMode.json +1 -0
- package/Resources/BillingMode.json.meta +7 -0
- package/Resources/Config/ComplianceLocalization.json +116 -0
- package/Resources/Config/ComplianceLocalization.json.meta +7 -0
- package/Resources/Config.meta +8 -0
- package/Resources/Prefabs/Mobile/TapTapAntiAddictionRetryAlert.prefab +803 -0
- package/Resources/Prefabs/Mobile/TapTapAntiAddictionRetryAlert.prefab.meta +7 -0
- package/Resources/Prefabs/Mobile/TapTapHealthPaymentPanel.prefab +820 -0
- package/Resources/Prefabs/Mobile/TapTapHealthPaymentPanel.prefab.meta +7 -0
- package/Resources/Prefabs/Mobile/TapTapHealthReminderPanel.prefab +988 -0
- package/Resources/Prefabs/Mobile/TapTapHealthReminderPanel.prefab.meta +7 -0
- package/Resources/Prefabs/Mobile/TapTapVietnamTimeSelectorPanel.prefab +3176 -0
- package/Resources/Prefabs/Mobile/TapTapVietnamTimeSelectorPanel.prefab.meta +7 -0
- package/Resources/Prefabs/Mobile.meta +8 -0
- package/Resources/Prefabs.meta +8 -0
- package/Resources/Textures/Background.png +0 -0
- package/Resources/Textures/Background.png.meta +128 -0
- package/Resources/Textures/Button.png +0 -0
- package/Resources/Textures/Button.png.meta +128 -0
- package/Resources/Textures/Checkmark.png +0 -0
- package/Resources/Textures/Checkmark.png.meta +128 -0
- package/Resources/Textures/Dropdown.png +0 -0
- package/Resources/Textures/Dropdown.png.meta +128 -0
- package/Resources/Textures/DropdownH.png +0 -0
- package/Resources/Textures/DropdownH.png.meta +128 -0
- package/Resources/Textures/Loading.png +0 -0
- package/Resources/Textures/Loading.png.meta +128 -0
- package/Resources/Textures/On.png +0 -0
- package/Resources/Textures/On.png.meta +128 -0
- package/Resources/Textures/Scrollview.png +0 -0
- package/Resources/Textures/Scrollview.png.meta +128 -0
- package/Resources/Textures/WhiteButton.png +0 -0
- package/Resources/Textures/WhiteButton.png.meta +128 -0
- package/Resources/Textures/error_tip.png +0 -0
- package/Resources/Textures/error_tip.png.meta +128 -0
- package/Resources/Textures/off.png +0 -0
- package/Resources/Textures/off.png.meta +128 -0
- package/Resources/Textures/taptap-antiaddiction-input.png +0 -0
- package/Resources/Textures/taptap-antiaddiction-input.png.meta +128 -0
- package/Resources/Textures/taptap-antiaddiction-largebutton.png +0 -0
- package/Resources/Textures/taptap-antiaddiction-largebutton.png.meta +128 -0
- package/Resources/Textures/taptap-antiaddiction-mobile-button.png +0 -0
- package/Resources/Textures/taptap-antiaddiction-mobile-button.png.meta +128 -0
- package/Resources/Textures.meta +8 -0
- package/Resources.meta +8 -0
- package/Runtime/Internal/ComplianceJobManager.cs +85 -0
- package/Runtime/Internal/ComplianceJobManager.cs.meta +11 -0
- package/Runtime/Internal/ComplianceResult.cs +89 -0
- package/Runtime/Internal/ComplianceResult.cs.meta +3 -0
- package/Runtime/Internal/IComplianceJob.cs +51 -0
- package/Runtime/Internal/IComplianceJob.cs.meta +11 -0
- package/Runtime/Internal/Init/ComplianceInitTask.cs +46 -0
- package/Runtime/Internal/Init/ComplianceInitTask.cs.meta +3 -0
- package/Runtime/Internal/Init.meta +3 -0
- package/Runtime/Internal/Model/StartUpResult.cs +28 -0
- package/Runtime/Internal/Model/StartUpResult.cs.meta +11 -0
- package/Runtime/Internal/Model.meta +8 -0
- package/Runtime/Internal.meta +8 -0
- package/Runtime/Public/TapTapCompliance.cs +119 -0
- package/Runtime/Public/TapTapCompliance.cs.meta +11 -0
- package/Runtime/Public/TapTapComplianceOption.cs +52 -0
- package/Runtime/Public/TapTapComplianceOption.cs.meta +3 -0
- package/Runtime/Public.meta +3 -0
- package/Runtime/TapSDK.Compliance.Runtime.asmdef +16 -0
- package/Runtime/TapSDK.Compliance.Runtime.asmdef.meta +7 -0
- package/Runtime.meta +3 -0
- package/Standalone/Editor/TapComplianceStandaloneProcessBuild.cs +20 -0
- package/Standalone/Editor/TapComplianceStandaloneProcessBuild.cs.meta +3 -0
- package/Standalone/Editor/TapSDK.Compliance.Standalone.Editor.asmdef +17 -0
- package/Standalone/Editor/TapSDK.Compliance.Standalone.Editor.asmdef.meta +7 -0
- package/Standalone/Editor.meta +3 -0
- package/Standalone/Resources/Prefabs/Standalone/TapTapAntiAddictionRetryAlert.prefab +835 -0
- package/Standalone/Resources/Prefabs/Standalone/TapTapAntiAddictionRetryAlert.prefab.meta +7 -0
- package/Standalone/Resources/Prefabs/Standalone/TapTapChinaIDInputPanel.prefab +1646 -0
- package/Standalone/Resources/Prefabs/Standalone/TapTapChinaIDInputPanel.prefab.meta +7 -0
- package/Standalone/Resources/Prefabs/Standalone/TapTapChinaQuickVerifyTipPanel.prefab +1591 -0
- package/Standalone/Resources/Prefabs/Standalone/TapTapChinaQuickVerifyTipPanel.prefab.meta +7 -0
- package/Standalone/Resources/Prefabs/Standalone/TapTapHealthPaymentPanel.prefab +897 -0
- package/Standalone/Resources/Prefabs/Standalone/TapTapHealthPaymentPanel.prefab.meta +7 -0
- package/Standalone/Resources/Prefabs/Standalone/TapTapHealthReminderPanel.prefab +1065 -0
- package/Standalone/Resources/Prefabs/Standalone/TapTapHealthReminderPanel.prefab.meta +7 -0
- package/Standalone/Resources/Prefabs/Standalone.meta +8 -0
- package/Standalone/Resources/Prefabs.meta +8 -0
- package/Standalone/Resources/Textures/QuickVerifyTip.png +0 -0
- package/Standalone/Resources/Textures/QuickVerifyTip.png.meta +128 -0
- package/Standalone/Resources/Textures/taptap-antiaddiction-largebutton.png +0 -0
- package/Standalone/Resources/Textures/taptap-antiaddiction-largebutton.png.meta +128 -0
- package/Standalone/Resources/Textures.meta +8 -0
- package/Standalone/Resources.meta +8 -0
- package/Standalone/Runtime/ComplianceWorker.cs +524 -0
- package/Standalone/Runtime/ComplianceWorker.cs.meta +11 -0
- package/Standalone/Runtime/Internal/AccessTokenJsonConverter.cs +58 -0
- package/Standalone/Runtime/Internal/AccessTokenJsonConverter.cs.meta +3 -0
- package/Standalone/Runtime/Internal/ComplianceConst.cs +73 -0
- package/Standalone/Runtime/Internal/ComplianceConst.cs.meta +11 -0
- package/Standalone/Runtime/Internal/ComplianceException.cs +24 -0
- package/Standalone/Runtime/Internal/ComplianceException.cs.meta +11 -0
- package/Standalone/Runtime/Internal/ComplianceNewJob.cs +174 -0
- package/Standalone/Runtime/Internal/ComplianceNewJob.cs.meta +11 -0
- package/Standalone/Runtime/Internal/CompliancePoll.cs +136 -0
- package/Standalone/Runtime/Internal/CompliancePoll.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Config.cs +137 -0
- package/Standalone/Runtime/Internal/Config.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Http/ComplianceHttpClient.cs +215 -0
- package/Standalone/Runtime/Internal/Http/ComplianceHttpClient.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Http.meta +8 -0
- package/Standalone/Runtime/Internal/Model/BaseResponse.cs +14 -0
- package/Standalone/Runtime/Internal/Model/BaseResponse.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Model/ErrorResponse.cs +27 -0
- package/Standalone/Runtime/Internal/Model/ErrorResponse.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Model/Payable.cs +23 -0
- package/Standalone/Runtime/Internal/Model/Payable.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Model/Playable.cs +48 -0
- package/Standalone/Runtime/Internal/Model/Playable.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Model/RealNameConfig.cs +73 -0
- package/Standalone/Runtime/Internal/Model/RealNameConfig.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Model/ServerTime.cs +19 -0
- package/Standalone/Runtime/Internal/Model/ServerTime.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Model/StandaloneResponse.cs +12 -0
- package/Standalone/Runtime/Internal/Model/StandaloneResponse.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Model/SubmitPayment.cs +8 -0
- package/Standalone/Runtime/Internal/Model/SubmitPayment.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Model/UserComplianceConfig.cs +109 -0
- package/Standalone/Runtime/Internal/Model/UserComplianceConfig.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Model/Verification.cs +88 -0
- package/Standalone/Runtime/Internal/Model/Verification.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Model.meta +8 -0
- package/Standalone/Runtime/Internal/Network.cs +296 -0
- package/Standalone/Runtime/Internal/Network.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Persistence.cs +91 -0
- package/Standalone/Runtime/Internal/Persistence.cs.meta +11 -0
- package/Standalone/Runtime/Internal/TapComplianceUI.cs +68 -0
- package/Standalone/Runtime/Internal/TapComplianceUI.cs.meta +11 -0
- package/Standalone/Runtime/Internal/TapLoginPermissionProvider.cs +24 -0
- package/Standalone/Runtime/Internal/TapLoginPermissionProvider.cs.meta +11 -0
- package/Standalone/Runtime/Internal/TapTapComplianceManager.cs +253 -0
- package/Standalone/Runtime/Internal/TapTapComplianceManager.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Tool.cs +211 -0
- package/Standalone/Runtime/Internal/Tool.cs.meta +11 -0
- package/Standalone/Runtime/Internal/UI/Controller/TapTapChinaVerifyFinishPanelController.cs +81 -0
- package/Standalone/Runtime/Internal/UI/Controller/TapTapChinaVerifyFinishPanelController.cs.meta +11 -0
- package/Standalone/Runtime/Internal/UI/Controller/TapTapComplianceQuickVerifyTipController.cs +119 -0
- package/Standalone/Runtime/Internal/UI/Controller/TapTapComplianceQuickVerifyTipController.cs.meta +3 -0
- package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceHealthPaymentController.cs +105 -0
- package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceHealthPaymentController.cs.meta +11 -0
- package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceHealthReminderController.cs +129 -0
- package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceHealthReminderController.cs.meta +11 -0
- package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceIDInputController.cs +218 -0
- package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceIDInputController.cs.meta +11 -0
- package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceRetryAlertController.cs +46 -0
- package/Standalone/Runtime/Internal/UI/Controller/TaptapComplianceRetryAlertController.cs.meta +11 -0
- package/Standalone/Runtime/Internal/UI/Controller.meta +8 -0
- package/Standalone/Runtime/Internal/UI.meta +8 -0
- package/Standalone/Runtime/Internal/Verification.cs +315 -0
- package/Standalone/Runtime/Internal/Verification.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Worker/BaseComplianceWorker.cs +489 -0
- package/Standalone/Runtime/Internal/Worker/BaseComplianceWorker.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Worker.meta +8 -0
- package/Standalone/Runtime/Internal.meta +3 -0
- package/Standalone/Runtime/TapTap.AntiAddiction.Standalone.Runtime.asmdef +26 -0
- package/Standalone/Runtime/TapTap.AntiAddiction.Standalone.Runtime.asmdef.meta +3 -0
- package/Standalone/Runtime/gen/ComplianceLocalizationItems.cs +121 -0
- package/Standalone/Runtime/gen/ComplianceLocalizationItems.cs.meta +11 -0
- package/Standalone/Runtime/gen.meta +8 -0
- package/Standalone/Runtime.meta +3 -0
- package/Standalone.meta +3 -0
- package/package.json +12 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<dependencies>
|
|
2
|
+
|
|
3
|
+
<!-- Android maven dependencies -->
|
|
4
|
+
<androidPackages>
|
|
5
|
+
<repositories>
|
|
6
|
+
<repository>https://repo.maven.apache.org/maven2</repository>
|
|
7
|
+
</repositories>
|
|
8
|
+
<androidPackage spec="com.taptap.sdk:tap-compliance:4.3.0"/>
|
|
9
|
+
</androidPackages>
|
|
10
|
+
|
|
11
|
+
<!-- iOS Cocoapod dependencies can be specified by each iosPod element. -->
|
|
12
|
+
<iosPods>
|
|
13
|
+
<sources>
|
|
14
|
+
<source>https://github.com/CocoaPods/Specs.git</source>
|
|
15
|
+
</sources>
|
|
16
|
+
<iosPod name="TapTapComplianceSDK" version="~> 4.3.0" bitcodeEnabled="false" addToAllTargets="false"/>
|
|
17
|
+
</iosPods>
|
|
18
|
+
</dependencies>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using TapSDK.Core.Editor;
|
|
3
|
+
using UnityEditor.Build.Reporting;
|
|
4
|
+
|
|
5
|
+
namespace TapSDK.Compliance.Mobile.Editor {
|
|
6
|
+
public class TapComplianceMobileProcessBuild : SDKLinkProcessBuild {
|
|
7
|
+
public override int callbackOrder => 4;
|
|
8
|
+
|
|
9
|
+
public override string LinkPath => "TapSDK/Compliance/link.xml";
|
|
10
|
+
|
|
11
|
+
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
12
|
+
new LinkedAssembly { Fullname = "TapSDK.Compliance" },
|
|
13
|
+
new LinkedAssembly { Fullname = "TapSDK.Compliance.Runtime" },
|
|
14
|
+
new LinkedAssembly { Fullname = "TapSDK.Compliance.Mobile.Runtime" }
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
18
|
+
return BuildTargetUtils.IsSupportMobile(report.summary.platform);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "TapSDK.Compliance.Mobile.Editor",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:56f3da7a178484843974054bafe77e73"
|
|
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,45 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEditor.Callbacks;
|
|
4
|
+
# if UNITY_IOS
|
|
5
|
+
using UnityEditor.iOS.Xcode;
|
|
6
|
+
#endif
|
|
7
|
+
using System.IO;
|
|
8
|
+
using System.Collections.Generic;
|
|
9
|
+
using System.Linq;
|
|
10
|
+
using TapSDK.Core.Editor;
|
|
11
|
+
|
|
12
|
+
#if UNITY_IOS
|
|
13
|
+
public class BuildPostProcessor
|
|
14
|
+
{
|
|
15
|
+
[PostProcessBuild(999)]
|
|
16
|
+
public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
|
|
17
|
+
{
|
|
18
|
+
if (buildTarget == BuildTarget.iOS)
|
|
19
|
+
{
|
|
20
|
+
var projPath = TapSDKCoreCompile.GetProjPath(path);
|
|
21
|
+
var proj = TapSDKCoreCompile.ParseProjPath(projPath);
|
|
22
|
+
var target = TapSDKCoreCompile.GetUnityTarget(proj);
|
|
23
|
+
|
|
24
|
+
if (TapSDKCoreCompile.CheckTarget(target))
|
|
25
|
+
{
|
|
26
|
+
Debug.LogError("Unity-iPhone is NUll");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (TapSDKCoreCompile.HandlerIOSSetting(path,
|
|
30
|
+
Application.dataPath,
|
|
31
|
+
"TapTapComplianceResource",
|
|
32
|
+
"com.taptap.sdk.compliance",
|
|
33
|
+
"Compliance",
|
|
34
|
+
new[] {"TapTapComplianceResource.bundle"},
|
|
35
|
+
target, projPath, proj, "TapTapComplianceSDK"))
|
|
36
|
+
{
|
|
37
|
+
Debug.Log("TapCompliance add Bundle Success!");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
Debug.LogWarning("TapCompliance add Bundle Failed!");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
#endif
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using Newtonsoft.Json;
|
|
4
|
+
using TapSDK.Compliance.Model;
|
|
5
|
+
using System.Threading.Tasks;
|
|
6
|
+
using TapSDK.Core;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace TapSDK.Compliance.Mobile.Runtime
|
|
10
|
+
{
|
|
11
|
+
public static class ComplianceMobileBridge
|
|
12
|
+
{
|
|
13
|
+
private const string ANTI_ADDICTION_SERVICE = "BridgeComplianceService";
|
|
14
|
+
private const string ANTI_ADDICTION_SERVICE_CLZ = "com.taptap.sdk.compilance.internal.enginebridge.BridgeComplianceService";
|
|
15
|
+
private const string ANTI_ADDICTION_SERVICE_IMPL = "com.taptap.sdk.compilance.internal.enginebridge.BridgeComplianceServiceImpl";
|
|
16
|
+
|
|
17
|
+
private static bool hasRegisterMobileCallback = false;
|
|
18
|
+
private static List<Action<int, string>> callbackList = new List<Action<int, string>>();
|
|
19
|
+
static ComplianceMobileBridge()
|
|
20
|
+
{
|
|
21
|
+
EngineBridge.GetInstance()
|
|
22
|
+
.Register(ANTI_ADDICTION_SERVICE_CLZ, ANTI_ADDICTION_SERVICE_IMPL);
|
|
23
|
+
Debug.Log("ComplianceMobileBridge register.");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
public static void Startup(string userIdentifier)
|
|
28
|
+
{
|
|
29
|
+
|
|
30
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
31
|
+
.Service(ANTI_ADDICTION_SERVICE)
|
|
32
|
+
.Method("startup")
|
|
33
|
+
.Args("userId", userIdentifier)
|
|
34
|
+
.CommandBuilder());
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public static void RegisterComplianceCallback(Action<int, string> callback)
|
|
39
|
+
{
|
|
40
|
+
if (!callbackList.Contains(callback))
|
|
41
|
+
{
|
|
42
|
+
callbackList.Add(callback);
|
|
43
|
+
}
|
|
44
|
+
if (!hasRegisterMobileCallback)
|
|
45
|
+
{
|
|
46
|
+
var command = new Command.Builder()
|
|
47
|
+
.Service(ANTI_ADDICTION_SERVICE)
|
|
48
|
+
.Method("registerComplianceCallback")
|
|
49
|
+
.Callback(true)
|
|
50
|
+
.OnceTime(false)
|
|
51
|
+
.CommandBuilder();
|
|
52
|
+
|
|
53
|
+
EngineBridge.GetInstance().CallHandler(command, result =>
|
|
54
|
+
{
|
|
55
|
+
try
|
|
56
|
+
{
|
|
57
|
+
TapLogger.Debug($"[Unity:Compliance] callback result: {result.ToJSON().ToString()}");
|
|
58
|
+
if (result.code != Result.RESULT_SUCCESS)
|
|
59
|
+
{
|
|
60
|
+
callbackList.ForEach((item) =>
|
|
61
|
+
{
|
|
62
|
+
item?.Invoke(-1, "[Unity:Compliance] callback fail");
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (string.IsNullOrEmpty(result.content))
|
|
68
|
+
{
|
|
69
|
+
callbackList.ForEach((item) =>
|
|
70
|
+
{
|
|
71
|
+
item?.Invoke(-1, "[Unity:Compliance] callback content is empty");
|
|
72
|
+
});
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
ComplianceCallbackData callbackData = new ComplianceCallbackData();
|
|
78
|
+
#if UNITY_IOS
|
|
79
|
+
result.content = RemoveFontColor(result.content);
|
|
80
|
+
var callbackOriginData = JsonConvert.DeserializeObject<ComplianceCallbackOriginData>(result.content);
|
|
81
|
+
callbackData.code = callbackOriginData.code;
|
|
82
|
+
callbackData.extras = JsonConvert.DeserializeObject<MsgExtraParams>(callbackOriginData.extras);
|
|
83
|
+
#else
|
|
84
|
+
callbackData = JsonConvert.DeserializeObject<ComplianceCallbackData>(result.content);
|
|
85
|
+
#endif
|
|
86
|
+
if (StartUpResult.Contains(callbackData.code))
|
|
87
|
+
{
|
|
88
|
+
callbackList.ForEach((item) =>
|
|
89
|
+
{
|
|
90
|
+
item?.Invoke(callbackData.code, null);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else
|
|
94
|
+
{
|
|
95
|
+
TapLogger.Debug("[Unity:Compliance] result.extras title:" + callbackData.extras.title);
|
|
96
|
+
TapLogger.Debug("[Unity:Compliance] result.extras description:" + callbackData.extras.description);
|
|
97
|
+
callbackList.ForEach((item) =>
|
|
98
|
+
{
|
|
99
|
+
item?.Invoke(-1, callbackData.extras.description);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (Exception e)
|
|
104
|
+
{
|
|
105
|
+
TapLogger.Error("[Unity:Compliance] callback error:" + e.Message + "\n" + e.StackTrace);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
});
|
|
109
|
+
hasRegisterMobileCallback = true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private static string RemoveFontColor(string originStr)
|
|
114
|
+
{
|
|
115
|
+
if (string.IsNullOrEmpty(originStr)) return originStr;
|
|
116
|
+
var colorBeginPattern = "<fontcolor=";
|
|
117
|
+
int index = originStr.IndexOf(colorBeginPattern, StringComparison.Ordinal);
|
|
118
|
+
while (index >= 0)
|
|
119
|
+
{
|
|
120
|
+
int eIndex = originStr.IndexOf('>', index);
|
|
121
|
+
originStr = originStr.Remove(index, eIndex - index + 1);
|
|
122
|
+
index = originStr.IndexOf(colorBeginPattern, StringComparison.Ordinal);
|
|
123
|
+
}
|
|
124
|
+
var colorEndPattern = "font>";
|
|
125
|
+
index = originStr.IndexOf(colorEndPattern, StringComparison.Ordinal);
|
|
126
|
+
while (index >= 0)
|
|
127
|
+
{
|
|
128
|
+
int eIndex = originStr.LastIndexOf('<', index + colorEndPattern.Length, index);
|
|
129
|
+
originStr = originStr.Remove(eIndex, index + colorEndPattern.Length - eIndex);
|
|
130
|
+
index = originStr.IndexOf(colorEndPattern, StringComparison.Ordinal);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
var spancolorBeginPattern = "<spancolor=";
|
|
134
|
+
int spanindex = originStr.IndexOf(spancolorBeginPattern, StringComparison.Ordinal);
|
|
135
|
+
while (spanindex >= 0)
|
|
136
|
+
{
|
|
137
|
+
int eIndex = originStr.IndexOf('>', spanindex);
|
|
138
|
+
originStr = originStr.Remove(spanindex, eIndex - spanindex + 1);
|
|
139
|
+
spanindex = originStr.IndexOf(spancolorBeginPattern, StringComparison.Ordinal);
|
|
140
|
+
}
|
|
141
|
+
var spancolorEndPattern = "span>";
|
|
142
|
+
spanindex = originStr.IndexOf(spancolorEndPattern, StringComparison.Ordinal);
|
|
143
|
+
while (spanindex >= 0)
|
|
144
|
+
{
|
|
145
|
+
int eIndex = originStr.LastIndexOf('<', spanindex + spancolorEndPattern.Length, spanindex);
|
|
146
|
+
originStr = originStr.Remove(eIndex, spanindex + spancolorEndPattern.Length - eIndex);
|
|
147
|
+
spanindex = originStr.IndexOf(spancolorEndPattern, StringComparison.Ordinal);
|
|
148
|
+
}
|
|
149
|
+
return originStr;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
public static void SetTestEnvironment(bool isTest)
|
|
153
|
+
{
|
|
154
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
155
|
+
.Service(ANTI_ADDICTION_SERVICE)
|
|
156
|
+
.Method("setTestEnvironment")
|
|
157
|
+
.Args("testEnv", isTest)
|
|
158
|
+
.CommandBuilder());
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
public async static Task<string> GetCurrentAccessToken()
|
|
164
|
+
{
|
|
165
|
+
var command = new Command.Builder()
|
|
166
|
+
.Service(ANTI_ADDICTION_SERVICE)
|
|
167
|
+
.Method("getCurrentAccessToken")
|
|
168
|
+
.Callback(true)
|
|
169
|
+
.OnceTime(true)
|
|
170
|
+
.CommandBuilder();
|
|
171
|
+
var result = await EngineBridge.GetInstance().Emit(command);
|
|
172
|
+
if (!EngineBridge.CheckResult(result))
|
|
173
|
+
{
|
|
174
|
+
throw new TapException((int)TapErrorCode.ERROR_CODE_BRIDGE_EXECUTE, "TapCompliance CurrentToken Failed!");
|
|
175
|
+
}
|
|
176
|
+
var dic = Json.Deserialize(result.content) as Dictionary<string, object>;
|
|
177
|
+
var token = SafeDictionary.GetValue<string>(dic, "token") as string;
|
|
178
|
+
return token;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
public async static Task<int> GetCurrentUserRemainTime()
|
|
184
|
+
{
|
|
185
|
+
var command = new Command.Builder()
|
|
186
|
+
.Service(ANTI_ADDICTION_SERVICE)
|
|
187
|
+
.Method("getUserRemainTime")
|
|
188
|
+
.Callback(true)
|
|
189
|
+
.OnceTime(true)
|
|
190
|
+
.CommandBuilder();
|
|
191
|
+
var result = await EngineBridge.GetInstance().Emit(command);
|
|
192
|
+
if (!EngineBridge.CheckResult(result))
|
|
193
|
+
{
|
|
194
|
+
throw new TapException((int)TapErrorCode.ERROR_CODE_BRIDGE_EXECUTE, "TapCompliance CurrentUserRemainTime Failed!");
|
|
195
|
+
}
|
|
196
|
+
var dic = Json.Deserialize(result.content) as Dictionary<string, object>;
|
|
197
|
+
var remainTime = SafeDictionary.GetValue<int>(dic, "remainTime") as int?;
|
|
198
|
+
return remainTime ?? 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
public async static Task<int> GetUserAgeRange()
|
|
202
|
+
{
|
|
203
|
+
var command = new Command.Builder()
|
|
204
|
+
.Service(ANTI_ADDICTION_SERVICE)
|
|
205
|
+
.Method("getUserAgeRange")
|
|
206
|
+
.Callback(true)
|
|
207
|
+
.OnceTime(true)
|
|
208
|
+
.CommandBuilder();
|
|
209
|
+
var result = await EngineBridge.GetInstance().Emit(command);
|
|
210
|
+
if (!EngineBridge.CheckResult(result))
|
|
211
|
+
{
|
|
212
|
+
throw new TapException((int)TapErrorCode.ERROR_CODE_BRIDGE_EXECUTE, "TapCompliance CurrentUserAgeLimit Failed!");
|
|
213
|
+
}
|
|
214
|
+
var dic = Json.Deserialize(result.content) as Dictionary<string, object>;
|
|
215
|
+
var ageRange = SafeDictionary.GetValue<int>(dic, "ageRange") as int?;
|
|
216
|
+
return ageRange ?? -1;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
public static void Exit()
|
|
220
|
+
{
|
|
221
|
+
var command = new Command.Builder()
|
|
222
|
+
.Service(ANTI_ADDICTION_SERVICE)
|
|
223
|
+
.Method("exit")
|
|
224
|
+
.Callback(false)
|
|
225
|
+
.OnceTime(false)
|
|
226
|
+
.CommandBuilder();
|
|
227
|
+
EngineBridge.GetInstance().CallHandler(command);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
public static void SubmitPayResult(long amount
|
|
231
|
+
, Action handleSubmitPayResult
|
|
232
|
+
, Action<string> handleSubmitPayResultException)
|
|
233
|
+
{
|
|
234
|
+
var command = new Command.Builder()
|
|
235
|
+
.Service(ANTI_ADDICTION_SERVICE)
|
|
236
|
+
.Method("submitPayment")
|
|
237
|
+
.Args("submitAmount", amount)
|
|
238
|
+
.Callback(true)
|
|
239
|
+
.OnceTime(false)
|
|
240
|
+
.CommandBuilder();
|
|
241
|
+
|
|
242
|
+
EngineBridge.GetInstance().CallHandler(command, result =>
|
|
243
|
+
{
|
|
244
|
+
TapLogger.Debug($"[Unity:Compliance] submitPayResult result: {result.ToJSON().ToString()}");
|
|
245
|
+
if (result.code != Result.RESULT_SUCCESS)
|
|
246
|
+
{
|
|
247
|
+
handleSubmitPayResultException?.Invoke("[Unity:Compliance] submitPayResult fail");
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (string.IsNullOrEmpty(result.content))
|
|
252
|
+
{
|
|
253
|
+
handleSubmitPayResultException?.Invoke("[Unity:Compliance] submitPayResult content is empty");
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
TapLogger.Debug("[Unity:Compliance] submitPayResult content: " + result.content);
|
|
258
|
+
var dic = Json.Deserialize(result.content) as Dictionary<string, object>;
|
|
259
|
+
bool success = SafeDictionary.GetValue<int>(dic, "success") == 0;
|
|
260
|
+
string errorMsg = SafeDictionary.GetValue<string>(dic, "description");
|
|
261
|
+
if (success)
|
|
262
|
+
{
|
|
263
|
+
handleSubmitPayResult?.Invoke();
|
|
264
|
+
}
|
|
265
|
+
else
|
|
266
|
+
{
|
|
267
|
+
handleSubmitPayResultException?.Invoke(errorMsg);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
public static void CheckPaymentLimit(long amount
|
|
273
|
+
, Action<CheckPayResult> handleCheckPayLimit
|
|
274
|
+
, Action<string> handleCheckPayLimitException)
|
|
275
|
+
{
|
|
276
|
+
var command = new Command.Builder()
|
|
277
|
+
.Service(ANTI_ADDICTION_SERVICE)
|
|
278
|
+
.Method("checkPaymentLimit")
|
|
279
|
+
.Args("amount", amount)
|
|
280
|
+
.Callback(true)
|
|
281
|
+
.OnceTime(false)
|
|
282
|
+
.CommandBuilder();
|
|
283
|
+
|
|
284
|
+
EngineBridge.GetInstance().CallHandler(command, result =>
|
|
285
|
+
{
|
|
286
|
+
TapLogger.Debug($"[Unity:Compliance] checkPayLimit result: {result.ToJSON().ToString()}");
|
|
287
|
+
if (result.code != Result.RESULT_SUCCESS)
|
|
288
|
+
{
|
|
289
|
+
handleCheckPayLimitException?.Invoke("[Unity:Compliance] checkPayLimit fail");
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (string.IsNullOrEmpty(result.content))
|
|
294
|
+
{
|
|
295
|
+
handleCheckPayLimitException?.Invoke("[Unity:Compliance] checkPayLimit content is empty");
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
TapLogger.Debug("[Unity:Compliance] checkPayLimit content: " + result.content);
|
|
300
|
+
|
|
301
|
+
var checkPayResultParams = JsonConvert.DeserializeObject<CheckPayResultParams>(result.content);
|
|
302
|
+
if (checkPayResultParams.Success)
|
|
303
|
+
{
|
|
304
|
+
handleCheckPayLimit?.Invoke(new CheckPayResult()
|
|
305
|
+
{
|
|
306
|
+
status = checkPayResultParams.status,
|
|
307
|
+
title = checkPayResultParams.title,
|
|
308
|
+
description = checkPayResultParams.description,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
else
|
|
312
|
+
{
|
|
313
|
+
handleCheckPayLimitException?.Invoke(checkPayResultParams.description);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
}
|
|
319
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using TapSDK.Compliance.Model;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using TapSDK.Compliance.Mobile.Runtime;
|
|
6
|
+
|
|
7
|
+
namespace TapSDK.Compliance.Mobile.Runtime
|
|
8
|
+
{
|
|
9
|
+
public sealed class ComplianceMobileOldJob : IComplianceJob
|
|
10
|
+
{
|
|
11
|
+
private List<Action<int, string>> _externalCallbackList;
|
|
12
|
+
|
|
13
|
+
public List<Action<int, string>> ExternalCallbackList
|
|
14
|
+
{
|
|
15
|
+
get => _externalCallbackList;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/// <summary>
|
|
20
|
+
/// 剩余时间(单位:秒)
|
|
21
|
+
/// </summary>
|
|
22
|
+
public Task<int> GetRemainingTime()
|
|
23
|
+
{
|
|
24
|
+
return ComplianceMobileBridge.GetCurrentUserRemainTime();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public Task<string> GetCurrentToken()
|
|
28
|
+
{
|
|
29
|
+
return ComplianceMobileBridge.GetCurrentAccessToken();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public Task<int> GetAgeRange()
|
|
33
|
+
{
|
|
34
|
+
return ComplianceMobileBridge.GetUserAgeRange();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public void Init(string clientId, string clientToken, TapTapComplianceOption config)
|
|
38
|
+
{
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public void RegisterComplianceCallback(Action<int, string> callback)
|
|
43
|
+
{
|
|
44
|
+
ComplianceMobileBridge.RegisterComplianceCallback(callback);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public void Startup(string userId)
|
|
48
|
+
{
|
|
49
|
+
ComplianceMobileBridge.Startup(userId);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
public void Exit()
|
|
54
|
+
{
|
|
55
|
+
ComplianceMobileBridge.Exit();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
public void CheckPaymentLimit(long amount, Action<CheckPayResult> handleCheckPayLimit, Action<string> handleCheckPayLimitException)
|
|
60
|
+
{
|
|
61
|
+
ComplianceMobileBridge.CheckPaymentLimit(amount, handleCheckPayLimit, handleCheckPayLimitException);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public void SubmitPayment(long amount, Action handleSubmitPayResult, Action<string> handleSubmitPayResultException)
|
|
65
|
+
{
|
|
66
|
+
ComplianceMobileBridge.SubmitPayResult(amount, handleSubmitPayResult, handleSubmitPayResultException);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
public void SetTestEnvironment(bool enable)
|
|
71
|
+
{
|
|
72
|
+
ComplianceMobileBridge.SetTestEnvironment(enable);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public void OnInvokeExternalCallback(int code, string msg)
|
|
76
|
+
{
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "TapSDK.Compliance.Mobile.Runtime",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:9b1c19877f4294a9cb33ff38fc9f1c83",
|
|
5
|
+
"GUID:7d5ef2062f3704e1ab74aac0e4d5a1a7",
|
|
6
|
+
"GUID:10560023d8780423cb943c7a324b69f2"
|
|
7
|
+
],
|
|
8
|
+
"includePlatforms": [
|
|
9
|
+
"Android",
|
|
10
|
+
"iOS"
|
|
11
|
+
],
|
|
12
|
+
"excludePlatforms": [],
|
|
13
|
+
"allowUnsafeCode": false,
|
|
14
|
+
"overrideReferences": false,
|
|
15
|
+
"autoReferenced": true,
|
|
16
|
+
"defineConstraints": [],
|
|
17
|
+
"versionDefines": [],
|
|
18
|
+
"noEngineReferences": false
|
|
19
|
+
}
|
package/Mobile.meta
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"androidStore":"GooglePlay"}
|