feat(locale): 实现 App 启动时语言和时区自动设置

- 新增系统语言/时区读取工具函数
- SessionStore 扩展支持时区存储
- 启动流程自动检测并保存系统语言/时区
- 注册时传递语言/时区到后端
- 登录后从服务器同步语言/时区
This commit is contained in:
ZL-Q
2026-04-28 17:18:16 +08:00
parent 14752cdcfa
commit a83001de0d
11 changed files with 402 additions and 14 deletions
@@ -9,6 +9,8 @@ abstract class AuthRepository {
Future<AuthUser> loginWithEmailOtp({
required String email,
required String otp,
String? language,
String? timezone,
});
Future<AuthUser?> recoverSession();
@@ -37,8 +39,15 @@ class AuthRepositoryImpl implements AuthRepository {
Future<AuthUser> loginWithEmailOtp({
required String email,
required String otp,
String? language,
String? timezone,
}) async {
final session = await _authApi.createEmailSession(email: email, token: otp);
final session = await _authApi.createEmailSession(
email: email,
token: otp,
language: language,
timezone: timezone,
);
await _sessionStore.saveToken(session.accessToken);
await _sessionStore.saveRefreshToken(session.refreshToken);
await _sessionStore.saveEmail(email);