chore: Switch to adaptive dialogs

This commit is contained in:
Christian Pauly 2020-11-14 10:08:13 +01:00
commit 0fae270165
20 changed files with 361 additions and 363 deletions

View file

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:io';
import 'dart:math';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:file_picker_cross/file_picker_cross.dart';
@ -303,10 +304,12 @@ class _ChatState extends State<_Chat> {
}
void redactEventsAction(BuildContext context) async {
var confirmed = await SimpleDialogs(context).askConfirmation(
titleText: L10n.of(context).messageWillBeRemovedWarning,
confirmText: L10n.of(context).remove,
);
var confirmed = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).messageWillBeRemovedWarning,
okLabel: L10n.of(context).remove,
) ==
OkCancelResult.ok;
if (!confirmed) return;
for (var event in selectedEvents) {
await SimpleDialogs(context).tryRequestWithLoadingDialog(
@ -363,10 +366,7 @@ class _ChatState extends State<_Chat> {
if (eventIndex == -1) {
// event id not found...maybe we can fetch it?
// the try...finally is here to start and close the loading dialog reliably
try {
if (context != null) {
SimpleDialogs(context).showLoadingDialog(context);
}
final task = Future.microtask(() async {
// okay, we first have to fetch if the event is in the room
try {
final event = await timeline.getEventById(eventId);
@ -399,10 +399,11 @@ class _ChatState extends State<_Chat> {
eventIndex =
getFilteredEvents().indexWhere((e) => e.eventId == eventId);
}
} finally {
if (context != null) {
Navigator.of(context)?.pop();
}
});
if (context != null) {
await SimpleDialogs(context).tryRequestWithLoadingDialog(task);
} else {
await task;
}
}
await _scrollController.scrollToIndex(eventIndex,

View file

@ -1,3 +1,4 @@
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flushbar/flushbar_helper.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:famedlysdk/matrix_api.dart';
@ -36,16 +37,22 @@ class ChatDetails extends StatefulWidget {
class _ChatDetailsState extends State<ChatDetails> {
List<User> members;
void setDisplaynameAction(BuildContext context) async {
var enterText = SimpleDialogs(context).enterText(
titleText: L10n.of(context).changeTheNameOfTheGroup,
labelText: L10n.of(context).changeTheNameOfTheGroup,
hintText:
widget.room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
final input = await showTextInputDialog(
context: context,
title: L10n.of(context).changeTheNameOfTheGroup,
textFields: [
DialogTextField(
initialText: widget.room.getLocalizedDisplayname(
MatrixLocals(
L10n.of(context),
),
),
)
],
);
final displayname = await enterText;
if (displayname == null) return;
if (input == null) return;
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
widget.room.setName(displayname),
widget.room.setName(input.single),
);
if (success != false) {
await FlushbarHelper.createSuccess(
@ -55,16 +62,19 @@ class _ChatDetailsState extends State<ChatDetails> {
}
void setCanonicalAliasAction(context) async {
final s = await SimpleDialogs(context).enterText(
titleText: L10n.of(context).setInvitationLink,
labelText: L10n.of(context).setInvitationLink,
hintText: L10n.of(context).alias.toLowerCase(),
prefixText: '#',
suffixText: ':' + widget.room.client.userID.domain,
final input = await showTextInputDialog(
context: context,
title: L10n.of(context).setInvitationLink,
textFields: [
DialogTextField(
hintText: '#localpart:domain',
initialText: L10n.of(context).alias.toLowerCase(),
)
],
);
if (s == null) return;
if (input == null) return;
final domain = widget.room.client.userID.domain;
final canonicalAlias = '%23' + s + '%3A' + domain;
final canonicalAlias = '%23' + input.single + '%3A' + domain;
final aliasEvent = widget.room.getState('m.room.aliases', domain);
final aliases =
aliasEvent != null ? aliasEvent.content['aliases'] ?? [] : [];
@ -84,23 +94,25 @@ class _ChatDetailsState extends State<ChatDetails> {
}
await SimpleDialogs(context).tryRequestWithLoadingDialog(
widget.room.client.sendState(widget.room.id, 'm.room.canonical_alias', {
'alias': '#$s:$domain',
'alias': input.single,
}),
);
}
void setTopicAction(BuildContext context) async {
final displayname = await SimpleDialogs(context).enterText(
titleText: L10n.of(context).setGroupDescription,
labelText: L10n.of(context).setGroupDescription,
hintText: (widget.room.topic?.isNotEmpty ?? false)
? widget.room.topic
: L10n.of(context).addGroupDescription,
multiLine: true,
final input = await showTextInputDialog(
context: context,
title: L10n.of(context).setGroupDescription,
textFields: [
DialogTextField(
hintText: L10n.of(context).setGroupDescription,
initialText: widget.room.topic,
)
],
);
if (displayname == null) return;
if (input == null) return;
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
widget.room.setDescription(displayname),
widget.room.setDescription(input.single),
);
if (success != false) {
await FlushbarHelper.createSuccess(

View file

@ -1,3 +1,4 @@
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:famedlysdk/encryption.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/adaptive_page_layout.dart';
@ -8,8 +9,6 @@ import 'package:fluffychat/views/chat_list.dart';
import 'package:flushbar/flushbar_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import '../components/dialogs/simple_dialogs.dart';
import '../utils/app_route.dart';
import 'key_verification.dart';
@ -64,10 +63,12 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
);
break;
case 'verify_manual':
if (await SimpleDialogs(context).askConfirmation(
titleText: L10n.of(context).isDeviceKeyCorrect,
contentText: key.ed25519Key.beautified,
)) {
if (await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).isDeviceKeyCorrect,
message: key.ed25519Key.beautified,
) ==
OkCancelResult.ok) {
await unblock();
await key.setVerified(true);
setState(() => null);

View file

@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:io';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:famedlysdk/matrix_api.dart';
import 'package:fluffychat/components/connection_status_header.dart';
@ -197,19 +198,22 @@ class _ChatListState extends State<ChatList> {
void _setStatus(BuildContext context) async {
Navigator.of(context).pop();
final statusMsg = await SimpleDialogs(context).enterText(
titleText: L10n.of(context).setStatus,
labelText: L10n.of(context).setStatus,
hintText: L10n.of(context).statusExampleMessage,
multiLine: true,
final input = await showTextInputDialog(
title: L10n.of(context).setStatus,
context: context,
textFields: [
DialogTextField(
hintText: L10n.of(context).statusExampleMessage,
)
],
);
if (statusMsg?.isEmpty ?? true) return;
if (input == null || input.single.isEmpty) return;
final client = Matrix.of(context).client;
await SimpleDialogs(context).tryRequestWithLoadingDialog(
client.sendPresence(
client.userID,
PresenceType.online,
statusMsg: statusMsg,
statusMsg: input.single,
),
);
return;
@ -242,7 +246,11 @@ class _ChatListState extends State<ChatList> {
}
Future<void> _archiveAction(BuildContext context) async {
final confirmed = await SimpleDialogs(context).askConfirmation();
final confirmed = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).areYouSure,
) ==
OkCancelResult.ok;
if (!confirmed) return;
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(_archiveSelectedRooms(context));

View file

@ -1,5 +1,6 @@
import 'dart:math';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:fluffychat/components/matrix.dart';
@ -13,13 +14,17 @@ import 'package:url_launcher/url_launcher.dart';
class HomeserverPicker extends StatelessWidget {
Future<void> _setHomeserverAction(BuildContext context) async {
final homeserver = await SimpleDialogs(context).enterText(
titleText: L10n.of(context).enterYourHomeserver,
hintText: AppConfig.defaultHomeserver,
prefixText: 'https://',
keyboardType: TextInputType.url);
if (homeserver?.isEmpty ?? true) return;
_checkHomeserverAction(homeserver, context);
final homeserver = await showTextInputDialog(
title: L10n.of(context).enterYourHomeserver,
context: context,
textFields: [
DialogTextField(
hintText: AppConfig.defaultHomeserver,
)
],
);
if (homeserver?.single?.isEmpty ?? true) return;
_checkHomeserverAction(homeserver.single, context);
}
void _checkHomeserverAction(String homeserver, BuildContext context) async {

View file

@ -1,3 +1,4 @@
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:famedlysdk/encryption.dart';
import 'package:famedlysdk/matrix_api.dart';
import 'package:flutter/material.dart';
@ -77,25 +78,28 @@ class _KeyVerificationPageState extends State<KeyVerificationPage> {
if (input == null) {
return;
}
SimpleDialogs(context).showLoadingDialog(context);
// make sure the loading spinner shows before we test the keys
await Future.delayed(Duration(milliseconds: 100));
var valid = false;
try {
await widget.request.openSSSS(recoveryKey: input);
valid = true;
} catch (_) {
final valid = await SimpleDialogs(context)
.tryRequestWithLoadingDialog(Future.microtask(() async {
// make sure the loading spinner shows before we test the keys
await Future.delayed(Duration(milliseconds: 100));
var valid = false;
try {
await widget.request.openSSSS(passphrase: input);
await widget.request.openSSSS(recoveryKey: input);
valid = true;
} catch (_) {
valid = false;
try {
await widget.request.openSSSS(passphrase: input);
valid = true;
} catch (_) {
valid = false;
}
}
}
await Navigator.of(context)?.pop();
if (!valid) {
await SimpleDialogs(context).inform(
contentText: L10n.of(context).incorrectPassphraseOrKey,
return valid;
}));
if (valid == false) {
await showOkAlertDialog(
context: context,
message: L10n.of(context).incorrectPassphraseOrKey,
);
}
};

View file

@ -1,5 +1,6 @@
import 'dart:io';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flushbar/flushbar_helper.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:file_picker_cross/file_picker_cross.dart';
@ -52,7 +53,11 @@ class _SettingsState extends State<Settings> {
bool megolmBackupCached;
void logoutAction(BuildContext context) async {
if (await SimpleDialogs(context).askConfirmation() == false) {
if (await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).areYouSure,
) ==
OkCancelResult.cancel) {
return;
}
var matrix = Matrix.of(context);
@ -61,20 +66,25 @@ class _SettingsState extends State<Settings> {
}
void _changePasswordAccountAction(BuildContext context) async {
final oldPassword = await SimpleDialogs(context).enterText(
password: true,
titleText: L10n.of(context).pleaseEnterYourPassword,
final input = await showTextInputDialog(
context: context,
title: L10n.of(context).changePassword,
textFields: [
DialogTextField(
hintText: L10n.of(context).pleaseEnterYourPassword,
obscureText: true,
),
DialogTextField(
hintText: L10n.of(context).chooseAStrongPassword,
obscureText: true,
),
],
);
if (oldPassword == null) return;
final newPassword = await SimpleDialogs(context).enterText(
password: true,
titleText: L10n.of(context).chooseAStrongPassword,
);
if (newPassword == null) return;
if (input == null) return;
await SimpleDialogs(context).tryRequestWithLoadingDialog(
Matrix.of(context)
.client
.changePassword(newPassword, oldPassword: oldPassword),
.changePassword(input.last, oldPassword: input.first),
);
await FlushbarHelper.createSuccess(
message: L10n.of(context).passwordHasBeenChanged)
@ -82,39 +92,44 @@ class _SettingsState extends State<Settings> {
}
void _deleteAccountAction(BuildContext context) async {
if (await SimpleDialogs(context).askConfirmation(
titleText: L10n.of(context).warning,
contentText: L10n.of(context).deactivateAccountWarning,
dangerous: true,
if (await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).warning,
message: L10n.of(context).deactivateAccountWarning,
) ==
false) {
OkCancelResult.cancel) {
return;
}
if (await SimpleDialogs(context).askConfirmation(dangerous: true) ==
false) {
if (await showOkCancelAlertDialog(
context: context, title: L10n.of(context).areYouSure) ==
OkCancelResult.cancel) {
return;
}
final password = await SimpleDialogs(context).enterText(
password: true,
titleText: L10n.of(context).pleaseEnterYourPassword,
final input = await showTextInputDialog(
context: context,
title: L10n.of(context).pleaseEnterYourPassword,
textFields: [DialogTextField(obscureText: true, hintText: '******')],
);
if (password == null) return;
if (input == null) return;
await SimpleDialogs(context).tryRequestWithLoadingDialog(
Matrix.of(context).client.deactivateAccount(auth: {
'type': 'm.login.password',
'user': Matrix.of(context).client.userID,
'password': password,
'password': input.single,
}),
);
}
void setJitsiInstanceAction(BuildContext context) async {
var jitsi = await SimpleDialogs(context).enterText(
titleText: L10n.of(context).editJitsiInstance,
hintText: Matrix.of(context).jitsiInstance,
labelText: L10n.of(context).editJitsiInstance,
var input = await showTextInputDialog(
context: context,
title: L10n.of(context).editJitsiInstance,
textFields: [
DialogTextField(initialText: Matrix.of(context).jitsiInstance),
],
);
if (jitsi == null) return;
if (input == null) return;
var jitsi = input.single;
if (!jitsi.endsWith('/')) {
jitsi += '/';
}
@ -124,16 +139,20 @@ class _SettingsState extends State<Settings> {
}
void setDisplaynameAction(BuildContext context) async {
final displayname = await SimpleDialogs(context).enterText(
titleText: L10n.of(context).editDisplayname,
hintText:
profile?.displayname ?? Matrix.of(context).client.userID.localpart,
labelText: L10n.of(context).enterAUsername,
final input = await showTextInputDialog(
context: context,
title: L10n.of(context).editDisplayname,
textFields: [
DialogTextField(
initialText: profile?.displayname ??
Matrix.of(context).client.userID.localpart,
)
],
);
if (displayname == null) return;
if (input == null) return;
final matrix = Matrix.of(context);
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
matrix.client.setDisplayname(matrix.client.userID, displayname),
matrix.client.setDisplayname(matrix.client.userID, input.single),
);
if (success != false) {
setState(() {
@ -195,36 +214,43 @@ class _SettingsState extends State<Settings> {
Future<void> requestSSSSCache(BuildContext context) async {
final handle = Matrix.of(context).client.encryption.ssss.open();
final str = await SimpleDialogs(context).enterText(
titleText: L10n.of(context).askSSSSCache,
hintText: L10n.of(context).passphraseOrKey,
password: true,
final input = await showTextInputDialog(
context: context,
title: L10n.of(context).askSSSSCache,
textFields: [
DialogTextField(
hintText: L10n.of(context).passphraseOrKey, obscureText: true)
],
);
if (str != null) {
SimpleDialogs(context).showLoadingDialog(context);
// make sure the loading spinner shows before we test the keys
await Future.delayed(Duration(milliseconds: 100));
var valid = false;
try {
handle.unlock(recoveryKey: str);
valid = true;
} catch (e, s) {
debugPrint('Couldn\'t use recovery key: ' + e.toString());
debugPrint(s.toString());
if (input != null) {
final valid = await SimpleDialogs(context)
.tryRequestWithLoadingDialog(Future.microtask(() async {
// make sure the loading spinner shows before we test the keys
await Future.delayed(Duration(milliseconds: 100));
var valid = false;
try {
handle.unlock(passphrase: str);
handle.unlock(recoveryKey: input.single);
valid = true;
} catch (e, s) {
debugPrint('Couldn\'t use recovery passphrase: ' + e.toString());
debugPrint('Couldn\'t use recovery key: ' + e.toString());
debugPrint(s.toString());
valid = false;
try {
handle.unlock(passphrase: input.single);
valid = true;
} catch (e, s) {
debugPrint('Couldn\'t use recovery passphrase: ' + e.toString());
debugPrint(s.toString());
valid = false;
}
}
}
await Navigator.of(context)?.pop();
if (valid) {
return valid;
}));
if (valid == true) {
await handle.maybeCacheAll();
await SimpleDialogs(context).inform(
contentText: L10n.of(context).cachedKeys,
await showOkAlertDialog(
context: context,
message: L10n.of(context).cachedKeys,
);
setState(() {
crossSigningCachedFuture = null;
@ -233,8 +259,9 @@ class _SettingsState extends State<Settings> {
megolmBackupCached = null;
});
} else {
await SimpleDialogs(context).inform(
contentText: L10n.of(context).incorrectPassphraseOrKey,
await showOkAlertDialog(
context: context,
message: L10n.of(context).incorrectPassphraseOrKey,
);
}
}
@ -452,7 +479,7 @@ class _SettingsState extends State<Settings> {
ListTile(
trailing: Icon(Icons.vpn_key),
title: Text(
'Change password',
L10n.of(context).changePassword,
),
onTap: () => _changePasswordAccountAction(context),
),
@ -497,39 +524,48 @@ class _SettingsState extends State<Settings> {
: null,
onTap: () async {
if (!client.encryption.crossSigning.enabled) {
await SimpleDialogs(context).inform(
contentText: L10n.of(context).noCrossSignBootstrap,
await showOkAlertDialog(
context: context,
message: L10n.of(context).noCrossSignBootstrap,
);
return;
}
if (client.isUnknownSession) {
final str = await SimpleDialogs(context).enterText(
titleText: L10n.of(context).askSSSSVerify,
hintText: L10n.of(context).passphraseOrKey,
password: true,
final input = await showTextInputDialog(
context: context,
title: L10n.of(context).askSSSSVerify,
textFields: [
DialogTextField(
hintText: L10n.of(context).passphraseOrKey,
obscureText: true)
],
);
if (str != null) {
SimpleDialogs(context).showLoadingDialog(context);
// make sure the loading spinner shows before we test the keys
await Future.delayed(Duration(milliseconds: 100));
var valid = false;
try {
await client.encryption.crossSigning
.selfSign(recoveryKey: str);
valid = true;
} catch (_) {
if (input != null) {
final valid = await SimpleDialogs(context)
.tryRequestWithLoadingDialog(Future.microtask(() async {
// make sure the loading spinner shows before we test the keys
await Future.delayed(Duration(milliseconds: 100));
var valid = false;
try {
await client.encryption.crossSigning
.selfSign(passphrase: str);
.selfSign(recoveryKey: input.single);
valid = true;
} catch (_) {
valid = false;
try {
await client.encryption.crossSigning
.selfSign(passphrase: input.single);
valid = true;
} catch (_) {
valid = false;
}
}
}
await Navigator.of(context)?.pop();
if (valid) {
await SimpleDialogs(context).inform(
contentText: L10n.of(context).verifiedSession,
return valid;
}));
if (valid == true) {
await showOkAlertDialog(
context: context,
message: L10n.of(context).verifiedSession,
);
setState(() {
crossSigningCachedFuture = null;
@ -538,8 +574,9 @@ class _SettingsState extends State<Settings> {
megolmBackupCached = null;
});
} else {
await SimpleDialogs(context).inform(
contentText: L10n.of(context).incorrectPassphraseOrKey,
await showOkAlertDialog(
context: context,
message: L10n.of(context).incorrectPassphraseOrKey,
);
}
}
@ -563,8 +600,9 @@ class _SettingsState extends State<Settings> {
: null,
onTap: () async {
if (!client.encryption.keyManager.enabled) {
await SimpleDialogs(context).inform(
contentText: L10n.of(context).noMegolmBootstrap,
await showOkAlertDialog(
context: context,
message: L10n.of(context).noMegolmBootstrap,
);
return;
}

View file

@ -1,3 +1,4 @@
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:flutter/material.dart';
@ -35,37 +36,51 @@ class DevicesSettingsState extends State<DevicesSettings> {
void reload() => setState(() => devices = null);
void _removeDevicesAction(BuildContext context, List<Device> devices) async {
if (await SimpleDialogs(context).askConfirmation() == false) return;
if (await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).areYouSure,
) ==
OkCancelResult.cancel) return;
var matrix = Matrix.of(context);
var deviceIds = <String>[];
for (var userDevice in devices) {
deviceIds.add(userDevice.deviceId);
}
final password = await SimpleDialogs(context).enterText(
titleText: L10n.of(context).pleaseEnterYourPassword,
labelText: L10n.of(context).pleaseEnterYourPassword,
hintText: '******',
password: true);
final password = await showTextInputDialog(
title: L10n.of(context).pleaseEnterYourPassword,
context: context,
textFields: [
DialogTextField(
hintText: '******',
obscureText: true,
)
],
);
if (password == null) return;
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
matrix.client.deleteDevices(deviceIds,
auth: matrix.getAuthByPassword(password)));
auth: matrix.getAuthByPassword(password.single)));
if (success != false) {
reload();
}
}
void _renameDeviceAction(BuildContext context, Device device) async {
final displayName = await SimpleDialogs(context).enterText(
hintText: device.displayName,
labelText: L10n.of(context).changeDeviceName,
final displayName = await showTextInputDialog(
context: context,
title: L10n.of(context).changeDeviceName,
textFields: [
DialogTextField(
hintText: device.displayName,
)
],
);
if (displayName == null) return;
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
Matrix.of(context)
.client
.setDeviceMetadata(device.deviceId, displayName: displayName),
.setDeviceMetadata(device.deviceId, displayName: displayName.single),
);
if (success != false) {
reload();

View file

@ -1,3 +1,4 @@
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flushbar/flushbar_helper.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:famedlysdk/famedlysdk.dart';
@ -247,9 +248,9 @@ class _EmotesSettingsState extends State<EmotesSettings> {
newEmoteController.text.isEmpty ||
newMxcController.text == null ||
newMxcController.text.isEmpty) {
await SimpleDialogs(context).inform(
contentText:
L10n.of(context).emoteWarnNeedToPick);
await showOkAlertDialog(
context: context,
message: L10n.of(context).emoteWarnNeedToPick);
return;
}
final emoteCode = ':${newEmoteController.text}:';
@ -257,13 +258,15 @@ class _EmotesSettingsState extends State<EmotesSettings> {
if (emotes.indexWhere((e) =>
e.emote == emoteCode && e.mxc != mxc) !=
-1) {
await SimpleDialogs(context).inform(
contentText: L10n.of(context).emoteExists);
await showOkAlertDialog(
context: context,
message: L10n.of(context).emoteExists);
return;
}
if (!RegExp(r'^:[-\w]+:$').hasMatch(emoteCode)) {
await SimpleDialogs(context).inform(
contentText: L10n.of(context).emoteInvalid);
await showOkAlertDialog(
context: context,
message: L10n.of(context).emoteInvalid);
return;
}
emotes.add(_EmoteEntry(emote: emoteCode, mxc: mxc));
@ -357,16 +360,18 @@ class _EmotesSettingsState extends State<EmotesSettings> {
e.mxc != emote.mxc) !=
-1) {
controller.text = emote.emoteClean;
SimpleDialogs(context).inform(
contentText:
showOkAlertDialog(
context: context,
message:
L10n.of(context).emoteExists);
return;
}
if (!RegExp(r'^:[-\w]+:$')
.hasMatch(emoteCode)) {
controller.text = emote.emoteClean;
SimpleDialogs(context).inform(
contentText:
showOkAlertDialog(
context: context,
message:
L10n.of(context).emoteInvalid);
return;
}