fix mentioning users with non-ascii displayname
This commit is contained in:
parent
5eadcb5c1c
commit
098b4149fc
|
|
@ -79,6 +79,7 @@ abstract class FluffyThemes {
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
brightness: brightness,
|
brightness: brightness,
|
||||||
colorScheme: colorScheme,
|
colorScheme: colorScheme,
|
||||||
|
useSystemColors: true,
|
||||||
dividerColor: brightness == Brightness.dark
|
dividerColor: brightness == Brightness.dark
|
||||||
? colorScheme.surfaceContainerHighest
|
? colorScheme.surfaceContainerHighest
|
||||||
: colorScheme.surfaceContainer,
|
: colorScheme.surfaceContainer,
|
||||||
|
|
|
||||||
|
|
@ -152,30 +152,30 @@ class ChatInputRow extends StatelessWidget {
|
||||||
contentPadding: const EdgeInsets.all(0),
|
contentPadding: const EdgeInsets.all(0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
// value: 'image',
|
value: 'image',
|
||||||
// child: ListTile(
|
child: ListTile(
|
||||||
// leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
// backgroundColor: theme.colorScheme.onPrimaryContainer,
|
backgroundColor: theme.colorScheme.onPrimaryContainer,
|
||||||
// foregroundColor: theme.colorScheme.primaryContainer,
|
foregroundColor: theme.colorScheme.primaryContainer,
|
||||||
// child: const Icon(Icons.photo_outlined),
|
child: const Icon(Icons.photo_outlined),
|
||||||
// ),
|
),
|
||||||
// title: Text(L10n.of(context).sendImage),
|
title: Text(L10n.of(context).sendImage),
|
||||||
// contentPadding: const EdgeInsets.all(0),
|
contentPadding: const EdgeInsets.all(0),
|
||||||
// ),
|
),
|
||||||
// ),
|
),
|
||||||
// PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
// value: 'video',
|
value: 'video',
|
||||||
// child: ListTile(
|
child: ListTile(
|
||||||
// leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
// backgroundColor: theme.colorScheme.onPrimaryContainer,
|
backgroundColor: theme.colorScheme.onPrimaryContainer,
|
||||||
// foregroundColor: theme.colorScheme.primaryContainer,
|
foregroundColor: theme.colorScheme.primaryContainer,
|
||||||
// child: const Icon(Icons.video_camera_back_outlined),
|
child: const Icon(Icons.video_camera_back_outlined),
|
||||||
// ),
|
),
|
||||||
// title: Text(L10n.of(context).sendVideo),
|
title: Text(L10n.of(context).sendVideo),
|
||||||
// contentPadding: const EdgeInsets.all(0),
|
contentPadding: const EdgeInsets.all(0),
|
||||||
// ),
|
),
|
||||||
// ),
|
),
|
||||||
PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
value: 'file',
|
value: 'file',
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
|
|
||||||
|
|
@ -372,14 +372,14 @@ class InputBar extends StatelessWidget {
|
||||||
if (suggestion['type'] == 'user') {
|
if (suggestion['type'] == 'user') {
|
||||||
insertText = '${suggestion['mention']!} ';
|
insertText = '${suggestion['mention']!} ';
|
||||||
startText = replaceText.replaceAllMapped(
|
startText = replaceText.replaceAllMapped(
|
||||||
RegExp(r'(\s|^)(@[-\w]+)$'),
|
RegExp(r'(?:\s|^)@([^ \[\]]+)$', unicode: true),
|
||||||
(Match m) => '${m[1]}$insertText',
|
(Match m) => '$insertText',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (suggestion['type'] == 'room') {
|
if (suggestion['type'] == 'room') {
|
||||||
insertText = '${suggestion['mxid']!} ';
|
insertText = '${suggestion['mxid']!} ';
|
||||||
startText = replaceText.replaceAllMapped(
|
startText = replaceText.replaceAllMapped(
|
||||||
RegExp(r'(\s|^)(#[-\w]+)$'),
|
RegExp(r'(\s|^)(#[-\w]+)$', unicode: true),
|
||||||
(Match m) => '${m[1]}$insertText',
|
(Match m) => '${m[1]}$insertText',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,7 @@ class Download {
|
||||||
try {
|
try {
|
||||||
final mx = Matrix.of(context).client;
|
final mx = Matrix.of(context).client;
|
||||||
// final directory = await getDownloadsDirectory();
|
// final directory = await getDownloadsDirectory();
|
||||||
downloadPath =
|
downloadPath = "/sdcard/Download/Extera";
|
||||||
"/sdcard/Download/Extera";
|
|
||||||
|
|
||||||
httpUrl = (await Uri.parse(url).getDownloadUri(mx)).toString();
|
httpUrl = (await Uri.parse(url).getDownloadUri(mx)).toString();
|
||||||
|
|
||||||
|
|
@ -39,21 +38,22 @@ class Download {
|
||||||
ct = CancelToken();
|
ct = CancelToken();
|
||||||
|
|
||||||
// Download the file
|
// Download the file
|
||||||
response = dio.download(
|
response = dio.download(httpUrl, "$downloadPath/$name",
|
||||||
httpUrl,
|
onReceiveProgress: (received, total) {
|
||||||
"$downloadPath/$name",
|
receivedBytes = received;
|
||||||
onReceiveProgress: (received, total) {
|
totalBytes = total;
|
||||||
receivedBytes = received;
|
progress = (receivedBytes / totalBytes) * 100;
|
||||||
totalBytes = total;
|
if (progress == 100) {
|
||||||
progress = (receivedBytes / totalBytes) * 100;
|
Provider.of<DownloadManagerController>(context)
|
||||||
print("Download progress: $progress%");
|
.downloads
|
||||||
},
|
.remove(this);
|
||||||
options: Options(
|
}
|
||||||
responseType: ResponseType.bytes,
|
print("Download progress: $progress%");
|
||||||
headers: {'authorization': "Bearer ${mx.accessToken}"}
|
},
|
||||||
),
|
options: Options(
|
||||||
cancelToken: ct
|
responseType: ResponseType.bytes,
|
||||||
);
|
headers: {'authorization': "Bearer ${mx.accessToken}"}),
|
||||||
|
cancelToken: ct);
|
||||||
print("Download completed and saved to $downloadPath/$name");
|
print("Download completed and saved to $downloadPath/$name");
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -63,6 +63,7 @@ class Download {
|
||||||
|
|
||||||
void cancel() async {
|
void cancel() async {
|
||||||
ct.cancel();
|
ct.cancel();
|
||||||
|
Provider.of<DownloadManagerController>(context).downloads.remove(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue