Compare commits
3 Commits
c0b6ccf7ed
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c0509da0fc | |||
| c9fe482c8c | |||
| 92d04aba61 |
@@ -44,8 +44,6 @@ import org.json.JSONObject;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import kotlinx.serialization.json.Json;
|
|
||||||
|
|
||||||
public class SDKManager {
|
public class SDKManager {
|
||||||
|
|
||||||
private final static Handler handler = new Handler(Looper.getMainLooper());
|
private final static Handler handler = new Handler(Looper.getMainLooper());
|
||||||
@@ -124,6 +122,7 @@ public class SDKManager {
|
|||||||
|
|
||||||
public static void UnityResetServerUrl(String url) {
|
public static void UnityResetServerUrl(String url) {
|
||||||
SDKLog.i("UnityResetServerUrl : " + url);
|
SDKLog.i("UnityResetServerUrl : " + url);
|
||||||
|
SetDNSIPsEnable(false);
|
||||||
SDKAPI.getIns().updateServer(url);
|
SDKAPI.getIns().updateServer(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,6 +560,18 @@ public class SDKManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetDNSIPsEnable(boolean enable) {
|
||||||
|
SDKAPI.enableDoh(enable);
|
||||||
|
if(enable) {
|
||||||
|
SDKAPI.setHttpDnsIps(new String[]{
|
||||||
|
"34.111.1.231",
|
||||||
|
"2600:1901:0:c31b::"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
SDKAPI.setHttpDnsIps(new String[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public class TYApp extends Application {
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
SDKAPI.getIns().onApplicationCreate(this);
|
SDKAPI.getIns().onApplicationCreate(this);
|
||||||
|
SDKManager.SetDNSIPsEnable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -19,4 +20,5 @@ public class TYApp extends Application {
|
|||||||
super.attachBaseContext(base);
|
super.attachBaseContext(base);
|
||||||
SDKAPI.getIns().onAttachBaseContext(base, this);
|
SDKAPI.getIns().onAttachBaseContext(base, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -38,8 +38,7 @@ namespace tysdk
|
|||||||
{"google", EAccoutType.hwGoogle},
|
{"google", EAccoutType.hwGoogle},
|
||||||
{"fb", EAccoutType.hwFacebook},
|
{"fb", EAccoutType.hwFacebook},
|
||||||
{"tyGuest", EAccoutType.hwGuest},
|
{"tyGuest", EAccoutType.hwGuest},
|
||||||
{"ios13", EAccoutType.Apple},
|
{"ios13", EAccoutType.Apple}
|
||||||
{AccountString.hwVkid, EAccoutType.hwVkid}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private static EAccoutType ConvertAccoutType(string accountType)
|
private static EAccoutType ConvertAccoutType(string accountType)
|
||||||
@@ -365,6 +364,13 @@ namespace tysdk
|
|||||||
UnityBridgeFunc.CleanLinkTmpSnsInfo();
|
UnityBridgeFunc.CleanLinkTmpSnsInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
public async Task<ChangeLinkResult> ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
||||||
|
{
|
||||||
|
await Task.Delay(300);
|
||||||
|
return new ChangeLinkResult(){code = 1};
|
||||||
|
}
|
||||||
|
#elif UNITY_IOS || UNITY_ANDROID
|
||||||
public async Task<ChangeLinkResult> ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
public async Task<ChangeLinkResult> ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
||||||
{
|
{
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<ChangeLinkResult>(TimeSpan.FromSeconds(30));
|
var task = TYSDKCallbackManager.Instance.RegisterCallback<ChangeLinkResult>(TimeSpan.FromSeconds(30));
|
||||||
@@ -389,6 +395,7 @@ namespace tysdk
|
|||||||
CleanLinkTempSnSInfo();
|
CleanLinkTempSnSInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public void ChangeLinkAccountResult(string message)
|
public void ChangeLinkAccountResult(string message)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,12 +14,6 @@ namespace tysdk
|
|||||||
none
|
none
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AccountString
|
|
||||||
{
|
|
||||||
public const string hwVkid = "vk.global.app";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class LoginInfo
|
public class LoginInfo
|
||||||
{
|
{
|
||||||
public bool isSuccess;
|
public bool isSuccess;
|
||||||
|
|||||||
@@ -7,13 +7,7 @@ namespace tysdk
|
|||||||
|
|
||||||
public static class UnityBridgeFunc
|
public static class UnityBridgeFunc
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR || UNITY_ANDROID
|
|
||||||
private static string EAccountTypeToStr(EAccoutType accountType)
|
|
||||||
{
|
|
||||||
return accountType == EAccoutType.hwVkid ? AccountString.hwVkid : accountType.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
//初始化sdk
|
//初始化sdk
|
||||||
public static void InitSDK(){}
|
public static void InitSDK(){}
|
||||||
@@ -68,6 +62,8 @@ namespace tysdk
|
|||||||
public static void FBShareLink(string title, string content, string url) { }
|
public static void FBShareLink(string title, string content, string url) { }
|
||||||
public static void MessengerShareLink(string title, string content, string url) { }
|
public static void MessengerShareLink(string title, string content, string url) { }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#elif UNITY_ANDROID
|
#elif UNITY_ANDROID
|
||||||
|
|
||||||
private static string SDK_CLASS = "com.unity3d.player.SDKManager";
|
private static string SDK_CLASS = "com.unity3d.player.SDKManager";
|
||||||
@@ -111,12 +107,10 @@ namespace tysdk
|
|||||||
|
|
||||||
public static void UnityLogin(EAccoutType accoutType)
|
public static void UnityLogin(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
var accountInfo = EAccountTypeToStr(accoutType);
|
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("UnityLogin",accountInfo);
|
sdkManager.CallStatic("UnityLogin", accoutType.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UnityGetIdentityFun(string type)
|
public static void UnityGetIdentityFun(string type)
|
||||||
@@ -130,20 +124,18 @@ namespace tysdk
|
|||||||
public static void UnityLogOutByChannel(EAccoutType accoutType)
|
public static void UnityLogOutByChannel(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
|
|
||||||
var accountInfo = EAccountTypeToStr(accoutType);
|
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("UnityLogOutByChannel", accountInfo);
|
sdkManager.CallStatic("UnityLogOutByChannel", accoutType.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LinkAccount(EAccoutType accoutType)
|
public static void LinkAccount(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
string userId = TYSdkFacade.TYAccountInfo.strUserId;
|
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
|
||||||
{
|
{
|
||||||
var accountInfo = EAccountTypeToStr(accoutType);
|
string userId = TYSdkFacade.TYAccountInfo.strUserId;
|
||||||
sdkManager.CallStatic("LinkAccount",accountInfo,userId);
|
sdkManager.CallStatic("LinkAccount", accoutType.ToString(), userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,19 +151,17 @@ namespace tysdk
|
|||||||
|
|
||||||
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
|
||||||
{
|
{
|
||||||
var accountInfo = EAccountTypeToStr(accoutType);
|
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
using (var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("ChangeLinkAccount", accountInfo, oldUserId, newUserId);
|
sdkManager.CallStatic("ChangeLinkAccount", accoutType.ToString(), oldUserId, newUserId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LinkCheck(EAccoutType accoutType)
|
public static void LinkCheck(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
var accountInfo = EAccountTypeToStr(accoutType);
|
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("LinkCheck",accountInfo);
|
sdkManager.CallStatic("LinkCheck", accoutType.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +232,6 @@ namespace tysdk
|
|||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
{
|
{
|
||||||
sdkManager.CallStatic("Review");
|
sdkManager.CallStatic("Review");
|
||||||
// sdkManager.CallStataic("RuStoreReview");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user