feat: 添加账号删除功能
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user