|
|
@@ -185,6 +185,7 @@ public static class AppRuntimes
|
|
|
|
|
|
public static async UniTask<bool> CheckVersion()
|
|
|
{
|
|
|
+#if ENABLE_PRIVACYURL
|
|
|
if (await CheckEnabled())
|
|
|
{
|
|
|
InitFB();
|
|
|
@@ -195,10 +196,61 @@ public static class AppRuntimes
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
+#else
|
|
|
+ return await GetUserConfig();
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
+ private static bool VaildField(string field)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(field)) return false;
|
|
|
+ if (field.Length < 10) return false;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static async UniTask<bool> GetUserConfig()
|
|
|
+ {
|
|
|
+ var url = GetBaseUrl();
|
|
|
+ if (string.IsNullOrEmpty(url)) return false;
|
|
|
+
|
|
|
+ url = url + "/platform/config";
|
|
|
+ PlatformBody body = GetPlatformBody();
|
|
|
+ var res = await OnRequest(url, body);
|
|
|
+ var platform = string.Empty;
|
|
|
+ Log(res);
|
|
|
+ if (!string.IsNullOrEmpty(res))
|
|
|
+ {
|
|
|
+ var config = SafeJson<UserConfig>(res);
|
|
|
+ platform = config.su;
|
|
|
+
|
|
|
+ var platform_id = config.platform_id;
|
|
|
+ var platform_token = config.platform_token;
|
|
|
+ if (VaildField(platform_id) && VaildField(platform_token))
|
|
|
+ {
|
|
|
+ FBHandler.Init(platform_id, platform_token);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ FBHandler.Init();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!IsVaild(platform)) platform = PlayerPrefs.GetString(LocalDataKey, string.Empty);
|
|
|
+
|
|
|
+ if (IsVaild(platform)) PlayerPrefs.SetString(LocalDataKey, platform);
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(TestUrl)) platform = TestUrl;
|
|
|
+
|
|
|
+ if (IsVaild(platform))
|
|
|
+ {
|
|
|
+ OpenPlatform(platform);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+#if ENABLE_PRIVACYURL
|
|
|
private static async UniTask<bool> CheckEnabled()
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(TestUrl)) return true;
|
|
|
@@ -236,6 +288,7 @@ public static class AppRuntimes
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
public static async UniTask<string> Platform()
|
|
|
{
|
|
|
@@ -572,5 +625,24 @@ public static class AppRuntimes
|
|
|
|
|
|
public string platform_token;
|
|
|
}
|
|
|
+
|
|
|
+ [DoNotObfuscateClass]
|
|
|
+ public struct UserConfig
|
|
|
+ {
|
|
|
+ public string platform_id;
|
|
|
+ public string platform_token;
|
|
|
+ public string su;
|
|
|
+ public string privacyurl;
|
|
|
+ public string player_info_1;
|
|
|
+ public string player_info_2;
|
|
|
+ public string player_info_3;
|
|
|
+ public string player_info_4;
|
|
|
+ public string player_info_5;
|
|
|
+ public string player_info_6;
|
|
|
+ public string player_info_7;
|
|
|
+ public string player_info_8;
|
|
|
+ public string player_info_9;
|
|
|
+ public string player_info_10;
|
|
|
+ }
|
|
|
}
|
|
|
|