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