feat: 添加账号删除功能

This commit is contained in:
qzl
2026-04-10 10:40:44 +08:00
parent 17a1303f00
commit 46513829cd
30 changed files with 1510 additions and 664 deletions
+16
View File
@@ -305,6 +305,21 @@ class _EryaoAppState extends State<EryaoApp> {
return saved;
}
Future<void> _deleteAccount() async {
await _profileApi.deleteAccount();
if (!mounted) {
return;
}
setState(() {
_profileSettings = ProfileSettingsV1.defaultsForLocale(_locale);
_historyRecords = const <DivinationResultData>[];
_creditsBalance = 0;
_loadedProfileUserEmail = null;
_loadedHistoryUserEmail = null;
_loadedCreditsUserEmail = null;
});
}
Future<void> _saveProfileSettings(ProfileSettingsV1 next) async {
try {
final oldLanguage = _profileSettings.preferences.interfaceLanguage;
@@ -415,6 +430,7 @@ class _EryaoAppState extends State<EryaoApp> {
onDivinationCompleted: _handleDivinationCompleted,
onDeleteHistorySession: _handleHistorySessionDeleted,
onLogout: _authBloc.logout,
onDeleteAccount: _deleteAccount,
);
}