fix mentioning users with non-ascii displayname

This commit is contained in:
OfficialDakari 2025-09-29 21:29:52 +05:00
parent 5eadcb5c1c
commit 098b4149fc
4 changed files with 47 additions and 45 deletions

View File

@ -79,6 +79,7 @@ abstract class FluffyThemes {
useMaterial3: true,
brightness: brightness,
colorScheme: colorScheme,
useSystemColors: true,
dividerColor: brightness == Brightness.dark
? colorScheme.surfaceContainerHighest
: colorScheme.surfaceContainer,

View File

@ -152,30 +152,30 @@ class ChatInputRow extends StatelessWidget {
contentPadding: const EdgeInsets.all(0),
),
),
// PopupMenuItem<String>(
// value: 'image',
// child: ListTile(
// leading: CircleAvatar(
// backgroundColor: theme.colorScheme.onPrimaryContainer,
// foregroundColor: theme.colorScheme.primaryContainer,
// child: const Icon(Icons.photo_outlined),
// ),
// title: Text(L10n.of(context).sendImage),
// contentPadding: const EdgeInsets.all(0),
// ),
// ),
// PopupMenuItem<String>(
// value: 'video',
// child: ListTile(
// leading: CircleAvatar(
// backgroundColor: theme.colorScheme.onPrimaryContainer,
// foregroundColor: theme.colorScheme.primaryContainer,
// child: const Icon(Icons.video_camera_back_outlined),
// ),
// title: Text(L10n.of(context).sendVideo),
// contentPadding: const EdgeInsets.all(0),
// ),
// ),
PopupMenuItem<String>(
value: 'image',
child: ListTile(
leading: CircleAvatar(
backgroundColor: theme.colorScheme.onPrimaryContainer,
foregroundColor: theme.colorScheme.primaryContainer,
child: const Icon(Icons.photo_outlined),
),
title: Text(L10n.of(context).sendImage),
contentPadding: const EdgeInsets.all(0),
),
),
PopupMenuItem<String>(
value: 'video',
child: ListTile(
leading: CircleAvatar(
backgroundColor: theme.colorScheme.onPrimaryContainer,
foregroundColor: theme.colorScheme.primaryContainer,
child: const Icon(Icons.video_camera_back_outlined),
),
title: Text(L10n.of(context).sendVideo),
contentPadding: const EdgeInsets.all(0),
),
),
PopupMenuItem<String>(
value: 'file',
child: ListTile(

View File

@ -372,14 +372,14 @@ class InputBar extends StatelessWidget {
if (suggestion['type'] == 'user') {
insertText = '${suggestion['mention']!} ';
startText = replaceText.replaceAllMapped(
RegExp(r'(\s|^)(@[-\w]+)$'),
(Match m) => '${m[1]}$insertText',
RegExp(r'(?:\s|^)@([^ \[\]]+)$', unicode: true),
(Match m) => '$insertText',
);
}
if (suggestion['type'] == 'room') {
insertText = '${suggestion['mxid']!} ';
startText = replaceText.replaceAllMapped(
RegExp(r'(\s|^)(#[-\w]+)$'),
RegExp(r'(\s|^)(#[-\w]+)$', unicode: true),
(Match m) => '${m[1]}$insertText',
);
}

View File

@ -27,33 +27,33 @@ class Download {
try {
final mx = Matrix.of(context).client;
// final directory = await getDownloadsDirectory();
downloadPath =
"/sdcard/Download/Extera";
downloadPath = "/sdcard/Download/Extera";
httpUrl = (await Uri.parse(url).getDownloadUri(mx)).toString();
if (downloadPath != null) {
// Create Dio instance
final dio = Dio();
ct = CancelToken();
// Download the file
response = dio.download(
httpUrl,
"$downloadPath/$name",
onReceiveProgress: (received, total) {
receivedBytes = received;
totalBytes = total;
progress = (receivedBytes / totalBytes) * 100;
print("Download progress: $progress%");
},
options: Options(
responseType: ResponseType.bytes,
headers: {'authorization': "Bearer ${mx.accessToken}"}
),
cancelToken: ct
);
response = dio.download(httpUrl, "$downloadPath/$name",
onReceiveProgress: (received, total) {
receivedBytes = received;
totalBytes = total;
progress = (receivedBytes / totalBytes) * 100;
if (progress == 100) {
Provider.of<DownloadManagerController>(context)
.downloads
.remove(this);
}
print("Download progress: $progress%");
},
options: Options(
responseType: ResponseType.bytes,
headers: {'authorization': "Bearer ${mx.accessToken}"}),
cancelToken: ct);
print("Download completed and saved to $downloadPath/$name");
}
} catch (e) {
@ -63,6 +63,7 @@ class Download {
void cancel() async {
ct.cancel();
Provider.of<DownloadManagerController>(context).downloads.remove(this);
}
}