refactor(tysdk): 重构SDK登录和绑定功能
- 重构iOS构建参数,添加调试构建选项 - 实现iOS调试构建菜单项,支持开发选项和调试连接 - 修复Android SDKManager中的snsInfo临时存储逻辑 - 添加清理临时snsInfo的方法实现 - 在iOS接口中添加登录类型存储和sns信息重新登录功能 - 重构账号绑定逻辑,统一处理不同平台的绑定流程 - 添加绑定失败时的登出回调处理 - 更新UnityBridgeFunc中的原生接口绑定 - 在测试脚本中添加初始化时清理临时sns信息
This commit is contained in:
@@ -133,13 +133,27 @@ public class BuildTool
|
|||||||
|
|
||||||
BuildParams bparams = new BuildParams()
|
BuildParams bparams = new BuildParams()
|
||||||
{
|
{
|
||||||
outPath = "../Bin"
|
outPath = "../Bin/tysdkTest.ipa"
|
||||||
};
|
};
|
||||||
|
|
||||||
BuildiOS(bparams);
|
BuildiOS(bparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void BuildiOS(BuildParams buildParams)
|
[MenuItem("Tools/Build iOS With Debug")]
|
||||||
|
public static void BuildiOSWithDebug()
|
||||||
|
{
|
||||||
|
|
||||||
|
BuildParams bparams = new BuildParams()
|
||||||
|
{
|
||||||
|
outPath = "../Bin/tysdkTest_debug.ipa",
|
||||||
|
};
|
||||||
|
|
||||||
|
var buildOptions = BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.WaitForPlayerConnection;
|
||||||
|
|
||||||
|
BuildiOS(bparams, buildOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void BuildiOS(BuildParams buildParams, BuildOptions buildOptions = BuildOptions.None)
|
||||||
{
|
{
|
||||||
|
|
||||||
var buildPlayerOptions = new BuildPlayerOptions
|
var buildPlayerOptions = new BuildPlayerOptions
|
||||||
@@ -148,7 +162,7 @@ public class BuildTool
|
|||||||
locationPathName = buildParams.outPath,
|
locationPathName = buildParams.outPath,
|
||||||
|
|
||||||
target = BuildTarget.iOS,
|
target = BuildTarget.iOS,
|
||||||
options = BuildOptions.None,
|
options = buildOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
var build_report = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
var build_report = BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public class UnbindTest : MonoBehaviour
|
|||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
UnityBridgeFunc.UnityResetServerUrl("https://128-hwsfsdk-sdk-test01.qijihdhk.com");
|
UnityBridgeFunc.UnityResetServerUrl("https://128-hwsfsdk-sdk-test01.qijihdhk.com");
|
||||||
|
TYSdkFacade.Instance.CleanLinkTempSnSInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLogout()
|
private void OnLogout()
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ public class SDKManager {
|
|||||||
SDKAPI.getIns().getSnsInfo(type, (snscode, snsInfo, snsmsg) ->{
|
SDKAPI.getIns().getSnsInfo(type, (snscode, snsInfo, snsmsg) ->{
|
||||||
if(snscode == SDKCallBack.CODE_SUCCESS && snsInfo !=null)
|
if(snscode == SDKCallBack.CODE_SUCCESS && snsInfo !=null)
|
||||||
{
|
{
|
||||||
tmpSnsInfo = snsInfo;
|
|
||||||
SDKAPI.getIns().bindBySnsId(snsInfo, userId, (bindcode, bindmsg)->{
|
SDKAPI.getIns().bindBySnsId(snsInfo, userId, (bindcode, bindmsg)->{
|
||||||
if(bindcode == SDKCallBack.CODE_SUCCESS)
|
if(bindcode == SDKCallBack.CODE_SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -214,6 +213,7 @@ public class SDKManager {
|
|||||||
// "userId":10030
|
// "userId":10030
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
tmpSnsInfo = snsInfo;
|
||||||
JSONObject checkMsgObj = new JSONObject(checkMsg);
|
JSONObject checkMsgObj = new JSONObject(checkMsg);
|
||||||
JSONObject checkResult = checkMsgObj.getJSONObject("result");
|
JSONObject checkResult = checkMsgObj.getJSONObject("result");
|
||||||
String bindInfo = checkResult.getString("bindInfo");
|
String bindInfo = checkResult.getString("bindInfo");
|
||||||
@@ -261,6 +261,11 @@ public class SDKManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void CleanLinkTmpSnsInfo()
|
||||||
|
{
|
||||||
|
tmpSnsInfo = null;
|
||||||
|
}
|
||||||
|
|
||||||
public static void LinkCheck(String type)
|
public static void LinkCheck(String type)
|
||||||
{
|
{
|
||||||
SDKAPI.getIns().getSnsInfo(type, (code, snsInfo, msg) -> {
|
SDKAPI.getIns().getSnsInfo(type, (code, snsInfo, msg) -> {
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
#define TOKEN_ERROR @"-8"
|
#define TOKEN_ERROR @"-8"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
// Store last login type for SNS re-login
|
||||||
|
static NSInteger g_snsLoginType = -1;
|
||||||
|
|
||||||
NSString* DicTojsonString(NSDictionary *dict)
|
NSString* DicTojsonString(NSDictionary *dict)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -33,11 +36,15 @@ extern "C" {
|
|||||||
[resultDict setValue:[NSString stringWithFormat:@"%ld", (long)resp.errCode] forKey:@"code"];
|
[resultDict setValue:[NSString stringWithFormat:@"%ld", (long)resp.errCode] forKey:@"code"];
|
||||||
[resultDict setValue:resp.errStr ? resp.errStr : @"" forKey:@"errStr"];
|
[resultDict setValue:resp.errStr ? resp.errStr : @"" forKey:@"errStr"];
|
||||||
if(resp.errCode == XYSuccess){
|
if(resp.errCode == XYSuccess){
|
||||||
[resultDict setValue:resp.respObj forKey:@"respObj"];
|
NSDictionary *respObjDict = (NSDictionary*)resp.respObj;
|
||||||
|
NSDictionary *resultDictData = (NSDictionary*)[respObjDict objectForKey:@"result"];
|
||||||
|
NSMutableDictionary *loginData = [resultDictData mutableCopy];
|
||||||
|
[resultDict setValue:loginData forKey:@"loginData"];
|
||||||
}
|
}
|
||||||
NSString *result = DicTojsonString(resultDict);
|
NSString *result = DicTojsonString(resultDict);
|
||||||
const char* param = AllocCString(result);
|
const char* param = AllocCString(result);
|
||||||
UnitySendMessage("TYSdkFacade","LoginResult", param);
|
UnitySendMessage("TYSdkFacade","LoginResult", param);
|
||||||
|
g_snsLoginType = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新登录支付域名
|
//更新登录支付域名
|
||||||
@@ -85,7 +92,6 @@ extern "C" {
|
|||||||
{
|
{
|
||||||
XYLoginReq *req = [XYLoginReq initWithLoginType:XYLoginWithGoogle];
|
XYLoginReq *req = [XYLoginReq initWithLoginType:XYLoginWithGoogle];
|
||||||
[XYApi XYLoginWith:req completionHandler:^(XYResp * _Nonnull resp) {
|
[XYApi XYLoginWith:req completionHandler:^(XYResp * _Nonnull resp) {
|
||||||
NSLog(@"TYSdkInterface UnityLoginByGoogle: %@", resp);
|
|
||||||
ProcessLoginResult(resp);
|
ProcessLoginResult(resp);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@@ -113,9 +119,64 @@ extern "C" {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* LoginTypeToStr(XYLoginType loginType)
|
||||||
|
{
|
||||||
|
switch (loginType) {
|
||||||
|
case XYLoginWithFB:
|
||||||
|
return AllocCString(@"hwFacebook");
|
||||||
|
case XYLoginWithApple:
|
||||||
|
return AllocCString(@"Apple");
|
||||||
|
case XYLoginWithGoogle:
|
||||||
|
return AllocCString(@"hwGoogle");
|
||||||
|
default:
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NSInteger BindTypeToLoginType(XYBindType bType)
|
||||||
|
{
|
||||||
|
switch (bType) {
|
||||||
|
case XYBindApple:
|
||||||
|
return XYLoginWithApple;
|
||||||
|
case XYBindFB:
|
||||||
|
return XYLoginWithFB;
|
||||||
|
case XYBindGoodle:
|
||||||
|
return XYLoginWithGoogle;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* UnityLoginBySnsInfo()
|
||||||
|
{
|
||||||
|
NSLog(@"TYSdkInterface UnityLoginBySnsInfo");
|
||||||
|
|
||||||
|
if(g_snsLoginType == -1)
|
||||||
|
{
|
||||||
|
NSLog(@"TYSdkInterface UnityLoginBySnsInfo - No stored login type");
|
||||||
|
UnitySendMessage("TYSdkFacade","LoginResult", "{\"code\":1}");
|
||||||
|
|
||||||
|
// Return empty string
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
NSLog(@"TYSdkInterface UnityLoginBySnsInfo - Re-login with type: %s", LoginTypeToStr((XYLoginType)g_snsLoginType));
|
||||||
|
|
||||||
|
// Re-login using the stored type
|
||||||
|
XYLoginReq *req = [XYLoginReq initWithLoginType:(XYLoginType)g_snsLoginType];
|
||||||
|
[XYApi XYLoginWith:req completionHandler:^(XYResp * _Nonnull resp) {
|
||||||
|
NSLog(@"TYSdkInterface UnityLoginBySnsInfo result: %@", resp);
|
||||||
|
ProcessLoginResult(resp);
|
||||||
|
}];
|
||||||
|
|
||||||
|
// Return the login type as C string
|
||||||
|
return LoginTypeToStr((XYLoginType)g_snsLoginType);
|
||||||
|
}
|
||||||
|
|
||||||
void UnityLoginOut()
|
void UnityLoginOut()
|
||||||
{
|
{
|
||||||
NSLog(@"TYSdkInterface UnityLoginOut");
|
NSLog(@"TYSdkInterface UnityLoginOut");
|
||||||
|
|
||||||
[XYApi XYLogoutWithCompletion:^(XYResp * _Nonnull resp) {
|
[XYApi XYLogoutWithCompletion:^(XYResp * _Nonnull resp) {
|
||||||
if(resp.errCode == XYSuccess)
|
if(resp.errCode == XYSuccess)
|
||||||
{
|
{
|
||||||
@@ -235,25 +296,83 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkGoogle(const int userId)
|
void CleanLinkTmpSnsInfo()
|
||||||
{
|
{
|
||||||
NSLog(@"TYSdkInterface LinkGoogle");
|
g_snsLoginType = -1;
|
||||||
NSDictionary * userDic = [XYApi XYGetCurrentUserDict];
|
}
|
||||||
XYBindReq *bindReq = [XYBindReq initBindWithPlatform:XYBindGoodle UserId: [ [userDic objectForKey:@"userId"] unsignedIntegerValue]];
|
|
||||||
|
// Helper function to handle account linking
|
||||||
|
typedef void(^LogoutCallback)(void);
|
||||||
|
|
||||||
|
void LinkAccountWithPlatform(NSString *platformName, XYBindType bindType, const int userId, LogoutCallback logoutCallback)
|
||||||
|
{
|
||||||
|
NSLog(@"TYSdkInterface Link%@ userId:%d", platformName, userId);
|
||||||
|
|
||||||
|
XYBindReq *bindReq = [XYBindReq initBindWithPlatform:bindType UserId:(NSUInteger)userId];
|
||||||
|
|
||||||
[XYApi XYBindByBindReq:bindReq isUnbindGuest:@"false" completionHandler:^(XYResp * _Nonnull resp) {
|
[XYApi XYBindByBindReq:bindReq isUnbindGuest:@"false" completionHandler:^(XYResp * _Nonnull resp) {
|
||||||
|
NSMutableDictionary *resultDict = [@{} mutableCopy];
|
||||||
|
|
||||||
if(resp.errCode == XYSuccess)
|
if(resp.errCode == XYSuccess)
|
||||||
{
|
{
|
||||||
NSLog(@"TYSdkInterface LinkGoogle Success");
|
NSLog(@"TYSdkInterface Link%@ Success", platformName);
|
||||||
UnitySendMessage("TYSdkFacade","LinkAccoutResult", "1");
|
NSDictionary *respObjDict = (NSDictionary*)resp.respObj;
|
||||||
|
NSDictionary *resultDictData = (NSDictionary*)[respObjDict objectForKey:@"result"];
|
||||||
|
NSMutableDictionary *loginData = [resultDictData mutableCopy];
|
||||||
|
|
||||||
|
[resultDict setValue:[NSString stringWithFormat:@"%ld", (long)resp.errCode] forKey:@"code"];
|
||||||
|
[resultDict setValue:[NSString stringWithFormat:@"%d", userId] forKey:@"userId"];
|
||||||
|
[resultDict setValue:loginData forKey:@"loginData"];
|
||||||
|
|
||||||
|
NSString *result = DicTojsonString(resultDict);
|
||||||
|
const char* param = AllocCString(result);
|
||||||
|
UnitySendMessage("TYSdkFacade","LinkAccoutResult", param);
|
||||||
|
}
|
||||||
|
else if(resp.errCode == XYErrCodeHadBind)
|
||||||
|
{
|
||||||
|
[XYApi CheckUserExist:bindType completion:^(XYResp * _Nonnull snscheckResp) {
|
||||||
|
if(snscheckResp.errCode != 0)
|
||||||
|
{
|
||||||
|
[resultDict setValue:@"1" forKey:@"code"];
|
||||||
|
[resultDict setValue:@"0" forKey:@"userId"];
|
||||||
|
NSString *result = DicTojsonString(resultDict);
|
||||||
|
const char* param = AllocCString(result);
|
||||||
|
UnitySendMessage("TYSdkFacade","LinkAccoutResult", param);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSLog(@"TYSdkInterface LinkGoogle Faild");
|
g_snsLoginType = BindTypeToLoginType(bindType);
|
||||||
UnityLogoutGoogle();
|
NSDictionary *respObjDict = (NSDictionary*)snscheckResp.respObj;
|
||||||
UnitySendMessage("TYSdkFacade","LinkAccoutResult", "0");
|
[resultDict setValue:@"-1" forKey:@"code"];
|
||||||
|
[resultDict setValue:[respObjDict objectForKey:@"bindInfo"] forKey:@"bindInfo"];
|
||||||
|
[resultDict setValue:[respObjDict objectForKey:@"userId"] forKey:@"userId"];
|
||||||
|
NSString *result = DicTojsonString(resultDict);
|
||||||
|
const char* param = AllocCString(result);
|
||||||
|
UnitySendMessage("TYSdkFacade","LinkAccoutResult", param);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSLog(@"TYSdkInterface Link%@ Failed errCode:%ld", platformName, (long)resp.errCode);
|
||||||
|
if (logoutCallback) {
|
||||||
|
logoutCallback();
|
||||||
|
}
|
||||||
|
[resultDict setValue:@"1" forKey:@"code"];
|
||||||
|
[resultDict setValue:@"0" forKey:@"userId"];
|
||||||
|
NSString *result = DicTojsonString(resultDict);
|
||||||
|
const char* param = AllocCString(result);
|
||||||
|
UnitySendMessage("TYSdkFacade","LinkAccoutResult", param);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinkGoogle(const int userId)
|
||||||
|
{
|
||||||
|
LinkAccountWithPlatform(@"Google", XYBindGoodle, userId, ^{
|
||||||
|
UnityLogoutGoogle();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void IsLinkedGoogle()
|
void IsLinkedGoogle()
|
||||||
{
|
{
|
||||||
@@ -275,23 +394,9 @@ extern "C" {
|
|||||||
|
|
||||||
void LinkFacebook(const int userId)
|
void LinkFacebook(const int userId)
|
||||||
{
|
{
|
||||||
NSLog(@"TYSdkInterface LinkFacebook");
|
LinkAccountWithPlatform(@"Facebook", XYBindFB, userId, ^{
|
||||||
NSDictionary * userDic = [XYApi XYGetCurrentUserDict];
|
|
||||||
XYBindReq *bindReq = [XYBindReq initBindWithPlatform:XYBindFB UserId: [ [userDic objectForKey:@"userId"] unsignedIntegerValue]];
|
|
||||||
[XYApi XYBindByBindReq:bindReq isUnbindGuest:@"false" completionHandler:^(XYResp * _Nonnull resp) {
|
|
||||||
if(resp.errCode == XYSuccess)
|
|
||||||
{
|
|
||||||
NSLog(@"TYSdkInterface LinkFacebook Success");
|
|
||||||
UnitySendMessage("TYSdkFacade","LinkAccoutResult", "1");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NSLog(@"TYSdkInterface LinkFacebook Faild");
|
|
||||||
UnityLogoutFacebook();
|
UnityLogoutFacebook();
|
||||||
UnitySendMessage("TYSdkFacade","LinkAccoutResult", "0");
|
});
|
||||||
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsLinkedFacebook()
|
void IsLinkedFacebook()
|
||||||
@@ -312,26 +417,11 @@ extern "C" {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkApple()
|
void LinkApple(const int userId)
|
||||||
{
|
{
|
||||||
|
LinkAccountWithPlatform(@"Apple", XYBindApple, userId, ^{
|
||||||
NSLog(@"TYSdkInterface LinkApple");
|
|
||||||
NSDictionary * userDic = [XYApi XYGetCurrentUserDict];
|
|
||||||
XYBindReq *bindReq = [XYBindReq initBindWithPlatform:XYBindApple UserId: [ [userDic objectForKey:@"userId"] unsignedIntegerValue]];
|
|
||||||
[XYApi XYBindByBindReq:bindReq isUnbindGuest:@"false" completionHandler:^(XYResp * _Nonnull resp) {
|
|
||||||
if(resp.errCode == XYSuccess)
|
|
||||||
{
|
|
||||||
NSLog(@"TYSdkInterface LinkApple Success");
|
|
||||||
UnitySendMessage("TYSdkFacade","LinkAccoutResult", "1");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NSLog(@"TYSdkInterface LinkApple Faild");
|
|
||||||
UnityLogoutApple();
|
UnityLogoutApple();
|
||||||
UnitySendMessage("TYSdkFacade","LinkAccoutResult", "0");
|
});
|
||||||
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsLinkedApple()
|
void IsLinkedApple()
|
||||||
|
|||||||
@@ -387,6 +387,10 @@ namespace tysdk
|
|||||||
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
public void CleanLinkTempSnSInfo()
|
||||||
|
{
|
||||||
|
UnityBridgeFunc.CleanLinkTmpSnsInfo();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查是否已经绑定
|
/// 检查是否已经绑定
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ namespace tysdk
|
|||||||
public static string UnityLoginBySnsInfoFun() => null;
|
public static string UnityLoginBySnsInfoFun() => null;
|
||||||
|
|
||||||
public static void UnityLogin(EAccoutType accoutType){}
|
public static void UnityLogin(EAccoutType accoutType){}
|
||||||
|
|
||||||
|
public static void CleanLinkTmpSnsInfo() { }
|
||||||
|
|
||||||
|
|
||||||
public static void LinkAccount(EAccoutType accoutType){}
|
public static void LinkAccount(EAccoutType accoutType){}
|
||||||
public static void UnlinkAccount(EAccoutType accoutType){}
|
public static void UnlinkAccount(EAccoutType accoutType){}
|
||||||
public static void LinkCheck(EAccoutType accoutType){}
|
public static void LinkCheck(EAccoutType accoutType){}
|
||||||
@@ -135,6 +139,16 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void CleanLinkTmpSnsInfo(){
|
||||||
|
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
|
{
|
||||||
|
using(var activityCls = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
|
||||||
|
{
|
||||||
|
sdkManager.CallStatic("CleanLinkTmpSnsInfo");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void UnlinkAccount(EAccoutType accoutType)
|
public static void UnlinkAccount(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
|
||||||
@@ -247,6 +261,23 @@ namespace tysdk
|
|||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
public static extern void UnityLoginByTokenFun(string token);
|
public static extern void UnityLoginByTokenFun(string token);
|
||||||
|
|
||||||
|
[DllImport("__Internal")]
|
||||||
|
private static extern IntPtr UnityLoginBySnsInfo();
|
||||||
|
|
||||||
|
public static string UnityLoginBySnsInfoFun()
|
||||||
|
{
|
||||||
|
IntPtr ptr = UnityLoginBySnsInfo();
|
||||||
|
|
||||||
|
if (ptr == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert C string to C# string
|
||||||
|
string result = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(ptr);
|
||||||
|
return result ?? string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public static void UnityLogin(EAccoutType accoutType)
|
public static void UnityLogin(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
switch (accoutType)
|
switch (accoutType)
|
||||||
@@ -317,16 +348,18 @@ namespace tysdk
|
|||||||
|
|
||||||
public static void LinkAccount(EAccoutType accoutType)
|
public static void LinkAccount(EAccoutType accoutType)
|
||||||
{
|
{
|
||||||
|
var userId = TYSdkFacade.TYAccountInfo.userId;
|
||||||
|
|
||||||
switch (accoutType)
|
switch (accoutType)
|
||||||
{
|
{
|
||||||
case EAccoutType.hwGoogle:
|
case EAccoutType.hwGoogle:
|
||||||
LinkGoogle();
|
LinkGoogle(userId);
|
||||||
break;
|
break;
|
||||||
case EAccoutType.hwFacebook:
|
case EAccoutType.hwFacebook:
|
||||||
LinkFacebook();
|
LinkFacebook(userId);
|
||||||
break;
|
break;
|
||||||
case EAccoutType.Apple:
|
case EAccoutType.Apple:
|
||||||
LinkApple();
|
LinkApple(userId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,11 +377,11 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("__Internal")] private static extern void LinkGoogle();
|
[DllImport("__Internal")] private static extern void LinkGoogle(int userId);
|
||||||
[DllImport("__Internal")] private static extern void UnlinkGoogle();
|
[DllImport("__Internal")] private static extern void UnlinkGoogle();
|
||||||
[DllImport("__Internal")] private static extern void LinkFacebook();
|
[DllImport("__Internal")] private static extern void LinkFacebook(int userId);
|
||||||
[DllImport("__Internal")] private static extern void UnlinkFacebook();
|
[DllImport("__Internal")] private static extern void UnlinkFacebook();
|
||||||
[DllImport("__Internal")] private static extern void LinkApple();
|
[DllImport("__Internal")] private static extern void LinkApple(int userId);
|
||||||
[DllImport("__Internal")] private static extern void UnlinkApple();
|
[DllImport("__Internal")] private static extern void UnlinkApple();
|
||||||
|
|
||||||
public static void LinkCheck(EAccoutType accoutType)
|
public static void LinkCheck(EAccoutType accoutType)
|
||||||
@@ -368,6 +401,8 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DllImport("__Internal")] public static extern void CleanLinkTmpSnsInfo();
|
||||||
|
|
||||||
[DllImport("__Internal")] private static extern void IsLinkedGoogle();
|
[DllImport("__Internal")] private static extern void IsLinkedGoogle();
|
||||||
[DllImport("__Internal")] private static extern void IsLinkedFacebook();
|
[DllImport("__Internal")] private static extern void IsLinkedFacebook();
|
||||||
[DllImport("__Internal")] private static extern void IsLinkedApple();
|
[DllImport("__Internal")] private static extern void IsLinkedApple();
|
||||||
|
|||||||
Reference in New Issue
Block a user