com.taptap.sdk.core 4.5.1-beta.2 → 4.5.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.
@@ -4,12 +4,12 @@
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.5.1-beta.1"/>
7
+ <androidPackage spec="com.taptap.sdk:tap-core-unity:4.5.1"/>
8
8
  </androidPackages>
9
9
  <iosPods>
10
10
  <sources>
11
11
  <source>https://github.com/CocoaPods/Specs.git</source>
12
12
  </sources>
13
- <iosPod name="TapTapCoreSDK" version="~> 4.5.0" bitcodeEnabled="false" addToAllTargets="false"/>
13
+ <iosPod name="TapTapCoreSDK" version="~> 4.5.1" bitcodeEnabled="false" addToAllTargets="false"/>
14
14
  </iosPods>
15
15
  </dependencies>
@@ -2,10 +2,12 @@ using System;
2
2
  using System.Collections.Generic;
3
3
  using TapSDK.UI;
4
4
 
5
- namespace TapSDK.Core.Standalone
5
+ namespace TapSDK.Core.Internal.Utils
6
6
  {
7
7
  public sealed class EventManager : Singleton<EventManager>
8
8
  {
9
+ public const string OnApplicationPause = "OnApplicationPause";
10
+ public const string OnApplicationQuit = "OnApplicationQuit";
9
11
  private Dictionary<string, Action<object>> eventRegistries = new Dictionary<string, Action<object>>();
10
12
 
11
13
  public static void AddListener(string eventName, Action<object> listener) {
@@ -1,5 +1,5 @@
1
1
  fileFormatVersion: 2
2
- guid: 95f6670809a3746c3b679b19441b1f6e
2
+ guid: 3283bdf1ebdf64e859e7bcff4043ac04
3
3
  MonoImporter:
4
4
  externalObjects: {}
5
5
  serializedVersion: 2
@@ -14,6 +14,8 @@ namespace TapSDK.Core.Internal.Utils
14
14
 
15
15
  private static TapLoom _current;
16
16
  private int _count;
17
+
18
+ private bool isPause = false;
17
19
  public static TapLoom Current
18
20
  {
19
21
  get
@@ -151,5 +153,20 @@ namespace TapSDK.Core.Internal.Utils
151
153
  delayed.action();
152
154
  }
153
155
  }
156
+
157
+ private void OnApplicationPause(bool pauseStatus) {
158
+ if (pauseStatus && isPause == false) {
159
+ isPause = true;
160
+ EventManager.TriggerEvent(EventManager.OnApplicationPause, true);
161
+ }
162
+ else if (!pauseStatus && isPause) {
163
+ isPause = false;
164
+ EventManager.TriggerEvent(EventManager.OnApplicationPause, false);
165
+ }
166
+ }
167
+
168
+ private void OnApplicationQuit(){
169
+ EventManager.TriggerEvent(EventManager.OnApplicationQuit, true);
170
+ }
154
171
  }
155
172
  }
@@ -12,7 +12,7 @@ using System.ComponentModel;
12
12
 
