Add confirmations on follow/unfollow and group add/remove

codemagic-setup
Hank Grabowski 2022-12-29 00:31:10 -05:00
rodzic 7b2dce96a2
commit 2ac06454b4
1 zmienionych plików z 20 dodań i 1 usunięć

Wyświetl plik

@ -132,11 +132,20 @@ class _UserProfileScreenState extends State<UserProfileScreen> {
onChanged: isUpdating
? null
: (bool? value) async {
final isAdding = value == true;
final confirm = await showYesNoDialog(
context,
isAdding
? 'Add user to ${g.name}'
: 'Remove user from ${g.name}');
if (confirm != true) {
return;
}
setState(() {
print('Started updating/isupdating cycle');
isUpdating = true;
});
if (value == true) {
if (isAdding) {
await manager.addUserToGroup(g, profile);
} else {
await manager.removeUserFromGroup(g, profile);
@ -173,6 +182,11 @@ class _UserProfileScreenState extends State<UserProfileScreen> {
onPressed: isUpdating
? null
: () async {
final confirm = await showYesNoDialog(
context, 'Unfollow ${profile.name}');
if (confirm != true) {
return;
}
setState(() {
print('Started updating/isupdating cycle');
isUpdating = true;
@ -192,6 +206,11 @@ class _UserProfileScreenState extends State<UserProfileScreen> {
onPressed: isUpdating
? null
: () async {
final confirm =
await showYesNoDialog(context, 'Follow ${profile.name}');
if (confirm != true) {
return;
}
setState(() {
print('Started updating/isupdating cycle');
isUpdating = true;