feat: Add user profile refresh

This commit is contained in:
xkeyC
2025-12-26 17:07:25 +08:00
parent 724f7d8242
commit 1d59acff2d
2 changed files with 147 additions and 83 deletions

View File

@@ -277,6 +277,24 @@ class PartyRoom extends _$PartyRoom {
}
}
/// 刷新用户资料
Future<void> refreshUserProfile() async {
try {
final client = state.client.authClient;
if (client == null) throw Exception('Not connected to server');
final response = await client.refreshUserProfile(auth.RefreshUserProfileRequest(), options: getAuthCallOptions());
if (response.success && response.hasUserInfo()) {
state = state.copyWith(auth: state.auth.copyWith(userInfo: response.userInfo));
dPrint('[PartyRoom] User profile refreshed: ${response.userInfo.gameUserId}');
}
} catch (e) {
dPrint('[PartyRoom] RefreshUserProfile error: $e');
rethrow;
}
}
// ========== 房间相关方法 ==========
/// 加载标签和信号类型