1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Can delete group logo

This commit is contained in:
2020-05-02 09:15:02 +02:00
parent 4cb672cb16
commit 9646cb7a70
2 changed files with 29 additions and 1 deletions

View File

@ -261,7 +261,13 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
SettingsTile(
title: tr("Generate a new random logo"),
onTap: _generateRandomLogo,
)
),
// Delete current logo
SettingsTile(
title: tr("Delete logo"),
onTap: _deleteLogo,
),
],
);
}
@ -294,4 +300,20 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
await GroupsHelper.uploadNewLogo(_groupSettings.id, bytes);
_key.currentState.refresh();
}
/// Delete previous group logo
void _deleteLogo() async {
try {
if (!await showConfirmDialog(
context: context,
message: tr("Do you really want to delete the logo of this group ?")))
return;
await GroupsHelper.deleteLogo(_groupSettings.id);
_key.currentState.refresh();
} catch (e, s) {
print("Could not delete group logo! $e\n$s");
showSimpleSnack(context, tr("Could not delete group logo!"));
}
}
}