mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-03 19:54:12 +00:00 
			
		
		
		
	Do delete user account
This commit is contained in:
		@@ -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();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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!"));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user