mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
mobile: Allow account deletion
This commit is contained in:
parent
95b3e9b00d
commit
0e10edb87f
1 changed files with 36 additions and 2 deletions
|
|
@ -42,12 +42,16 @@ class _AccountSettingsScreenState extends State<AccountSettingsScreen> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _setCredentials(MusicusAccountCredentials credentials) async {
|
Future<void> _setCredentials(MusicusAccountCredentials credentials) async {
|
||||||
if (credentials != null) {
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
|
if (credentials != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_loggedIn = true;
|
_loggedIn = true;
|
||||||
_username = credentials.username;
|
_username = credentials.username;
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_loggedIn = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -108,6 +112,36 @@ class _AccountSettingsScreenState extends State<AccountSettingsScreen> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text('Delete this account'),
|
||||||
|
onTap: () async {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: Text('Delete account'),
|
||||||
|
content: Text(
|
||||||
|
'Do you really want to delete the account with the '
|
||||||
|
'username $_username?'),
|
||||||
|
actions: <Widget>[
|
||||||
|
FlatButton(
|
||||||
|
child: Text('DELETE'),
|
||||||
|
onPressed: () async {
|
||||||
|
await _backend.client.deleteAccount();
|
||||||
|
await _backend.settings.clearAccount();
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
FlatButton(
|
||||||
|
child: Text('CANCEL'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text('Logout'),
|
title: Text('Logout'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue