- Add BestHTTP reference to IchniOnline.asmdef - Create ApiClient.cs: HTTP singleton with JWT auto-injection - Create ApiResponse.cs: ResponseCode enum, GlobalResponse<T>, ApiResult<T> - Create AuthDtos.cs: ThirdPartyLoginRequestDto, LoginRequestDto, RegisterRequestDto, LoginResponseDto, UserResponseDto - Create AuthService.cs: TapTap/password/register/logout flows with events - Extend LoginCacheData.cs: JWT + server user data fields - Extend LoginCacheManager.cs: SaveAuthSession, ClearSession, HasValidSession - Extend ThirdPartyServiceManager.cs: OnLoginWithToken event for AuthService - Update LoginPage.cs: Use AuthService with loading states and null-safe callbacks - Update StartUIPage.cs: Use HasValidSession for session check Fixes post-review: - LoginPage: Add null check for Register success (response may be null) - AuthService: Add try/catch around TapTap login API call
47 lines
962 B
C#
47 lines
962 B
C#
using System;
|
|
|
|
namespace IchniOnline.Online.Network.Models
|
|
{
|
|
[Serializable]
|
|
public class ThirdPartyLoginRequestDto
|
|
{
|
|
public string Token;
|
|
public string TokenType;
|
|
public string MacKey;
|
|
public string MacAlgorithm;
|
|
}
|
|
|
|
[Serializable]
|
|
public class LoginRequestDto
|
|
{
|
|
public string Username;
|
|
public string EncryptedPassword;
|
|
public string SessionKey;
|
|
}
|
|
|
|
[Serializable]
|
|
public class RegisterRequestDto
|
|
{
|
|
public string Username;
|
|
public string Password;
|
|
public string DisplayName;
|
|
}
|
|
|
|
[Serializable]
|
|
public class LoginResponseDto
|
|
{
|
|
public string Token;
|
|
public UserResponseDto User;
|
|
}
|
|
|
|
[Serializable]
|
|
public class UserResponseDto
|
|
{
|
|
public string UserId;
|
|
public string Username;
|
|
public string DisplayName;
|
|
public string AvatarUrl;
|
|
public int Permission;
|
|
}
|
|
}
|