mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 13:48:41 +00:00
fix #94
This commit is contained in:
parent
0d79a0a426
commit
742ad51daf
4 changed files with 43 additions and 9 deletions
|
|
@ -256,8 +256,6 @@ Future<client.Response> handleNewMessage(int fromUserId, Uint8List body) async {
|
|||
return client.Response()..ok = ok;
|
||||
}
|
||||
|
||||
String content = jsonEncode(message.content!.toJson());
|
||||
|
||||
bool acknowledgeByUser = false;
|
||||
DateTime? openedAt;
|
||||
|
||||
|
|
@ -267,16 +265,21 @@ Future<client.Response> handleNewMessage(int fromUserId, Uint8List body) async {
|
|||
}
|
||||
|
||||
int? responseToMessageId;
|
||||
final textContent = message.content!;
|
||||
if (textContent is TextMessageContent) {
|
||||
responseToMessageId = textContent.responseToMessageId;
|
||||
|
||||
final content = message.content!;
|
||||
if (content is TextMessageContent) {
|
||||
responseToMessageId = content.responseToMessageId;
|
||||
}
|
||||
if (content is StoredMediaFileContent) {
|
||||
responseToMessageId = content.messageId;
|
||||
}
|
||||
|
||||
String contentJson = jsonEncode(content.toJson());
|
||||
final update = MessagesCompanion(
|
||||
contactId: Value(fromUserId),
|
||||
kind: Value(message.kind),
|
||||
messageOtherId: Value(message.messageId),
|
||||
contentJson: Value(content),
|
||||
contentJson: Value(contentJson),
|
||||
acknowledgeByServer: Value(true),
|
||||
acknowledgeByUser: Value(acknowledgeByUser),
|
||||
responseToMessageId: Value(responseToMessageId),
|
||||
|
|
|
|||
|
|
@ -414,9 +414,14 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
onPressed: () async {
|
||||
if (sendNextMediaToUserId != null) {
|
||||
Uint8List? imageBytes = await getMergedImage();
|
||||
if (!context.mounted) return;
|
||||
if (imageBytes == null) {
|
||||
Navigator.pop(context);
|
||||
return;
|
||||
}
|
||||
sendImage(
|
||||
[sendNextMediaToUserId],
|
||||
imageBytes!,
|
||||
imageBytes,
|
||||
_isRealTwonly,
|
||||
maxShowTime,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -34,11 +34,34 @@ class ChatListEntry extends StatelessWidget {
|
|||
|
||||
Widget getReactionRow() {
|
||||
List<Widget> children = [];
|
||||
bool hasOneTextReaction = false;
|
||||
for (final reaction in reactions) {
|
||||
if (children.isNotEmpty) break;
|
||||
MessageContent? content = MessageContent.fromJson(
|
||||
reaction.kind, jsonDecode(reaction.contentJson!));
|
||||
|
||||
if (content is StoredMediaFileContent) {
|
||||
children.add(
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(right: 3),
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.floppyDisk,
|
||||
size: 12,
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// only show one reaction
|
||||
if (hasOneTextReaction) continue;
|
||||
|
||||
if (content is TextMessageContent) {
|
||||
hasOneTextReaction = true;
|
||||
late Widget child;
|
||||
if (EmojiAnimation.animatedIcons.containsKey(content.text)) {
|
||||
child = SizedBox(
|
||||
|
|
|
|||
|
|
@ -392,6 +392,9 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
|||
: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
onPressed: () async {
|
||||
if (allMediaFiles.first.messageOtherId == null) {
|
||||
return; // should not be possible
|
||||
}
|
||||
setState(() {
|
||||
imageSaving = true;
|
||||
});
|
||||
|
|
@ -402,7 +405,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
|||
kind: MessageKind.storedMediaFile,
|
||||
messageId: allMediaFiles.first.messageId,
|
||||
content: StoredMediaFileContent(
|
||||
messageId: allMediaFiles.first.messageId,
|
||||
messageId: allMediaFiles.first.messageOtherId!,
|
||||
),
|
||||
timestamp: DateTime.now(),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in a new issue