mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 04:49:21 +00:00
Can delete account image
This commit is contained in:
parent
6e0f6d1d79
commit
ef9510e731
@ -50,4 +50,10 @@ class SettingsHelper {
|
||||
.key)
|
||||
.exec())
|
||||
.isOK;
|
||||
|
||||
/// Delete user account image
|
||||
static Future<bool> deleteAccountImage() async =>
|
||||
(await APIRequest(uri: "settings/delete_account_image", needLogin: true)
|
||||
.exec())
|
||||
.isOK;
|
||||
}
|
||||
|
@ -93,7 +93,12 @@ class __AccountImageSettingsBodyState extends State<_AccountImageSettingsBody> {
|
||||
? tr("Comunic users")
|
||||
: tr("My friends only"),
|
||||
})),
|
||||
SettingsTile(title: tr("Delete account image"))
|
||||
|
||||
// Delete account image
|
||||
SettingsTile(
|
||||
title: tr("Delete account image"),
|
||||
onTap: () => _deleteAccountImage(),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@ -148,4 +153,19 @@ class __AccountImageSettingsBodyState extends State<_AccountImageSettingsBody> {
|
||||
|
||||
_key.currentState.refresh();
|
||||
}
|
||||
|
||||
/// Delete user account image
|
||||
void _deleteAccountImage() async {
|
||||
if (!await showConfirmDialog(
|
||||
context: context,
|
||||
message: tr("Do you really want to delete your account image ?")))
|
||||
return;
|
||||
|
||||
if (!await SettingsHelper.deleteAccountImage()) {
|
||||
showSimpleSnack(context, tr("Could not user account image!"));
|
||||
return;
|
||||
}
|
||||
|
||||
_key.currentState.refresh();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user