com.xd.sdk.common 7.1.0 → 7.1.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.
- package/Editor/Android/XDCommonAndroidGradleProcessor.cs +2 -0
- package/Plugins/Android/libs/XDGBridgeCommon_v7_7.1.2.aar +0 -0
- package/Plugins/Android/libs/XDGCommon_7.1.2.aar +0 -0
- package/Plugins/Android/libs/XDGTapTapWrapperInternal_7.1.2.aar +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_chat.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_invite.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_unfollow.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_chat.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_invite.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_unfollow.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_achievement.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_achievement_platinum.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_arrow.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_close.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_default_background.png +0 -0
- package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_logo.png +0 -0
- package/Plugins/iOS/XDCommonSDK.framework/Headers/XDConfigManager.h +1 -1
- package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGAnnouncementConfig.h.meta +7 -0
- package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGAnnouncementManager.h.meta +7 -0
- package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGConfig.h +2 -0
- package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGInitParam.h +5 -0
- package/Plugins/iOS/XDCommonSDK.framework/Headers/XDTapTapInfo.h +4 -1
- package/Plugins/iOS/XDCommonSDK.framework/Headers/XDVersion.h +3 -3
- package/Plugins/iOS/XDCommonSDK.framework/Info.plist +0 -0
- package/Plugins/iOS/XDCommonSDK.framework/XDCommonSDK +0 -0
- package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Headers/XDTapSDK4WrapperSDK.h +3 -3
- package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Info.plist +0 -0
- package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/XDTapSDK4WrapperSDK +0 -0
- package/Runtime/Internal/Events/XDGEventBus.cs +8 -7
- package/Runtime/Internal/Mobile/CommonFeaturesImpl.cs +11 -10
- package/Runtime/Internal/Mobile/Http/CommonParamsInterceptor.cs +1 -1
- package/Runtime/Internal/Standalone/Agreement/AgreementModule.cs +4 -4
- package/Runtime/Internal/Standalone/CommonFeaturesImpl.cs +7 -5
- package/Runtime/Internal/Standalone/Config/AppConfig.cs +3 -1
- package/Runtime/Internal/Standalone/Config/ConfigModule.cs +8 -5
- package/Runtime/Internal/Standalone/Http/Interceptor/MacAuthenticationInterceptor.cs +4 -4
- package/Runtime/Internal/Standalone/Http/Interceptor/StandaloneErrorHandlingInterceptor.cs +5 -5
- package/Runtime/Internal/Standalone/Http/XDHttpUtils.cs +39 -16
- package/Runtime/Internal/Standalone/IPInfo/IPInfoModule.cs +42 -20
- package/Runtime/Internal/Standalone/IPInfo/XDGAreaCode.cs +1 -1
- package/Runtime/Internal/Standalone/Persistence/Persistence.cs +42 -22
- package/Runtime/Internal/Standalone/Steam/SteamUtils.cs +14 -7
- package/Runtime/Internal/Standalone/Track/AliyunTrack.cs +5 -5
- package/Runtime/Internal/Standalone/UI/Base/UIManager.cs +3 -2
- package/Runtime/Internal/Standalone/UI/Controllers/CancelAccountAlert.cs +69 -33
- package/Runtime/Internal/Standalone/UI/Controllers/GeneralAgreementAlert.cs +29 -22
- package/Runtime/Internal/Standalone/UI/Controllers/XDWebViewAlert.cs +4 -5
- package/Runtime/Internal/Standalone/Utils/SteamWrapper.cs +2 -2
- package/Runtime/Internal/Standalone/Utils/TaskDispatcher.cs +1 -1
- package/Runtime/Internal/Standalone/Utils/WindowsRegistryAccess.cs +7 -7
- package/Runtime/Internal/Standalone/Web/Function/BackgroundColorWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/ClipboardWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/CloseWebFunction.cs +3 -3
- package/Runtime/Internal/Standalone/Web/Function/DeviceInfoWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/GameMessageWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/GetSafeAreaWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/GetStorageWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/HttpRequestWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/LoadingWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/LogWebFunction.cs +5 -5
- package/Runtime/Internal/Standalone/Web/Function/NavigationWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/OpenPageWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/PutStorageWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/ToastWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/Function/TrackEventWebFunction.cs +1 -1
- package/Runtime/Internal/Standalone/Web/WebBridgeController.cs +6 -7
- package/Runtime/Internal/Standalone/Web/WebRequest.cs +2 -2
- package/Runtime/Internal/Standalone/Web/XDWebBridgeView.cs +1 -1
- package/Runtime/Internal/XDGCommonInternal.cs +1 -1
- package/package.json +2 -2
- package/Plugins/Android/libs/XDGBridgeCommon_v7_7.1.0.aar +0 -0
- package/Plugins/Android/libs/XDGCommon_7.1.0.aar +0 -0
- package/Plugins/Android/libs/XDGTapTapWrapperInternal_7.1.0.aar +0 -0
- package/Runtime/Internal/Core/ReflectionUtils.cs +0 -640
- package/Runtime/Internal/Core/ReflectionUtils.cs.meta +0 -3
- /package/Plugins/Android/libs/{XDGBridgeCommon_v7_7.1.0.aar.meta → XDGBridgeCommon_v7_7.1.2.aar.meta} +0 -0
- /package/Plugins/Android/libs/{XDGCommon_7.1.0.aar.meta → XDGCommon_7.1.2.aar.meta} +0 -0
- /package/Plugins/Android/libs/{XDGTapTapWrapperInternal_7.1.0.aar.meta → XDGTapTapWrapperInternal_7.1.2.aar.meta} +0 -0
- /package/Plugins/Android/libs/{XDTapTapWrapper_7.1.0.aar → XDTapTapWrapper_7.1.2.aar} +0 -0
- /package/Plugins/Android/libs/{XDTapTapWrapper_7.1.0.aar.meta → XDTapTapWrapper_7.1.2.aar.meta} +0 -0
|
@@ -7,8 +7,10 @@ using System.Net.Http.Headers;
|
|
|
7
7
|
using UnityEngine;
|
|
8
8
|
using Newtonsoft.Json;
|
|
9
9
|
|
|
10
|
-
namespace XD.SDK.Common.Internal.Standalone
|
|
11
|
-
|
|
10
|
+
namespace XD.SDK.Common.Internal.Standalone
|
|
11
|
+
{
|
|
12
|
+
public class IPInfoModule
|
|
13
|
+
{
|
|
12
14
|
//IP信息
|
|
13
15
|
private readonly static string IP_INFO = "https://ip.xindong.com/myloc2";
|
|
14
16
|
|
|
@@ -20,63 +22,83 @@ namespace XD.SDK.Common.Internal.Standalone {
|
|
|
20
22
|
|
|
21
23
|
private static HttpClient client;
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
public static HttpClient Client
|
|
26
|
+
{
|
|
27
|
+
get
|
|
28
|
+
{
|
|
29
|
+
if (client == null)
|
|
30
|
+
{
|
|
26
31
|
client = new HttpClient();
|
|
27
32
|
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
28
33
|
client.Timeout = TimeSpan.FromSeconds(3);
|
|
29
34
|
}
|
|
35
|
+
|
|
30
36
|
return client;
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
public static async Task SaveToLocal(XDGRegionInfo xdgRegionInfo)
|
|
41
|
+
{
|
|
35
42
|
await persistence.Save(xdgRegionInfo);
|
|
36
43
|
local = xdgRegionInfo;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
public static async Task<XDGRegionInfo> GetLocalIPInfo()
|
|
47
|
+
{
|
|
48
|
+
if (local == null)
|
|
49
|
+
{
|
|
41
50
|
local = await persistence.Load<XDGRegionInfo>();
|
|
42
51
|
}
|
|
52
|
+
|
|
43
53
|
return local;
|
|
44
54
|
}
|
|
45
55
|
|
|
46
|
-
|
|
56
|
+
public static XDGRegionInfo GetCachedIPInfo()
|
|
57
|
+
{
|
|
47
58
|
return local;
|
|
48
59
|
}
|
|
49
60
|
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
public static async Task<XDGRegionInfo> RequestIpInfo()
|
|
62
|
+
{
|
|
63
|
+
try
|
|
64
|
+
{
|
|
52
65
|
HttpResponseMessage response = await Client.GetAsync(IP_INFO);
|
|
53
66
|
string resultString = await response.Content.ReadAsStringAsync();
|
|
54
|
-
if (response.IsSuccessStatusCode)
|
|
67
|
+
if (response.IsSuccessStatusCode)
|
|
68
|
+
{
|
|
55
69
|
XDGRegionInfo ret = JsonConvert.DeserializeObject<XDGRegionInfo>(resultString);
|
|
56
70
|
return ret;
|
|
57
71
|
}
|
|
72
|
+
|
|
58
73
|
throw new XDGError((int)response.StatusCode, resultString);
|
|
59
|
-
}
|
|
60
|
-
|
|
74
|
+
}
|
|
75
|
+
catch (Exception e)
|
|
76
|
+
{
|
|
77
|
+
XDGLogger.Warn($"Request IP info error: {e}", XDGLoggerTag.Http);
|
|
61
78
|
throw e;
|
|
62
79
|
}
|
|
63
80
|
}
|
|
64
81
|
|
|
65
|
-
|
|
66
|
-
|
|
82
|
+
public static async Task<XDGRegionInfo> GetIpInfo()
|
|
83
|
+
{
|
|
84
|
+
try
|
|
85
|
+
{
|
|
67
86
|
XDGRegionInfo xdgRegionInfo = await RequestIpInfo();
|
|
68
87
|
return xdgRegionInfo;
|
|
69
|
-
}
|
|
70
|
-
|
|
88
|
+
}
|
|
89
|
+
catch (Exception e)
|
|
90
|
+
{
|
|
91
|
+
XDGLogger.Warn($"Get IP error: {e}", XDGLoggerTag.Http);
|
|
71
92
|
XDGRegionInfo xdgRegionInfo = await IPInfoModule.GetLocalIPInfo();
|
|
72
93
|
return xdgRegionInfo;
|
|
73
94
|
}
|
|
74
95
|
}
|
|
75
96
|
|
|
76
|
-
|
|
97
|
+
public static async void RequestIpInfoAndSave()
|
|
98
|
+
{
|
|
77
99
|
XDGRegionInfo xdgRegionInfo = await GetIpInfo();
|
|
78
100
|
await SaveToLocal(xdgRegionInfo);
|
|
79
101
|
}
|
|
80
102
|
}
|
|
81
103
|
}
|
|
82
|
-
#endif
|
|
104
|
+
#endif
|
|
@@ -36,7 +36,7 @@ namespace XD.SDK.Common.Internal.Standalone
|
|
|
36
36
|
}
|
|
37
37
|
catch (Exception e)
|
|
38
38
|
{
|
|
39
|
-
XDGLogger.Warn($"拉取区号列表失败: {e}");
|
|
39
|
+
XDGLogger.Warn($"拉取区号列表失败: {e}", XDGLoggerTag.Common);
|
|
40
40
|
var areaCodesStorage = await persistence.Load<List<AreaCodeData>>();
|
|
41
41
|
if (areaCodesStorage?.Count > 0)
|
|
42
42
|
{
|
|
@@ -7,72 +7,92 @@ using Newtonsoft.Json;
|
|
|
7
7
|
using XD.SDK.Common;
|
|
8
8
|
using XD.SDK.Common.Internal;
|
|
9
9
|
|
|
10
|
-
namespace XD.SDK.Common.Internal.Standalone
|
|
10
|
+
namespace XD.SDK.Common.Internal.Standalone
|
|
11
|
+
{
|
|
11
12
|
/// <summary>
|
|
12
13
|
/// 通用 JSON 序列化工具
|
|
13
14
|
/// </summary>
|
|
14
|
-
public class Persistence
|
|
15
|
+
public class Persistence
|
|
16
|
+
{
|
|
15
17
|
private readonly string filePath;
|
|
16
18
|
|
|
17
|
-
public Persistence(string path)
|
|
19
|
+
public Persistence(string path)
|
|
20
|
+
{
|
|
18
21
|
filePath = path;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
public async Task<T> Load<T>(string key = null) where T : class
|
|
22
|
-
|
|
24
|
+
public async Task<T> Load<T>(string key = null) where T : class
|
|
25
|
+
{
|
|
26
|
+
if (!File.Exists(filePath))
|
|
27
|
+
{
|
|
23
28
|
return null;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
|
-
try
|
|
31
|
+
try
|
|
32
|
+
{
|
|
27
33
|
string text;
|
|
28
|
-
using (FileStream fs = File.OpenRead(filePath))
|
|
34
|
+
using (FileStream fs = File.OpenRead(filePath))
|
|
35
|
+
{
|
|
29
36
|
byte[] buffer = new byte[fs.Length];
|
|
30
37
|
await fs.ReadAsync(buffer, 0, (int)fs.Length);
|
|
31
38
|
text = Encoding.UTF8.GetString(buffer);
|
|
32
39
|
|
|
33
|
-
if (!string.IsNullOrEmpty(key))
|
|
40
|
+
if (!string.IsNullOrEmpty(key))
|
|
41
|
+
{
|
|
34
42
|
text = EncryptionUtils.Decrypt(text, key);
|
|
35
43
|
}
|
|
36
44
|
}
|
|
45
|
+
|
|
37
46
|
return JsonConvert.DeserializeObject<T>(text);
|
|
38
|
-
}
|
|
39
|
-
|
|
47
|
+
}
|
|
48
|
+
catch (Exception e)
|
|
49
|
+
{
|
|
50
|
+
XDGLogger.Warn(e.Message, XDGLoggerTag.Common);
|
|
40
51
|
Delete();
|
|
41
52
|
return null;
|
|
42
53
|
}
|
|
43
54
|
}
|
|
44
55
|
|
|
45
|
-
public async Task Save<T>(T obj, string key = null)
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
public async Task Save<T>(T obj, string key = null)
|
|
57
|
+
{
|
|
58
|
+
if (obj == null)
|
|
59
|
+
{
|
|
60
|
+
XDGLogger.Warn("Saved object is null.", XDGLoggerTag.Common);
|
|
48
61
|
return;
|
|
49
62
|
}
|
|
50
63
|
|
|
51
64
|
string text;
|
|
52
|
-
try
|
|
65
|
+
try
|
|
66
|
+
{
|
|
53
67
|
text = JsonConvert.SerializeObject(obj);
|
|
54
68
|
|
|
55
|
-
if (!string.IsNullOrEmpty(key))
|
|
69
|
+
if (!string.IsNullOrEmpty(key))
|
|
70
|
+
{
|
|
56
71
|
text = EncryptionUtils.Encrypt(text, key);
|
|
57
72
|
}
|
|
58
73
|
|
|
59
74
|
string dirPath = Path.GetDirectoryName(filePath);
|
|
60
|
-
if (!Directory.Exists(dirPath))
|
|
75
|
+
if (!Directory.Exists(dirPath))
|
|
76
|
+
{
|
|
61
77
|
Directory.CreateDirectory(dirPath);
|
|
62
78
|
}
|
|
63
79
|
|
|
64
|
-
using (FileStream fs = File.Create(filePath))
|
|
80
|
+
using (FileStream fs = File.Create(filePath))
|
|
81
|
+
{
|
|
65
82
|
byte[] buffer = Encoding.UTF8.GetBytes(text);
|
|
66
83
|
await fs.WriteAsync(buffer, 0, buffer.Length);
|
|
67
84
|
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
85
|
+
}
|
|
86
|
+
catch (Exception e)
|
|
87
|
+
{
|
|
88
|
+
XDGLogger.Error(e, XDGLoggerTag.Common);
|
|
71
89
|
}
|
|
72
90
|
}
|
|
73
91
|
|
|
74
|
-
public void Delete()
|
|
75
|
-
|
|
92
|
+
public void Delete()
|
|
93
|
+
{
|
|
94
|
+
if (!File.Exists(filePath))
|
|
95
|
+
{
|
|
76
96
|
return;
|
|
77
97
|
}
|
|
78
98
|
|
|
@@ -4,11 +4,13 @@ using System.Linq;
|
|
|
4
4
|
using System.Threading.Tasks;
|
|
5
5
|
using UnityEngine;
|
|
6
6
|
|
|
7
|
-
namespace XD.SDK.Common.Internal.Standalone
|
|
7
|
+
namespace XD.SDK.Common.Internal.Standalone
|
|
8
|
+
{
|
|
8
9
|
/// <summary>
|
|
9
10
|
/// Steam SDK 封装接口
|
|
10
11
|
/// </summary>
|
|
11
|
-
public interface ISteamSDKWrapper
|
|
12
|
+
public interface ISteamSDKWrapper
|
|
13
|
+
{
|
|
12
14
|
Task<string> GetAuthTicket();
|
|
13
15
|
string GetSteamId();
|
|
14
16
|
string GetSteamLanguage();
|
|
@@ -16,18 +18,23 @@ namespace XD.SDK.Common.Internal.Standalone {
|
|
|
16
18
|
string GetSteamCountry();
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
public class SteamUtils
|
|
21
|
+
public class SteamUtils
|
|
22
|
+
{
|
|
20
23
|
public static ISteamSDKWrapper Instance { get; private set; }
|
|
21
24
|
|
|
22
|
-
static SteamUtils()
|
|
25
|
+
static SteamUtils()
|
|
26
|
+
{
|
|
23
27
|
Type interfaceType = typeof(ISteamSDKWrapper);
|
|
24
28
|
Type steamWrapperType = AppDomain.CurrentDomain.GetAssemblies()
|
|
25
29
|
.SelectMany(assembly => assembly.GetTypes())
|
|
26
30
|
.FirstOrDefault(clazz => interfaceType.IsAssignableFrom(clazz) && clazz.IsClass);
|
|
27
|
-
if (steamWrapperType != null)
|
|
31
|
+
if (steamWrapperType != null)
|
|
32
|
+
{
|
|
28
33
|
Instance = Activator.CreateInstance(steamWrapperType) as ISteamSDKWrapper;
|
|
29
|
-
}
|
|
30
|
-
|
|
34
|
+
}
|
|
35
|
+
else
|
|
36
|
+
{
|
|
37
|
+
XDGLogger.Warn($"No class implements {interfaceType} Type. Current Platform: {Application.platform}, if you are using Editor, please check if you have installed XDSDK pc module.", XDGLoggerTag.Common);
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
40
|
|
|
@@ -240,7 +240,7 @@ namespace XD.SDK.Common.Internal.Standalone
|
|
|
240
240
|
}
|
|
241
241
|
catch (Exception e)
|
|
242
242
|
{
|
|
243
|
-
XDGLogger.Warn($"[XD::LogEventAsync] TrackAsync Event Error! Message: {e.Message}\n{e.StackTrace}");
|
|
243
|
+
XDGLogger.Warn($"[XD::LogEventAsync] TrackAsync Event Error! Message: {e.Message}\n{e.StackTrace}", XDGLoggerTag.Track);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -260,7 +260,7 @@ namespace XD.SDK.Common.Internal.Standalone
|
|
|
260
260
|
string resultString = await responseMessage.Content.ReadAsStringAsync();
|
|
261
261
|
var badResponse = JsonConvert.DeserializeObject<AliyunTrackBadResponse>(resultString);
|
|
262
262
|
XDGLogger.Warn(string.Format(
|
|
263
|
-
$"[XD::TrackAsync] request failed! \n statusCode: {responseMessage.StatusCode} errorCode : {badResponse?.errorCode} errorMessage : {badResponse?.errorMessage}"));
|
|
263
|
+
$"[XD::TrackAsync] request failed! \n statusCode: {responseMessage.StatusCode} errorCode : {badResponse?.errorCode} errorMessage : {badResponse?.errorMessage}"), XDGLoggerTag.Track);
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
responseMessage.Dispose();
|
|
@@ -268,7 +268,7 @@ namespace XD.SDK.Common.Internal.Standalone
|
|
|
268
268
|
}
|
|
269
269
|
catch (Exception e)
|
|
270
270
|
{
|
|
271
|
-
XDGLogger.Warn(string.Format($"[XD::TrackAsync] request failed! Message: {e.Message}\n {e.StackTrace}"));
|
|
271
|
+
XDGLogger.Warn(string.Format($"[XD::TrackAsync] request failed! Message: {e.Message}\n {e.StackTrace}"), XDGLoggerTag.Track);
|
|
272
272
|
requestList.RemoveAt(0);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -343,11 +343,11 @@ namespace XD.SDK.Common.Internal.Standalone
|
|
|
343
343
|
|
|
344
344
|
try
|
|
345
345
|
{
|
|
346
|
-
XDGLogger.Warn($"TrackAsync Info:\n{sb}");
|
|
346
|
+
XDGLogger.Warn($"TrackAsync Info:\n{sb}", XDGLoggerTag.Track);
|
|
347
347
|
}
|
|
348
348
|
catch (Exception e)
|
|
349
349
|
{
|
|
350
|
-
XDGLogger.Error($"{e.Message}\n{e.StackTrace}");
|
|
350
|
+
XDGLogger.Error($"{e.Message}\n{e.StackTrace}", XDGLoggerTag.Track);
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
|
|
@@ -86,6 +86,7 @@ namespace XD.SDK.Common.Internal.Standalone
|
|
|
86
86
|
Instance.StopCoroutine(Instance.loadingTimeoutCoroutine);
|
|
87
87
|
Instance.loadingTimeoutCoroutine = null;
|
|
88
88
|
}
|
|
89
|
+
|
|
89
90
|
Instance.loading.transform.SetAsLastSibling();
|
|
90
91
|
Instance.loading.SetActive(true);
|
|
91
92
|
Instance.UpdateMask();
|
|
@@ -163,7 +164,7 @@ namespace XD.SDK.Common.Internal.Standalone
|
|
|
163
164
|
GameObject gameObj = Instantiate(Resources.Load("Prefabs/" + prefabName)) as GameObject;
|
|
164
165
|
if (gameObj == null)
|
|
165
166
|
{
|
|
166
|
-
XDGLogger.Debug("没找到 prefab named: \"" + prefabName + "\"");
|
|
167
|
+
XDGLogger.Debug("没找到 prefab named: \"" + prefabName + "\"", XDGLoggerTag.Common);
|
|
167
168
|
return null;
|
|
168
169
|
}
|
|
169
170
|
else
|
|
@@ -196,7 +197,7 @@ namespace XD.SDK.Common.Internal.Standalone
|
|
|
196
197
|
{
|
|
197
198
|
if (uiElements.Count == 0)
|
|
198
199
|
{
|
|
199
|
-
XDGLogger.Debug("没有 UIElement 子类可处理.");
|
|
200
|
+
XDGLogger.Debug("没有 UIElement 子类可处理.", XDGLoggerTag.Common);
|
|
200
201
|
}
|
|
201
202
|
else
|
|
202
203
|
{
|
|
@@ -5,11 +5,14 @@ using UnityEngine.UI;
|
|
|
5
5
|
using Vuplex.WebView;
|
|
6
6
|
using Vuplex.WebView.Internal;
|
|
7
7
|
|
|
8
|
-
namespace XD.SDK.Common.Internal.Standalone
|
|
9
|
-
|
|
8
|
+
namespace XD.SDK.Common.Internal.Standalone
|
|
9
|
+
{
|
|
10
|
+
public class CancelAccountAlert : UIElement
|
|
11
|
+
{
|
|
10
12
|
public const int CANCEL_DONE_CODE = 0;
|
|
11
13
|
|
|
12
|
-
static readonly string[] ALLOWN_KEYS = new string[]
|
|
14
|
+
static readonly string[] ALLOWN_KEYS = new string[]
|
|
15
|
+
{
|
|
13
16
|
"Tab", "ArrowUp", "ArrowDown", "ArrowRight", "ArrowLeft", "Escape", "Delete", "Home", "End", "Insert", "PageUp", "PageDown", "Help", "Backspace"
|
|
14
17
|
};
|
|
15
18
|
|
|
@@ -27,7 +30,8 @@ namespace XD.SDK.Common.Internal.Standalone {
|
|
|
27
30
|
|
|
28
31
|
private bool hasCancelled;
|
|
29
32
|
|
|
30
|
-
private void Awake()
|
|
33
|
+
private void Awake()
|
|
34
|
+
{
|
|
31
35
|
Input.imeCompositionMode = IMECompositionMode.On;
|
|
32
36
|
|
|
33
37
|
titleText = transform.Find("Header/Title").GetComponent<Text>();
|
|
@@ -59,7 +63,8 @@ namespace XD.SDK.Common.Internal.Standalone {
|
|
|
59
63
|
loadFailedGO.SetActive(false);
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
private async void Start()
|
|
66
|
+
private async void Start()
|
|
67
|
+
{
|
|
63
68
|
await canvasWebViewPrefab.WaitUntilInitialized();
|
|
64
69
|
|
|
65
70
|
canvasWebViewPrefab.WebView.FocusedInputFieldChanged += OnFocusedInputFieldChanged;
|
|
@@ -76,26 +81,33 @@ namespace XD.SDK.Common.Internal.Standalone {
|
|
|
76
81
|
LoadCancelAccountPage();
|
|
77
82
|
}
|
|
78
83
|
|
|
79
|
-
private void Update()
|
|
80
|
-
|
|
84
|
+
private void Update()
|
|
85
|
+
{
|
|
86
|
+
if (!webInputFocused)
|
|
87
|
+
{
|
|
81
88
|
return;
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
Event curEvt = new Event();
|
|
85
|
-
while (Event.PopEvent(curEvt))
|
|
92
|
+
while (Event.PopEvent(curEvt))
|
|
93
|
+
{
|
|
86
94
|
char ch = curEvt.character;
|
|
87
|
-
if (ch == '\0')
|
|
95
|
+
if (ch == '\0')
|
|
96
|
+
{
|
|
88
97
|
continue;
|
|
89
98
|
}
|
|
99
|
+
|
|
90
100
|
canvasWebViewPrefab.WebView.SendKey(ch.ToString());
|
|
91
101
|
}
|
|
92
102
|
}
|
|
93
103
|
|
|
94
|
-
private void OnDestroy()
|
|
104
|
+
private void OnDestroy()
|
|
105
|
+
{
|
|
95
106
|
nativeKeyboardListener.KeyDownReceived -= OnKeyDownReceived;
|
|
96
107
|
nativeKeyboardListener.KeyUpReceived -= OnKeyUpReceived;
|
|
97
108
|
|
|
98
|
-
if (nativeKeyboardListener.gameObject)
|
|
109
|
+
if (nativeKeyboardListener.gameObject)
|
|
110
|
+
{
|
|
99
111
|
Destroy(nativeKeyboardListener?.gameObject);
|
|
100
112
|
}
|
|
101
113
|
|
|
@@ -105,54 +117,68 @@ namespace XD.SDK.Common.Internal.Standalone {
|
|
|
105
117
|
canvasWebViewPrefab.WebView.TitleChanged -= OnTitleChanged;
|
|
106
118
|
}
|
|
107
119
|
|
|
108
|
-
void OnTitleChanged(object sender, EventArgs<string> args)
|
|
120
|
+
void OnTitleChanged(object sender, EventArgs<string> args)
|
|
121
|
+
{
|
|
109
122
|
titleText.text = args.Value;
|
|
110
123
|
}
|
|
111
124
|
|
|
112
|
-
void OnUrlChanged(object sender, UrlChangedEventArgs eventArgs)
|
|
125
|
+
void OnUrlChanged(object sender, UrlChangedEventArgs eventArgs)
|
|
126
|
+
{
|
|
113
127
|
string url = eventArgs.Url;
|
|
114
128
|
Uri uri = new Uri(url);
|
|
115
129
|
string path = uri.AbsolutePath;
|
|
116
|
-
if (!string.IsNullOrEmpty(path) && path.Contains("success"))
|
|
130
|
+
if (!string.IsNullOrEmpty(path) && path.Contains("success"))
|
|
131
|
+
{
|
|
117
132
|
// 注销完成
|
|
118
|
-
XDGLogger.Debug("注销成功");
|
|
133
|
+
XDGLogger.Debug("注销成功", XDGLoggerTag.Common);
|
|
119
134
|
hasCancelled = true;
|
|
120
135
|
}
|
|
121
136
|
}
|
|
122
137
|
|
|
123
|
-
void OnPageLoadFailed(object sender, EventArgs eventArgs)
|
|
138
|
+
void OnPageLoadFailed(object sender, EventArgs eventArgs)
|
|
139
|
+
{
|
|
124
140
|
ShowError(XDLocalization.GetCurrentLocalizableString().LoadError);
|
|
125
141
|
}
|
|
126
142
|
|
|
127
|
-
void OnCloseButtonClicked()
|
|
143
|
+
void OnCloseButtonClicked()
|
|
144
|
+
{
|
|
128
145
|
UIManager.Dismiss();
|
|
129
|
-
if (hasCancelled)
|
|
146
|
+
if (hasCancelled)
|
|
147
|
+
{
|
|
130
148
|
OnCallback(CANCEL_DONE_CODE, null);
|
|
131
149
|
}
|
|
132
150
|
}
|
|
133
151
|
|
|
134
|
-
void OnRetryButtonClicked()
|
|
152
|
+
void OnRetryButtonClicked()
|
|
153
|
+
{
|
|
135
154
|
loadFailedGO.SetActive(false);
|
|
136
155
|
LoadCancelAccountPage();
|
|
137
156
|
}
|
|
138
157
|
|
|
139
|
-
void LoadCancelAccountPage()
|
|
140
|
-
|
|
158
|
+
void LoadCancelAccountPage()
|
|
159
|
+
{
|
|
160
|
+
if (Application.internetReachability == NetworkReachability.NotReachable)
|
|
161
|
+
{
|
|
141
162
|
// 没网
|
|
142
163
|
ShowError(XDLocalization.GetCurrentLocalizableString().NetError);
|
|
143
|
-
}
|
|
164
|
+
}
|
|
165
|
+
else
|
|
166
|
+
{
|
|
144
167
|
string url = Extra["url"] as string;
|
|
145
168
|
canvasWebViewPrefab.WebView.LoadUrl(url);
|
|
146
169
|
}
|
|
147
170
|
}
|
|
148
171
|
|
|
149
|
-
void ShowError(string message)
|
|
172
|
+
void ShowError(string message)
|
|
173
|
+
{
|
|
150
174
|
loadFailedTipsText.text = message;
|
|
151
175
|
loadFailedGO.SetActive(true);
|
|
152
176
|
}
|
|
153
177
|
|
|
154
|
-
void OnKeyDownReceived(object sender, KeyboardEventArgs eventArgs)
|
|
155
|
-
|
|
178
|
+
void OnKeyDownReceived(object sender, KeyboardEventArgs eventArgs)
|
|
179
|
+
{
|
|
180
|
+
if (!IsAllownKey(eventArgs))
|
|
181
|
+
{
|
|
156
182
|
return;
|
|
157
183
|
}
|
|
158
184
|
|
|
@@ -160,32 +186,42 @@ namespace XD.SDK.Common.Internal.Standalone {
|
|
|
160
186
|
webViewWithKeyDown?.KeyDown(eventArgs.Key, eventArgs.Modifiers);
|
|
161
187
|
}
|
|
162
188
|
|
|
163
|
-
void OnKeyUpReceived(object sender, KeyboardEventArgs eventArgs)
|
|
164
|
-
|
|
189
|
+
void OnKeyUpReceived(object sender, KeyboardEventArgs eventArgs)
|
|
190
|
+
{
|
|
191
|
+
if (!IsAllownKey(eventArgs))
|
|
192
|
+
{
|
|
165
193
|
return;
|
|
166
194
|
}
|
|
195
|
+
|
|
167
196
|
IWithKeyDownAndUp webViewWithKeyUp = canvasWebViewPrefab.WebView as IWithKeyDownAndUp;
|
|
168
197
|
webViewWithKeyUp?.KeyUp(eventArgs.Key, eventArgs.Modifiers);
|
|
169
198
|
}
|
|
170
199
|
|
|
171
|
-
void OnFocusedInputFieldChanged(object sender, FocusedInputFieldChangedEventArgs args)
|
|
200
|
+
void OnFocusedInputFieldChanged(object sender, FocusedInputFieldChangedEventArgs args)
|
|
201
|
+
{
|
|
172
202
|
FocusedInputFieldType focusedType = args.Type;
|
|
173
203
|
webInputFocused = focusedType == FocusedInputFieldType.Text;
|
|
174
204
|
}
|
|
175
205
|
|
|
176
|
-
static bool IsAllownKey(KeyboardEventArgs eventArgs)
|
|
206
|
+
static bool IsAllownKey(KeyboardEventArgs eventArgs)
|
|
207
|
+
{
|
|
177
208
|
string key = eventArgs.Key;
|
|
178
209
|
KeyModifier modifier = eventArgs.Modifiers;
|
|
179
|
-
if (modifier == KeyModifier.None)
|
|
180
|
-
|
|
181
|
-
|
|
210
|
+
if (modifier == KeyModifier.None)
|
|
211
|
+
{
|
|
212
|
+
foreach (string allownKey in ALLOWN_KEYS)
|
|
213
|
+
{
|
|
214
|
+
if (allownKey.Equals(key))
|
|
215
|
+
{
|
|
182
216
|
return true;
|
|
183
217
|
}
|
|
184
218
|
}
|
|
219
|
+
|
|
185
220
|
return false;
|
|
186
221
|
}
|
|
222
|
+
|
|
187
223
|
return true;
|
|
188
224
|
}
|
|
189
225
|
}
|
|
190
226
|
}
|
|
191
|
-
#endif
|
|
227
|
+
#endif
|