mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-17 09:29:28 +01:00
chore: Fix reply to story
This commit is contained in:
parent
b89d6884bd
commit
a3f391b8ae
@ -2676,5 +2676,13 @@
|
||||
"placeholders": {
|
||||
"size": {}
|
||||
}
|
||||
},
|
||||
"storyFrom": "Story from {date}: \n{body}",
|
||||
"@storyFrom": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"date": {},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import 'package:video_player/video_player.dart';
|
||||
import 'package:vrouter/vrouter.dart';
|
||||
|
||||
import 'package:fluffychat/pages/story/story_view.dart';
|
||||
import 'package:fluffychat/utils/date_time_extension.dart';
|
||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/client_stories_extension.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
@ -67,16 +68,20 @@ class StoryPageController extends State<StoryPage> {
|
||||
|
||||
void replyAction([String? message]) async {
|
||||
message ??= replyController.text;
|
||||
final currentEvent = this.currentEvent;
|
||||
if (currentEvent == null) return;
|
||||
setState(() {
|
||||
replyLoading = true;
|
||||
});
|
||||
try {
|
||||
final client = Matrix.of(context).client;
|
||||
final roomId = await client.startDirectChat(currentEvent!.senderId);
|
||||
await client.getRoomById(roomId)!.sendTextEvent(
|
||||
message,
|
||||
inReplyTo: currentEvent!,
|
||||
);
|
||||
final roomId = await client.startDirectChat(currentEvent.senderId);
|
||||
var replyText = L10n.of(context)!.storyFrom(
|
||||
currentEvent.originServerTs.localizedTime(context),
|
||||
currentEvent.content.tryGet<String>('body') ?? '');
|
||||
replyText = replyText.split('\n').map((line) => '> $line').join('\n');
|
||||
message = '$replyText\n\n$message';
|
||||
await client.getRoomById(roomId)!.sendTextEvent(message);
|
||||
replyController.clear();
|
||||
replyFocus.unfocus();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
|
Loading…
Reference in New Issue
Block a user