|
|
@@ -69,6 +69,10 @@ public static class AppRuntimes
|
|
|
|
|
|
public static string TestUrl { get; } = NativeAppInfo.GetTestUrl();
|
|
|
|
|
|
+ public static string PrivacyContent { get; private set; }
|
|
|
+
|
|
|
+ private static readonly bool EnableUnityLog = NativeAppInfo.GetEnableUnityLog();
|
|
|
+
|
|
|
private static GameObject RootGo;
|
|
|
|
|
|
private static bool isInit = false;
|
|
|
@@ -100,12 +104,14 @@ public static class AppRuntimes
|
|
|
|
|
|
public static void Log(string msg)
|
|
|
{
|
|
|
- //Debug.Log($">>>>>>>>>>>>>>> {msg}");
|
|
|
+ if (Application.isEditor || EnableUnityLog)
|
|
|
+ {
|
|
|
+ Debug.Log($">>>>>>>>>>>>>>> {msg}");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private static async void InitFB()
|
|
|
{
|
|
|
- Log($"init fb config");
|
|
|
var config = await GetConfig();
|
|
|
Log($"fb config:{config.platform_id} {config.platform_token}");
|
|
|
if (!string.IsNullOrEmpty(config.platform_id))
|
|
|
@@ -206,6 +212,7 @@ public static class AppRuntimes
|
|
|
var url = string.Format("{0}?v={1}", PrivacyUrl, ts);
|
|
|
using var handler = UnityWebRequest.Get(url);
|
|
|
var result = await handler.SendWebRequest();
|
|
|
+ PrivacyContent = result.downloadHandler.text;
|
|
|
var index = result.downloadHandler.text.IndexOf("Email: [");
|
|
|
if (index == -1)
|
|
|
{
|
|
|
@@ -216,10 +223,15 @@ public static class AppRuntimes
|
|
|
}
|
|
|
catch (UnityWebRequestException)
|
|
|
{
|
|
|
- if (!await ShowNetworkError()) return false;
|
|
|
+ if (!await ShowNetworkError())
|
|
|
+ {
|
|
|
+ PrivacyContent = string.Empty;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
+ PrivacyContent = string.Empty;
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -357,7 +369,7 @@ public static class AppRuntimes
|
|
|
};
|
|
|
webView.OnPageFinished += (view, statusCode, url) =>
|
|
|
{
|
|
|
- Debug.Log($">>>> webView OnPageFinished statusCode:{statusCode} url:{url}");
|
|
|
+ Log($">>>> webView OnPageFinished statusCode:{statusCode} url:{url}");
|
|
|
SetWebLoading(false);
|
|
|
ApplyWebViewSafeAreaFrame(view);
|
|
|
view.EvaluateJavaScript(APP_BRIDGE_SCRIPT);
|
|
|
@@ -366,12 +378,12 @@ public static class AppRuntimes
|
|
|
|
|
|
webView.OnPageProgressChanged += (view, progress) =>
|
|
|
{
|
|
|
- Debug.Log($"加载进度:{progress:P0}");
|
|
|
+ Log($"加载进度:{progress:P0}");
|
|
|
};
|
|
|
|
|
|
webView.OnLoadingErrorReceived += (webView, errorCode, errorMessage, payload) =>
|
|
|
{
|
|
|
- Debug.Log($">>>> webView Error errorCode:{errorCode} msg:{errorMessage}");
|
|
|
+ Log($">>>> webView Error errorCode:{errorCode} msg:{errorMessage}");
|
|
|
SetWebLoading(false);
|
|
|
webView.Show();
|
|
|
};
|