mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 23:09:35 +01:00
Implement missing account settings
This commit is contained in:
parent
9d3f272c2a
commit
165c64ce36
@ -5,6 +5,8 @@
|
|||||||
- Display messages with up to 10 emotes or emoji bigger
|
- Display messages with up to 10 emotes or emoji bigger
|
||||||
- New design for the chat list and message bubbles
|
- New design for the chat list and message bubbles
|
||||||
- Implement reactions
|
- Implement reactions
|
||||||
|
- Implement password change
|
||||||
|
- Implement deactivate user account
|
||||||
### Fixes
|
### Fixes
|
||||||
- Timeline randomly resorting while more history is being fetched
|
- Timeline randomly resorting while more history is being fetched
|
||||||
- Automatically request history if the "load more" button is on the screen
|
- Automatically request history if the "load more" button is on the screen
|
||||||
|
@ -79,6 +79,7 @@ class SimpleDialogs {
|
|||||||
String contentText,
|
String contentText,
|
||||||
String confirmText,
|
String confirmText,
|
||||||
String cancelText,
|
String cancelText,
|
||||||
|
bool dangerous = false,
|
||||||
}) async {
|
}) async {
|
||||||
var confirmed = false;
|
var confirmed = false;
|
||||||
await showDialog(
|
await showDialog(
|
||||||
@ -98,6 +99,7 @@ class SimpleDialogs {
|
|||||||
child: Text(
|
child: Text(
|
||||||
confirmText?.toUpperCase() ??
|
confirmText?.toUpperCase() ??
|
||||||
L10n.of(context).confirm.toUpperCase(),
|
L10n.of(context).confirm.toUpperCase(),
|
||||||
|
style: TextStyle(color: dangerous ? Colors.red : null),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
confirmed = true;
|
confirmed = true;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2020-09-19T15:27:28.862887",
|
"@@last_modified": "2020-09-21T17:49:17.725032",
|
||||||
"About": "About",
|
"About": "About",
|
||||||
"@About": {
|
"@About": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@ -453,6 +453,16 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"This will deactivate your user account. This can not be undone! Are you sure?": "This will deactivate your user account. This can not be undone! Are you sure?",
|
||||||
|
"@This will deactivate your user account. This can not be undone! Are you sure?": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"Delete account": "Delete account",
|
||||||
|
"@Delete account": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
"Delete message": "Delete message",
|
"Delete message": "Delete message",
|
||||||
"@Delete message": {
|
"@Delete message": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@ -1006,6 +1016,11 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"Password has been changed": "Password has been changed",
|
||||||
|
"@Password has been changed": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
"Pick image": "Pick image",
|
"Pick image": "Pick image",
|
||||||
"@Pick image": {
|
"@Pick image": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@ -1617,6 +1632,11 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"Warning!": "Warning!",
|
||||||
|
"@Warning!": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
"Wallpaper": "Wallpaper",
|
"Wallpaper": "Wallpaper",
|
||||||
"@Wallpaper": {
|
"@Wallpaper": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -342,6 +342,11 @@ class L10n extends MatrixLocalizations {
|
|||||||
|
|
||||||
String get delete => Intl.message("Delete");
|
String get delete => Intl.message("Delete");
|
||||||
|
|
||||||
|
String get deactivateAccountWarning => Intl.message(
|
||||||
|
'This will deactivate your user account. This can not be undone! Are you sure?');
|
||||||
|
|
||||||
|
String get deleteAccount => Intl.message('Delete account');
|
||||||
|
|
||||||
String get deleteMessage => Intl.message("Delete message");
|
String get deleteMessage => Intl.message("Delete message");
|
||||||
|
|
||||||
String get deny => Intl.message("Deny");
|
String get deny => Intl.message("Deny");
|
||||||
@ -636,6 +641,9 @@ class L10n extends MatrixLocalizations {
|
|||||||
|
|
||||||
String get password => Intl.message("Password");
|
String get password => Intl.message("Password");
|
||||||
|
|
||||||
|
String get passwordHasBeenChanged =>
|
||||||
|
Intl.message('Password has been changed');
|
||||||
|
|
||||||
String get pickImage => Intl.message('Pick image');
|
String get pickImage => Intl.message('Pick image');
|
||||||
|
|
||||||
String get pin => Intl.message('Pin');
|
String get pin => Intl.message('Pin');
|
||||||
@ -988,6 +996,8 @@ class L10n extends MatrixLocalizations {
|
|||||||
Intl.message("Waiting for partner to accept the numbers...",
|
Intl.message("Waiting for partner to accept the numbers...",
|
||||||
name: "waitingPartnerNumbers");
|
name: "waitingPartnerNumbers");
|
||||||
|
|
||||||
|
String get warning => Intl.message('Warning!');
|
||||||
|
|
||||||
String get wallpaper => Intl.message("Wallpaper");
|
String get wallpaper => Intl.message("Wallpaper");
|
||||||
|
|
||||||
String get warningEncryptionInBeta => Intl.message(
|
String get warningEncryptionInBeta => Intl.message(
|
||||||
|
@ -239,6 +239,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
MessageLookupByLibrary.simpleMessage("Currently active"),
|
MessageLookupByLibrary.simpleMessage("Currently active"),
|
||||||
"Dark": MessageLookupByLibrary.simpleMessage("Dark"),
|
"Dark": MessageLookupByLibrary.simpleMessage("Dark"),
|
||||||
"Delete": MessageLookupByLibrary.simpleMessage("Delete"),
|
"Delete": MessageLookupByLibrary.simpleMessage("Delete"),
|
||||||
|
"Delete account":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Delete account"),
|
||||||
"Delete message":
|
"Delete message":
|
||||||
MessageLookupByLibrary.simpleMessage("Delete message"),
|
MessageLookupByLibrary.simpleMessage("Delete message"),
|
||||||
"Deny": MessageLookupByLibrary.simpleMessage("Deny"),
|
"Deny": MessageLookupByLibrary.simpleMessage("Deny"),
|
||||||
@ -362,6 +364,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"Participating user devices":
|
"Participating user devices":
|
||||||
MessageLookupByLibrary.simpleMessage("Participating user devices"),
|
MessageLookupByLibrary.simpleMessage("Participating user devices"),
|
||||||
"Password": MessageLookupByLibrary.simpleMessage("Password"),
|
"Password": MessageLookupByLibrary.simpleMessage("Password"),
|
||||||
|
"Password has been changed":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Password has been changed"),
|
||||||
"Pick image": MessageLookupByLibrary.simpleMessage("Pick image"),
|
"Pick image": MessageLookupByLibrary.simpleMessage("Pick image"),
|
||||||
"Pin": MessageLookupByLibrary.simpleMessage("Pin"),
|
"Pin": MessageLookupByLibrary.simpleMessage("Pin"),
|
||||||
"Please be aware that you need Pantalaimon to use end-to-end encryption for now.":
|
"Please be aware that you need Pantalaimon to use end-to-end encryption for now.":
|
||||||
@ -438,6 +442,9 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"They Match": MessageLookupByLibrary.simpleMessage("They Match"),
|
"They Match": MessageLookupByLibrary.simpleMessage("They Match"),
|
||||||
"This room has been archived.": MessageLookupByLibrary.simpleMessage(
|
"This room has been archived.": MessageLookupByLibrary.simpleMessage(
|
||||||
"This room has been archived."),
|
"This room has been archived."),
|
||||||
|
"This will deactivate your user account. This can not be undone! Are you sure?":
|
||||||
|
MessageLookupByLibrary.simpleMessage(
|
||||||
|
"This will deactivate your user account. This can not be undone! Are you sure?"),
|
||||||
"Thursday": MessageLookupByLibrary.simpleMessage("Thursday"),
|
"Thursday": MessageLookupByLibrary.simpleMessage("Thursday"),
|
||||||
"Try to send again":
|
"Try to send again":
|
||||||
MessageLookupByLibrary.simpleMessage("Try to send again"),
|
MessageLookupByLibrary.simpleMessage("Try to send again"),
|
||||||
@ -464,6 +471,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
MessageLookupByLibrary.simpleMessage("Visible for everyone"),
|
MessageLookupByLibrary.simpleMessage("Visible for everyone"),
|
||||||
"Voice message": MessageLookupByLibrary.simpleMessage("Voice message"),
|
"Voice message": MessageLookupByLibrary.simpleMessage("Voice message"),
|
||||||
"Wallpaper": MessageLookupByLibrary.simpleMessage("Wallpaper"),
|
"Wallpaper": MessageLookupByLibrary.simpleMessage("Wallpaper"),
|
||||||
|
"Warning!": MessageLookupByLibrary.simpleMessage("Warning!"),
|
||||||
"Wednesday": MessageLookupByLibrary.simpleMessage("Wednesday"),
|
"Wednesday": MessageLookupByLibrary.simpleMessage("Wednesday"),
|
||||||
"Welcome to the cutest instant messenger in the matrix network.":
|
"Welcome to the cutest instant messenger in the matrix network.":
|
||||||
MessageLookupByLibrary.simpleMessage(
|
MessageLookupByLibrary.simpleMessage(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'package:fluffychat/components/settings_themes.dart';
|
import 'package:fluffychat/components/settings_themes.dart';
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
@ -55,6 +56,52 @@ class _SettingsState extends State<Settings> {
|
|||||||
.tryRequestWithLoadingDialog(matrix.client.logout());
|
.tryRequestWithLoadingDialog(matrix.client.logout());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _changePasswordAccountAction(BuildContext context) async {
|
||||||
|
final oldPassword = await SimpleDialogs(context).enterText(
|
||||||
|
password: true,
|
||||||
|
titleText: L10n.of(context).pleaseEnterYourPassword,
|
||||||
|
);
|
||||||
|
if (oldPassword == null) return;
|
||||||
|
final newPassword = await SimpleDialogs(context).enterText(
|
||||||
|
password: true,
|
||||||
|
titleText: L10n.of(context).chooseAStrongPassword,
|
||||||
|
);
|
||||||
|
if (newPassword == null) return;
|
||||||
|
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||||
|
Matrix.of(context)
|
||||||
|
.client
|
||||||
|
.changePassword(newPassword, oldPassword: oldPassword),
|
||||||
|
);
|
||||||
|
BotToast.showText(text: L10n.of(context).passwordHasBeenChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _deleteAccountAction(BuildContext context) async {
|
||||||
|
if (await SimpleDialogs(context).askConfirmation(
|
||||||
|
titleText: L10n.of(context).warning,
|
||||||
|
contentText: L10n.of(context).deactivateAccountWarning,
|
||||||
|
dangerous: true,
|
||||||
|
) ==
|
||||||
|
false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (await SimpleDialogs(context).askConfirmation(dangerous: true) ==
|
||||||
|
false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final password = await SimpleDialogs(context).enterText(
|
||||||
|
password: true,
|
||||||
|
titleText: L10n.of(context).pleaseEnterYourPassword,
|
||||||
|
);
|
||||||
|
if (password == null) return;
|
||||||
|
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||||
|
Matrix.of(context).client.deactivateAccount(auth: {
|
||||||
|
'type': 'm.login.password',
|
||||||
|
'user': Matrix.of(context).client.userID,
|
||||||
|
'password': password,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void setJitsiInstanceAction(BuildContext context) async {
|
void setJitsiInstanceAction(BuildContext context) async {
|
||||||
var jitsi = await SimpleDialogs(context).enterText(
|
var jitsi = await SimpleDialogs(context).enterText(
|
||||||
titleText: L10n.of(context).editJitsiInstance,
|
titleText: L10n.of(context).editJitsiInstance,
|
||||||
@ -359,11 +406,27 @@ class _SettingsState extends State<Settings> {
|
|||||||
title: Text(L10n.of(context).sendBugReports),
|
title: Text(L10n.of(context).sendBugReports),
|
||||||
onTap: () => SentryController.toggleSentryAction(context),
|
onTap: () => SentryController.toggleSentryAction(context),
|
||||||
),
|
),
|
||||||
|
Divider(thickness: 1),
|
||||||
|
ListTile(
|
||||||
|
trailing: Icon(Icons.vpn_key),
|
||||||
|
title: Text(
|
||||||
|
'Change password',
|
||||||
|
),
|
||||||
|
onTap: () => _changePasswordAccountAction(context),
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
trailing: Icon(Icons.exit_to_app),
|
trailing: Icon(Icons.exit_to_app),
|
||||||
title: Text(L10n.of(context).logout),
|
title: Text(L10n.of(context).logout),
|
||||||
onTap: () => logoutAction(context),
|
onTap: () => logoutAction(context),
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
trailing: Icon(Icons.delete_forever),
|
||||||
|
title: Text(
|
||||||
|
L10n.of(context).deleteAccount,
|
||||||
|
style: TextStyle(color: Colors.red),
|
||||||
|
),
|
||||||
|
onTap: () => _deleteAccountAction(context),
|
||||||
|
),
|
||||||
Divider(thickness: 1),
|
Divider(thickness: 1),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
|
Loading…
Reference in New Issue
Block a user