Refactor profile update logic and remove debug prints

This commit is contained in:
Leon Bösche
2026-01-29 20:19:20 +01:00
parent e26f39ee5b
commit 04f08c1b1c

View File

@@ -59,7 +59,8 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
// Listen for changes in display name
_displayNameController.addListener(() {
final newHasChanges = _displayNameController.text != (_currentUser?.displayName ?? '');
final newHasChanges =
_displayNameController.text != (_currentUser?.displayName ?? '');
if (_hasChanges != newHasChanges) {
setState(() => _hasChanges = newHasChanges);
}
@@ -148,9 +149,6 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
}
Future<void> _updateProfile() async {
print(
'DEBUG: _updateProfile called with displayName: ${_displayNameController.text}',
);
if (_currentUser == null) {
return;
}
@@ -183,7 +181,6 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
Navigator.of(context).pop();
}
} catch (e) {
print('DEBUG: _updateProfile error: $e');
if (mounted) {
// Show error message
ScaffoldMessenger.of(
@@ -651,7 +648,9 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
child: SizedBox(
width: 144,
child: ModernGlassButton(
onPressed: _isLoading || !_hasChanges ? null : () => _updateProfile(),
onPressed: () {
if (!_isLoading && _hasChanges) _updateProfile();
},
isLoading: _isLoading,
child: _isLoading
? const SizedBox(