13
13
  namespace TapSDK.Core {
14
14
  public class TapTapSDK {
15
- public static readonly string Version = "4.5.1-beta.2";
15
+ public static readonly string Version = "4.5.1";
16
16
 
17
17
  public static string SDKPlatform = "TapSDK-Unity";
18
18
 
@@ -36,8 +36,6 @@ namespace TapSDK.Core {
36
36
  public static void Init(TapTapSdkOptions coreOption) {
37
37
  if (coreOption == null)
38
38
  throw new ArgumentException("[TapSDK] options is null!");
39
- if (string.IsNullOrEmpty(coreOption.clientId))
40
- throw new ArgumentException("[TapSDK] clientID is null or empty!");
41
39
  TapTapSDK.taptapSdkOptions = coreOption;
42
40
  TapLog.Enabled = coreOption.enableLog;
43
41
  platformWrapper?.Init(coreOption);
@@ -60,8 +58,6 @@ namespace TapSDK.Core {
60
58
  public static void Init(TapTapSdkOptions coreOption, TapTapSdkBaseOptions[] otherOptions){
61
59
  if (coreOption == null)
62
60
  throw new ArgumentException("[TapSDK] options is null!");
63
- if (string.IsNullOrEmpty(coreOption.clientId))
64
- throw new ArgumentException("[TapSDK] clientID is null or empty!");
65
61
  long startTime = DateTime.Now.Ticks;
66
62
  TapTapSDK.taptapSdkOptions = coreOption;
67
63
  TapLog.Enabled = coreOption.enableLog;
@@ -124,26 +124,6 @@ namespace TapSDK.Core.Standalone.Internal
124
124
  }
125
125
  }
126
126
 
127
- // 获取系统的 ROM 存储容量,单位为 Byte
128
- public static string ROM
129
- {
130
- get
131
- {
132
- string path = Application.persistentDataPath;
133
- if (string.IsNullOrEmpty(path))
134
- return "0";
135
-
136
- try
137
- {
138
- System.IO.DriveInfo drive = new System.IO.DriveInfo(path);
139
- return drive.TotalSize.ToString();
140
- }
141
- catch (Exception)
142
- {
143
- return "0";
144
- }
145
- }
146
- }
147
127
 
148
128
  public static string Local
149
129
  {
@@ -2,8 +2,10 @@ using System;
2
2
  using System.Collections.Generic;
3
3
  using System.IO;
4
4
  using System.Runtime.InteropServices;
5
+ using AOT;
5
6
  using Newtonsoft.Json;
6
7
  using TapSDK.Core.Internal.Log;
8
+ using TapSDK.Core.Internal.Utils;
7
9
  using TapSDK.Core.Standalone.Internal.Http;
8
10
  using UnityEngine;
9
11
  #if UNITY_STANDALONE
@@ -32,9 +34,11 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
32
34
  InitOpenlogStartParameter();
33
35
  string openlogStartStr = JsonConvert.SerializeObject(openlogStartParameter);
34
36
  int result = TdkOnAppStarted(openlogStartStr, commonVariablesGetter, freeString);
37
+ BindWindowChange();
35
38
  #endif
36
39
  }
37
40
 
41
+ [MonoPInvokeCallback(typeof(Action))]
38
42
  private static IntPtr GetCommonVariables()
39
43
  {
40
44
  Dictionary<string, string> dynamicProperties = InflateDynamicProperties();
@@ -42,6 +46,7 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
42
46
  return Marshal.StringToHGlobalAnsi(jsonStr);
43
47
  }
44
48
 
49
+ [MonoPInvokeCallback(typeof(Action))]
45
50
  private static void FreeString(IntPtr intPtr)
46
51
  {
47
52
  if (intPtr != IntPtr.Zero)
@@ -50,6 +55,29 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
50
55
  }
51
56
  }
52
57
 
58
+ private static void BindWindowChange()
59
+ {
60
+ #if UNITY_STANDALONE
61
+ EventManager.AddListener(EventManager.OnApplicationPause, (isPause) =>
62
+ {
63
+ var isPauseBool = (bool)isPause;
64
+ if (isPauseBool)
65
+ {
66
+ TdkOnBackground();
67
+ }
68
+ else
69
+ {
70
+ TdkOnForeground();
71
+ }
72
+ });
73
+
74
+ EventManager.AddListener(EventManager.OnApplicationQuit, (quit) =>
75
+ {
76
+ TdkOnAppStopped();
77
+ });
78
+ #endif
79
+ }
80
+
53
81
  public TapOpenlogStandalone(string sdkProjectName, string sdkProjectVersion)
54
82
  {
55
83
  this.sdkProjectName = sdkProjectName;
@@ -211,7 +211,7 @@ namespace TapSDK.Core.Standalone.Internal {
211
211
  { "install_uuid", Identity.InstallationId },
212
212
  { "persist_uuid", Identity.PersistentId },
213
213
  { "ram", DeviceInfo.RAM },
214
- { "rom", DeviceInfo.ROM },
214
+ { "rom", "0" },
215
215
  { "width", Screen.currentResolution.width },
216
216
  { "height", Screen.currentResolution.height },
217
217
  { "provider", "unknown" },
package/link.xml ADDED
@@ -0,0 +1,4 @@
1
+ <linker>
2
+ <assembly fullname="TapSDK.Core.Runtime" preserve="all" />
3
+ <assembly fullname="TapSDK.Core.Mobile.Runtime" preserve="all" />
4
+ </linker>
package/link.xml.meta ADDED
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 1693bce61a5fc4665bf1afd68dbcad8b
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "com.taptap.sdk.core",
3
3
  "displayName": "TapTapSDK Core",
4
4
  "description": "TapTapSDK Core",
5
- "version": "4.5.1-beta.2",
5
+ "version": "4.5.1",
6
6
  "unity": "2019.4",
7
7
  "license": "MIT",
8
8
  "dependencies": {