com.taptap.sdk.core 4.4.2 → 4.4.3
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/TapSDKCoreCompile.cs +6 -0
- package/Mobile/Editor/NativeDependencies.xml +2 -2
- package/Mobile/Runtime/TapEventMobile.cs +0 -1
- package/{Standalone/Runtime/Internal/Openlog/Bean.meta → Plugins.meta} +1 -1
- package/Resources/TapMessage.prefab +1 -1
- package/Runtime/Internal/Log/TapLog.cs +1 -1
- package/Runtime/Public/TapTapSDK.cs +11 -3
- package/Runtime/Public/TapTapSdkOptions.cs +0 -4
- package/Standalone/Plugins/macOS/libtapsdkcorecpp.dylib +0 -0
- package/Standalone/Plugins/macOS/libtapsdkcorecpp.dylib.meta +80 -0
- package/Standalone/Plugins/x86/tapsdkcore.dll +0 -0
- package/Standalone/Plugins/x86/tapsdkcore.dll.meta +63 -0
- package/Standalone/{Runtime/Internal/Utils.meta → Plugins/x86.meta} +1 -1
- package/Standalone/Plugins/x86_64/tapsdkcore.dll +0 -0
- package/Standalone/Plugins/x86_64/tapsdkcore.dll.meta +63 -0
- package/{link.xml.meta → Standalone/Plugins/x86_64.meta} +3 -2
- package/Standalone/Runtime/Internal/Http/TapHttp.cs +12 -6
- package/Standalone/Runtime/Internal/Http/TapHttpUtils.cs +22 -6
- package/Standalone/Runtime/Internal/Openlog/TapAppDurationStandalone.cs +121 -0
- package/Standalone/Runtime/Internal/Openlog/{TapOpenlogQueueBase.cs.meta → TapAppDurationStandalone.cs.meta} +1 -1
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogParamConstants.cs +1 -3
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogStandalone.cs +96 -93
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogStartParamConstants.cs +23 -0
- package/Standalone/Runtime/Internal/Openlog/{Bean/TapOpenlogStoreBean.cs.meta → TapOpenlogStartParamConstants.cs.meta} +1 -1
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogWrapper.cs +178 -0
- package/Standalone/Runtime/Internal/Openlog/{Bean/TapOpenlogLogGroup.cs.meta → TapOpenlogWrapper.cs.meta} +1 -1
- package/Standalone/Runtime/Public/TapCoreStandalone.cs +19 -3
- package/Standalone/Runtime/TapSDK.Core.Standalone.Runtime.asmdef +0 -1
- package/package.json +1 -1
- package/Standalone/Runtime/Internal/Openlog/Bean/TapOpenlogLogGroup.cs +0 -39
- package/Standalone/Runtime/Internal/Openlog/Bean/TapOpenlogStoreBean.cs +0 -33
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogHttpClient.cs +0 -153
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogHttpClient.cs.meta +0 -11
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogQueueBase.cs +0 -198
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogQueueBusiness.cs +0 -17
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogQueueBusiness.cs.meta +0 -11
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogQueueTechnology.cs +0 -15
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogQueueTechnology.cs.meta +0 -11
- package/Standalone/Runtime/Internal/Utils/TapProtoBufffer.cs +0 -28
- package/Standalone/Runtime/Internal/Utils/TapProtoBufffer.cs.meta +0 -11
- package/link.xml +0 -4
|
@@ -17,11 +17,13 @@ namespace TapSDK.Core.Editor
|
|
|
17
17
|
#if UNITY_IOS
|
|
18
18
|
public static string GetProjPath(string path)
|
|
19
19
|
{
|
|
20
|
+
Debug.Log($"SDX , GetProjPath path:{path}");
|
|
20
21
|
return PBXProject.GetPBXProjectPath(path);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
public static PBXProject ParseProjPath(string path)
|
|
24
25
|
{
|
|
26
|
+
Debug.Log($"SDX , ParseProjPath path:{path}");
|
|
25
27
|
var proj = new PBXProject();
|
|
26
28
|
proj.ReadFromString(File.ReadAllText(path));
|
|
27
29
|
return proj;
|
|
@@ -30,9 +32,11 @@ namespace TapSDK.Core.Editor
|
|
|
30
32
|
public static string GetUnityFrameworkTarget(PBXProject proj)
|
|
31
33
|
{
|
|
32
34
|
#if UNITY_2019_3_OR_NEWER
|
|
35
|
+
Debug.Log("SDX , GetUnityFrameworkTarget UNITY_2019_3_OR_NEWER");
|
|
33
36
|
string target = proj.GetUnityFrameworkTargetGuid();
|
|
34
37
|
return target;
|
|
35
38
|
#endif
|
|
39
|
+
Debug.Log("SDX , GetUnityFrameworkTarget");
|
|
36
40
|
var unityPhoneTarget = proj.TargetGuidByName("Unity-iPhone");
|
|
37
41
|
return unityPhoneTarget;
|
|
38
42
|
}
|
|
@@ -40,9 +44,11 @@ namespace TapSDK.Core.Editor
|
|
|
40
44
|
public static string GetUnityTarget(PBXProject proj)
|
|
41
45
|
{
|
|
42
46
|
#if UNITY_2019_3_OR_NEWER
|
|
47
|
+
Debug.Log("SDX , GetUnityTarget UNITY_2019_3_OR_NEWER");
|
|
43
48
|
string target = proj.GetUnityMainTargetGuid();
|
|
44
49
|
return target;
|
|
45
50
|
#endif
|
|
51
|
+
Debug.Log("SDX , GetUnityTarget");
|
|
46
52
|
var unityPhoneTarget = proj.TargetGuidByName("Unity-iPhone");
|
|
47
53
|
return unityPhoneTarget;
|
|
48
54
|
}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
<repositories>
|
|
5
5
|
<repository>https://repo.maven.apache.org/maven2</repository>
|
|
6
6
|
</repositories>
|
|
7
|
-
<androidPackage spec="com.taptap.sdk:tap-core-unity:4.4.
|
|
7
|
+
<androidPackage spec="com.taptap.sdk:tap-core-unity:4.4.3"/>
|
|
8
8
|
</androidPackages>
|
|
9
9
|
<iosPods>
|
|
10
10
|
<sources>
|
|
11
11
|
<source>https://github.com/CocoaPods/Specs.git</source>
|
|
12
12
|
</sources>
|
|
13
13
|
<iosPod name="Protobuf" version="~> 3.0" bitcodeEnabled="false" addToAllTargets="false"/>
|
|
14
|
-
<iosPod name="TapTapCoreSDK" version="~> 4.4.
|
|
14
|
+
<iosPod name="TapTapCoreSDK" version="~> 4.4.3" bitcodeEnabled="false" addToAllTargets="false"/>
|
|
15
15
|
</iosPods>
|
|
16
16
|
</dependencies>
|
|
@@ -93,7 +93,7 @@ namespace TapSDK.Core.Internal.Log
|
|
|
93
93
|
private static string GetThreadInfo()
|
|
94
94
|
{
|
|
95
95
|
bool isMainThread = System.Threading.Thread.CurrentThread.IsAlive && System.Threading.Thread.CurrentThread.ManagedThreadId == 1;
|
|
96
|
-
string threadInfo = isMainThread ? "Main
|
|
96
|
+
string threadInfo = isMainThread ? "Main" : $"IO {System.Threading.Thread.CurrentThread.ManagedThreadId}";
|
|
97
97
|
|
|
98
98
|
if (IsMobilePlatform())
|
|
99
99
|
{
|
|
@@ -11,7 +11,7 @@ using TapSDK.Core.Internal.Log;
|
|
|
11
11
|
|
|
12
12
|
namespace TapSDK.Core {
|
|
13
13
|
public class TapTapSDK {
|
|
14
|
-
public static readonly string Version = "4.4.
|
|
14
|
+
public static readonly string Version = "4.4.3";
|
|
15
15
|
|
|
16
16
|
public static string SDKPlatform = "TapSDK-Unity";
|
|
17
17
|
|
|
@@ -61,10 +61,13 @@ namespace TapSDK.Core {
|
|
|
61
61
|
throw new ArgumentException("[TapSDK] options is null!");
|
|
62
62
|
if (string.IsNullOrEmpty(coreOption.clientId))
|
|
63
63
|
throw new ArgumentException("[TapSDK] clientID is null or empty!");
|
|
64
|
-
|
|
64
|
+
long startTime = DateTime.Now.Ticks;
|
|
65
65
|
TapTapSDK.taptapSdkOptions = coreOption;
|
|
66
66
|
TapLog.Enabled = coreOption.enableLog;
|
|
67
|
+
long startCore = DateTime.Now.Ticks;
|
|
67
68
|
platformWrapper?.Init(coreOption,otherOptions);
|
|
69
|
+
long costCore = DateTime.Now.Ticks - startCore;
|
|
70
|
+
// TapLog.Log($"Init core cost time: {costCore / 10000}ms");
|
|
68
71
|
|
|
69
72
|
Type[] initTaskTypes = GetInitTypeList();
|
|
70
73
|
if (initTaskTypes != null) {
|
|
@@ -74,10 +77,15 @@ namespace TapSDK.Core {
|
|
|
74
77
|
}
|
|
75
78
|
initTasks = initTasks.OrderBy(task => task.Order).ToList();
|
|
76
79
|
foreach (IInitTask task in initTasks) {
|
|
77
|
-
|
|
80
|
+
TapLog.Log($"Init: {task.GetType().Name}");
|
|
81
|
+
long startModule = DateTime.Now.Ticks;
|
|
78
82
|
task.Init(coreOption,otherOptions);
|
|
83
|
+
long costModule = DateTime.Now.Ticks - startModule;
|
|
84
|
+
// TapLog.Log($"Init {task.GetType().Name} cost time: {costModule / 10000}ms");
|
|
79
85
|
}
|
|
80
86
|
}
|
|
87
|
+
long costTime = DateTime.Now.Ticks - startTime;
|
|
88
|
+
// TapLog.Log($"Init cost time: {costTime / 10000}ms");
|
|
81
89
|
}
|
|
82
90
|
|
|
83
91
|
// UpdateLanguage 方法
|
|
@@ -6,8 +6,6 @@ namespace TapSDK.Core
|
|
|
6
6
|
public interface TapTapSdkBaseOptions
|
|
7
7
|
{
|
|
8
8
|
string moduleName { get; }
|
|
9
|
-
|
|
10
|
-
AndroidJavaObject androidObject{get;}
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
public enum TapTapRegionType
|
|
@@ -98,7 +96,5 @@ namespace TapSDK.Core
|
|
|
98
96
|
{
|
|
99
97
|
get => _moduleName;
|
|
100
98
|
}
|
|
101
|
-
|
|
102
|
-
public AndroidJavaObject androidObject => throw new System.NotImplementedException();
|
|
103
99
|
}
|
|
104
100
|
}
|
|
Binary file
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 49c295e8cfb414b76aa3bdc07368e922
|
|
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
|
+
Exclude Android: 1
|
|
20
|
+
Exclude Editor: 0
|
|
21
|
+
Exclude Linux64: 1
|
|
22
|
+
Exclude OSXUniversal: 0
|
|
23
|
+
Exclude Win: 1
|
|
24
|
+
Exclude Win64: 1
|
|
25
|
+
Exclude iOS: 1
|
|
26
|
+
- first:
|
|
27
|
+
Android: Android
|
|
28
|
+
second:
|
|
29
|
+
enabled: 0
|
|
30
|
+
settings:
|
|
31
|
+
CPU: ARMv7
|
|
32
|
+
- first:
|
|
33
|
+
Any:
|
|
34
|
+
second:
|
|
35
|
+
enabled: 0
|
|
36
|
+
settings: {}
|
|
37
|
+
- first:
|
|
38
|
+
Editor: Editor
|
|
39
|
+
second:
|
|
40
|
+
enabled: 1
|
|
41
|
+
settings:
|
|
42
|
+
CPU: AnyCPU
|
|
43
|
+
DefaultValueInitialized: true
|
|
44
|
+
OS: OSX
|
|
45
|
+
- first:
|
|
46
|
+
Standalone: Linux64
|
|
47
|
+
second:
|
|
48
|
+
enabled: 0
|
|
49
|
+
settings:
|
|
50
|
+
CPU: AnyCPU
|
|
51
|
+
- first:
|
|
52
|
+
Standalone: OSXUniversal
|
|
53
|
+
second:
|
|
54
|
+
enabled: 1
|
|
55
|
+
settings:
|
|
56
|
+
CPU: x86_64
|
|
57
|
+
- first:
|
|
58
|
+
Standalone: Win
|
|
59
|
+
second:
|
|
60
|
+
enabled: 0
|
|
61
|
+
settings:
|
|
62
|
+
CPU: x86
|
|
63
|
+
- first:
|
|
64
|
+
Standalone: Win64
|
|
65
|
+
second:
|
|
66
|
+
enabled: 0
|
|
67
|
+
settings:
|
|
68
|
+
CPU: x86_64
|
|
69
|
+
- first:
|
|
70
|
+
iPhone: iOS
|
|
71
|
+
second:
|
|
72
|
+
enabled: 0
|
|
73
|
+
settings:
|
|
74
|
+
AddToEmbeddedBinaries: false
|
|
75
|
+
CPU: AnyCPU
|
|
76
|
+
CompileFlags:
|
|
77
|
+
FrameworkDependencies:
|
|
78
|
+
userData:
|
|
79
|
+
assetBundleName:
|
|
80
|
+
assetBundleVariant:
|
|
Binary file
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 5bfe079fe35ffa74f814bfa7df1d75f8
|
|
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
|
+
Exclude Editor: 0
|
|
20
|
+
Exclude Linux64: 0
|
|
21
|
+
Exclude OSXUniversal: 0
|
|
22
|
+
Exclude Win: 0
|
|
23
|
+
Exclude Win64: 0
|
|
24
|
+
- first:
|
|
25
|
+
Any:
|
|
26
|
+
second:
|
|
27
|
+
enabled: 0
|
|
28
|
+
settings: {}
|
|
29
|
+
- first:
|
|
30
|
+
Editor: Editor
|
|
31
|
+
second:
|
|
32
|
+
enabled: 1
|
|
33
|
+
settings:
|
|
34
|
+
CPU: x86
|
|
35
|
+
DefaultValueInitialized: true
|
|
36
|
+
OS: Windows
|
|
37
|
+
- first:
|
|
38
|
+
Standalone: Linux64
|
|
39
|
+
second:
|
|
40
|
+
enabled: 1
|
|
41
|
+
settings:
|
|
42
|
+
CPU: None
|
|
43
|
+
- first:
|
|
44
|
+
Standalone: OSXUniversal
|
|
45
|
+
second:
|
|
46
|
+
enabled: 1
|
|
47
|
+
settings:
|
|
48
|
+
CPU: x86
|
|
49
|
+
- first:
|
|
50
|
+
Standalone: Win
|
|
51
|
+
second:
|
|
52
|
+
enabled: 1
|
|
53
|
+
settings:
|
|
54
|
+
CPU: AnyCPU
|
|
55
|
+
- first:
|
|
56
|
+
Standalone: Win64
|
|
57
|
+
second:
|
|
58
|
+
enabled: 1
|
|
59
|
+
settings:
|
|
60
|
+
CPU: None
|
|
61
|
+
userData:
|
|
62
|
+
assetBundleName:
|
|
63
|
+
assetBundleVariant:
|
|
Binary file
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: f426835f028130348aec138e80a35b77
|
|
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
|
+
Exclude Editor: 0
|
|
20
|
+
Exclude Linux64: 1
|
|
21
|
+
Exclude OSXUniversal: 1
|
|
22
|
+
Exclude Win: 0
|
|
23
|
+
Exclude Win64: 0
|
|
24
|
+
- first:
|
|
25
|
+
Any:
|
|
26
|
+
second:
|
|
27
|
+
enabled: 0
|
|
28
|
+
settings: {}
|
|
29
|
+
- first:
|
|
30
|
+
Editor: Editor
|
|
31
|
+
second:
|
|
32
|
+
enabled: 1
|
|
33
|
+
settings:
|
|
34
|
+
CPU: x86_64
|
|
35
|
+
DefaultValueInitialized: true
|
|
36
|
+
OS: Windows
|
|
37
|
+
- first:
|
|
38
|
+
Standalone: Linux64
|
|
39
|
+
second:
|
|
40
|
+
enabled: 0
|
|
41
|
+
settings:
|
|
42
|
+
CPU: None
|
|
43
|
+
- first:
|
|
44
|
+
Standalone: OSXUniversal
|
|
45
|
+
second:
|
|
46
|
+
enabled: 0
|
|
47
|
+
settings:
|
|
48
|
+
CPU: None
|
|
49
|
+
- first:
|
|
50
|
+
Standalone: Win
|
|
51
|
+
second:
|
|
52
|
+
enabled: 1
|
|
53
|
+
settings:
|
|
54
|
+
CPU: None
|
|
55
|
+
- first:
|
|
56
|
+
Standalone: Win64
|
|
57
|
+
second:
|
|
58
|
+
enabled: 1
|
|
59
|
+
settings:
|
|
60
|
+
CPU: x86_64
|
|
61
|
+
userData:
|
|
62
|
+
assetBundleName:
|
|
63
|
+
assetBundleVariant:
|
|
@@ -5,8 +5,8 @@ namespace TapSDK.Core.Standalone.Internal.Http
|
|
|
5
5
|
using System;
|
|
6
6
|
using System.Collections.Generic;
|
|
7
7
|
using System.Net.Http.Headers;
|
|
8
|
+
using System.Text;
|
|
8
9
|
using System.Threading.Tasks;
|
|
9
|
-
using System.Web;
|
|
10
10
|
using Newtonsoft.Json;
|
|
11
11
|
using TapSDK.Core.Internal.Log;
|
|
12
12
|
|
|
@@ -289,15 +289,21 @@ namespace TapSDK.Core.Standalone.Internal.Http
|
|
|
289
289
|
}
|
|
290
290
|
uriBuilder = new UriBuilder(uri: $"{host}{path}");
|
|
291
291
|
}
|
|
292
|
+
|
|
292
293
|
if (allQueryParams.Count > 0)
|
|
293
294
|
{
|
|
294
|
-
var
|
|
295
|
+
var queryBuilder = new StringBuilder();
|
|
295
296
|
foreach (var param in allQueryParams)
|
|
296
297
|
{
|
|
297
|
-
|
|
298
|
+
// 使用 Uri.EscapeDataString 来编码参数的键和值
|
|
299
|
+
queryBuilder.Append($"{Uri.EscapeDataString(param.Key)}={Uri.EscapeDataString(param.Value)}&");
|
|
298
300
|
}
|
|
299
|
-
|
|
301
|
+
// 移除末尾的 '&'
|
|
302
|
+
queryBuilder.Length -= 1;
|
|
303
|
+
|
|
304
|
+
uriBuilder.Query = queryBuilder.ToString();
|
|
300
305
|
}
|
|
306
|
+
|
|
301
307
|
var requestUri = uriBuilder.Uri;
|
|
302
308
|
|
|
303
309
|
// 创建 HttpRequestMessage
|
|
@@ -356,13 +362,13 @@ namespace TapSDK.Core.Standalone.Internal.Http
|
|
|
356
362
|
{
|
|
357
363
|
if (TapTapSDK.taptapSdkOptions.enableLog)
|
|
358
364
|
{
|
|
359
|
-
TapHttpUtils.PrintRequest(client, request
|
|
365
|
+
TapHttpUtils.PrintRequest(client, request);
|
|
360
366
|
}
|
|
361
367
|
// 发送请求
|
|
362
368
|
HttpResponseMessage response = await client.SendAsync(request);
|
|
363
369
|
if (TapTapSDK.taptapSdkOptions.enableLog)
|
|
364
370
|
{
|
|
365
|
-
TapHttpUtils.PrintResponse(response
|
|
371
|
+
TapHttpUtils.PrintResponse(response);
|
|
366
372
|
}
|
|
367
373
|
// 解析响应
|
|
368
374
|
return await httpConfig.Parser.Parse<T>(response);
|
|
@@ -102,7 +102,7 @@ namespace TapSDK.Core.Standalone.Internal.Http
|
|
|
102
102
|
return null;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
public static void PrintRequest(HttpClient client, HttpRequestMessage request
|
|
105
|
+
public static void PrintRequest(HttpClient client, HttpRequestMessage request)
|
|
106
106
|
{
|
|
107
107
|
if (TapLogger.LogDelegate == null)
|
|
108
108
|
{
|
|
@@ -136,15 +136,23 @@ namespace TapSDK.Core.Standalone.Internal.Http
|
|
|
136
136
|
sb.AppendLine($"\t{header.Key}: {string.Join(",", header.Value.ToArray())}");
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
string contentString = null;
|
|
140
|
+
try
|
|
141
|
+
{
|
|
142
|
+
contentString = request.Content.ReadAsStringAsync().Result;
|
|
143
|
+
}
|
|
144
|
+
catch (Exception)
|
|
145
|
+
{
|
|
146
|
+
}
|
|
147
|
+
if (!string.IsNullOrEmpty(contentString))
|
|
140
148
|
{
|
|
141
|
-
sb.AppendLine($"Content: \n{
|
|
149
|
+
sb.AppendLine($"Content: \n{contentString}");
|
|
142
150
|
}
|
|
143
151
|
sb.AppendLine("=== HTTP Request End ===");
|
|
144
152
|
tapLog.Log($"HTTP Request [{request.RequestUri.PathAndQuery}]", sb.ToString());
|
|
145
153
|
}
|
|
146
154
|
|
|
147
|
-
public static void PrintResponse(HttpResponseMessage response
|
|
155
|
+
public static void PrintResponse(HttpResponseMessage response)
|
|
148
156
|
{
|
|
149
157
|
if (TapLogger.LogDelegate == null)
|
|
150
158
|
{
|
|
@@ -154,9 +162,17 @@ namespace TapSDK.Core.Standalone.Internal.Http
|
|
|
154
162
|
sb.AppendLine("=== HTTP Response Start ===");
|
|
155
163
|
sb.AppendLine($"URL: {response.RequestMessage.RequestUri}");
|
|
156
164
|
sb.AppendLine($"Status Code: {response.StatusCode}");
|
|
157
|
-
|
|
165
|
+
string contentString = null;
|
|
166
|
+
try
|
|
167
|
+
{
|
|
168
|
+
contentString = response.Content.ReadAsStringAsync().Result;
|
|
169
|
+
}
|
|
170
|
+
catch (Exception)
|
|
171
|
+
{
|
|
172
|
+
}
|
|
173
|
+
if (!string.IsNullOrEmpty(contentString))
|
|
158
174
|
{
|
|
159
|
-
sb.AppendLine($"Content: {
|
|
175
|
+
sb.AppendLine($"Content: {contentString}");
|
|
160
176
|
}
|
|
161
177
|
sb.AppendLine("=== HTTP Response End ===");
|
|
162
178
|
tapLog.Log($"HTTP Response [{response.RequestMessage.RequestUri.PathAndQuery}]", sb.ToString());
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using Newtonsoft.Json;
|
|
4
|
+
using TapSDK.Core.Internal.Log;
|
|
5
|
+
|
|
6
|
+
namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
7
|
+
{
|
|
8
|
+
public class TapAppDurationStandalone
|
|
9
|
+
{
|
|
10
|
+
private const string MODULE_NAME = "app_duration";
|
|
11
|
+
|
|
12
|
+
private static readonly TapLog log = new TapLog("AppDuration");
|
|
13
|
+
|
|
14
|
+
public static void Enable()
|
|
15
|
+
{
|
|
16
|
+
#if UNITY_STANDALONE
|
|
17
|
+
log.Log("Enable");
|
|
18
|
+
List<string> modules = new List<string> { MODULE_NAME };
|
|
19
|
+
TapOpenlogWrapper.TdkEnableModules(JsonConvert.SerializeObject(modules));
|
|
20
|
+
#endif
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static void Disable()
|
|
24
|
+
{
|
|
25
|
+
#if UNITY_STANDALONE
|
|
26
|
+
log.Log("Disable");
|
|
27
|
+
List<string> modules = new List<string> { MODULE_NAME };
|
|
28
|
+
TapOpenlogWrapper.TdkDisableModules(JsonConvert.SerializeObject(modules));
|
|
29
|
+
#endif
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public static void SetExtraAppDurationParams(Dictionary<string, string> param)
|
|
33
|
+
{
|
|
34
|
+
#if UNITY_STANDALONE
|
|
35
|
+
log.Log("SetExtraAppDurationParams param: ", JsonConvert.SerializeObject(param));
|
|
36
|
+
if (param == null)
|
|
37
|
+
{
|
|
38
|
+
log.Warning("SetExtraAppDurationParams param is null");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
TapOpenlogWrapper.TdkSetExtraAppDurationParams(JsonConvert.SerializeObject(param));
|
|
42
|
+
#endif
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public static void OnLogin(string openId)
|
|
46
|
+
{
|
|
47
|
+
#if UNITY_STANDALONE
|
|
48
|
+
log.Log("OnLogin openId: " + openId);
|
|
49
|
+
if (openId == null)
|
|
50
|
+
{
|
|
51
|
+
log.Warning("OnLogin openId is null");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
Dictionary<string, string> userInfo = new Dictionary<string, string>
|
|
55
|
+
{
|
|
56
|
+
{TapOpenlogParamConstants.PARAM_OPEN_ID, openId}
|
|
57
|
+
};
|
|
58
|
+
TapOpenlogWrapper.TdkOnLogin(JsonConvert.SerializeObject(userInfo));
|
|
59
|
+
#endif
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public static void OnLogout()
|
|
63
|
+
{
|
|
64
|
+
#if UNITY_STANDALONE
|
|
65
|
+
log.Log("OnLogout");
|
|
66
|
+
TapOpenlogWrapper.TdkOnLogout();
|
|
67
|
+
#endif
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public static void OnForeground()
|
|
71
|
+
{
|
|
72
|
+
#if UNITY_STANDALONE
|
|
73
|
+
log.Log("OnForeground");
|
|
74
|
+
TapOpenlogWrapper.TdkOnForeground();
|
|
75
|
+
#endif
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public static void OnBackground()
|
|
79
|
+
{
|
|
80
|
+
#if UNITY_STANDALONE
|
|
81
|
+
log.Log("OnBackground");
|
|
82
|
+
TapOpenlogWrapper.TdkOnBackground();
|
|
83
|
+
#endif
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public static string Version()
|
|
87
|
+
{
|
|
88
|
+
|
|
89
|
+
string v = null;
|
|
90
|
+
#if UNITY_STANDALONE
|
|
91
|
+
try
|
|
92
|
+
{
|
|
93
|
+
v = TapOpenlogWrapper.GetTdkVersion();
|
|
94
|
+
}
|
|
95
|
+
catch (Exception e)
|
|
96
|
+
{
|
|
97
|
+
log.Error("GetVersion error: " + e.Message);
|
|
98
|
+
}
|
|
99
|
+
log.Log("Version: " + v);
|
|
100
|
+
#endif
|
|
101
|
+
return v;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public static string GitCommit()
|
|
105
|
+
{
|
|
106
|
+
string v = null;
|
|
107
|
+
#if UNITY_STANDALONE
|
|
108
|
+
try
|
|
109
|
+
{
|
|
110
|
+
v = TapOpenlogWrapper.GetTdkGitCommit();
|
|
111
|
+
}
|
|
112
|
+
catch (Exception e)
|
|
113
|
+
{
|
|
114
|
+
log.Error("GitCommit error: " + e.Message);
|
|
115
|
+
}
|
|
116
|
+
log.Log("GitCommit: " + v);
|
|
117
|
+
#endif
|
|
118
|
+
return v;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -2,6 +2,7 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
2
2
|
{
|
|
3
3
|
internal class TapOpenlogParamConstants
|
|
4
4
|
{
|
|
5
|
+
public const string PARAM_ACTION = "action";
|
|
5
6
|
// 该条日志的唯一标识 d
|
|
6
7
|
public const string PARAM_T_LOG_ID = "t_log_id";
|
|
7
8
|
|
|
@@ -35,9 +36,6 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
35
36
|
// SDK 运行平台 g
|
|
36
37
|
public const string PARAM_PLATFORM = "platform";
|
|
37
38
|
|
|
38
|
-
// 埋点版本号(预留字段),当前全为1 g
|
|
39
|
-
public const string PARAM_TRACK_CODE = "track_code";
|
|
40
|
-
|
|
41
39
|
// SDK设置的地区,例如 zh_CN d
|
|
42
40
|
public const string PARAM_SDK_LOCALE = "sdk_locale";
|
|
43
41
|
|