1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 06:49:22 +00:00

Do delete user account

This commit is contained in:
Pierre HUBERT 2020-05-01 10:56:57 +02:00
parent e204c62ba9
commit 4c1e33a264
2 changed files with 12 additions and 1 deletions

View File

@ -147,4 +147,13 @@ class AccountHelper {
await APIRequest(uri: "account/disconnect_all_devices", needLogin: true)
.execWithThrow();
}
/// Remove permanently a user account
///
/// Throws in case of failure
static Future<void> deleteAccount(String password) async {
await APIRequest(uri: "account/delete", needLogin: true)
.addString("password", password)
.execWithThrow();
}
}

View File

@ -1,3 +1,4 @@
import 'package:comunic/helpers/account_helper.dart';
import 'package:comunic/ui/dialogs/input_user_password_dialog.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
@ -60,9 +61,10 @@ class __AccountPrivacyScreenState extends State<_AccountPrivacyScreen> {
true) return;
// Delete account
print("Delete account");
await AccountHelper.deleteAccount(password);
} catch (e, stack) {
print("Could not delete user account! $e\n$stack");
showSimpleSnack(context, tr("Could not delete your account!"));
}
}
}