fix(sdk): improve SNS login binding and account handling
- Remove premature null check in LoginBySns to allow login flow - Add debug logging for SNS login failures - Handle code==-1 case when binding accounts with same userId 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -221,8 +221,7 @@ namespace tysdk
|
|||||||
|
|
||||||
public async Task<LoginInfo> LoginBySns()
|
public async Task<LoginInfo> LoginBySns()
|
||||||
{
|
{
|
||||||
var accountInfo = AccountInfo.GetSavedAccoutInfo();
|
Debug.Log("[TYSdkFacade] LoginBySns");
|
||||||
if (accountInfo == null) return new LoginInfo();
|
|
||||||
|
|
||||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<LoginInfo>(TimeSpan.FromSeconds(30));
|
var task = TYSDKCallbackManager.Instance.RegisterCallback<LoginInfo>(TimeSpan.FromSeconds(30));
|
||||||
|
|
||||||
@@ -240,6 +239,10 @@ namespace tysdk
|
|||||||
_accountInfo.AddLinkedAccount(accountType);
|
_accountInfo.AddLinkedAccount(accountType);
|
||||||
_accountInfo.Save();
|
_accountInfo.Save();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log($"[TYSdkFacade] LoginBySns failed snsType: {snsType}");
|
||||||
|
}
|
||||||
return loginInfo;
|
return loginInfo;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -331,6 +334,12 @@ namespace tysdk
|
|||||||
_accountInfo.Save();
|
_accountInfo.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (result.code == -1 && _accountInfo.userId == result.userId)
|
||||||
|
{
|
||||||
|
_accountInfo.channel = accoutType;
|
||||||
|
_accountInfo.AddLinkedAccount(accoutType);
|
||||||
|
_accountInfo.Save();
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
Reference in New Issue
Block a user