enhance ChangeLinkAccount functionality

- Added LoginTypeToBindType function to map login types to binding types.
- Updated ChangeLinkAccount method to handle account linking and unbinding with appropriate error handling.
- Ensured proper messaging for success and failure cases during account changes.
- Cleaned temporary SNS information after account change attempts.
This commit is contained in:
2026-03-30 21:49:14 +08:00
parent 9f5151c54c
commit 6866b7fca9
9 changed files with 694 additions and 60 deletions

View File

@@ -26,7 +26,7 @@ namespace tysdk
public static void LinkAccount(EAccoutType accoutType){}
public static void UnlinkAccount(EAccoutType accoutType){}
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId){}
public static void LinkCheck(EAccoutType accoutType){}
public static void UnityGetIdentityFun(string type){}
@@ -149,11 +149,11 @@ namespace tysdk
}
}
public static void UnlinkAccount(EAccoutType accoutType)
public static void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId)
{
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
{
sdkManager.CallStatic("UnlinkAccount", accoutType.ToString());
sdkManager.CallStatic("ChangeLinkAccount", accoutType.ToString(), oldUserId, newUserId);
}
}
@@ -298,16 +298,16 @@ namespace tysdk
}
[DllImport("__Internal")]
public static extern void UnityLoginByGuest();
private static extern void UnityLoginByGuest();
[DllImport("__Internal")]
public static extern void UnityLoginByGoogle();
private static extern void UnityLoginByGoogle();
[DllImport("__Internal")]
public static extern void UnityLoginByFacebook();
private static extern void UnityLoginByFacebook();
[DllImport("__Internal")]
public static extern void UnityLoginByApple();
private static extern void UnityLoginByApple();
[DllImport("__Internal")]
public static extern void UnityGetIdentityFun(string type);
@@ -364,25 +364,13 @@ namespace tysdk
}
}
public static void UnlinkAccount(EAccoutType accoutType)
{
switch (accoutType)
{
case EAccoutType.hwGoogle:
UnlinkGoogle();
break;
case EAccoutType.hwFacebook:
UnlinkFacebook();
break;
}
}
[DllImport("__Internal")] private static extern void LinkGoogle(int userId);
[DllImport("__Internal")] private static extern void UnlinkGoogle();
[DllImport("__Internal")] private static extern void LinkFacebook(int userId);
[DllImport("__Internal")] private static extern void UnlinkFacebook();
[DllImport("__Internal")] private static extern void LinkApple(int userId);
[DllImport("__Internal")] private static extern void UnlinkApple();
[DllImport("__Internal")]
public static extern void ChangeLinkAccount(EAccoutType accoutType, int oldUserId, int newUserId);
public static void LinkCheck(EAccoutType accoutType)
{
@@ -401,6 +389,7 @@ namespace tysdk
}
}
[DllImport("__Internal")] public static extern void CleanLinkTmpSnsInfo();
[DllImport("__Internal")] private static extern void IsLinkedGoogle();