mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 17:28:40 +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;
|
return client.Response()..ok = ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
String content = jsonEncode(message.content!.toJson());
|
|
||||||
|
|
||||||
bool acknowledgeByUser = false;
|
bool acknowledgeByUser = false;
|
||||||
DateTime? openedAt;
|
DateTime? openedAt;
|
||||||
|
|
||||||
|
|
@ -267,16 +265,21 @@ Future<client.Response> handleNewMessage(int fromUserId, Uint8List body) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
int? responseToMessageId;
|
int? responseToMessageId;
|
||||||
final textContent = message.content!;
|
|
||||||
if (textContent is TextMessageContent) {
|
final content = message.content!;
|
||||||
responseToMessageId = textContent.responseToMessageId;
|
if (content is TextMessageContent) {
|
||||||
|
responseToMessageId = content.responseToMessageId;
|
||||||
|
}
|
||||||
|
if (content is StoredMediaFileContent) {
|
||||||
|
responseToMessageId = content.messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String contentJson = jsonEncode(content.toJson());
|
||||||
final update = MessagesCompanion(
|
final update = MessagesCompanion(
|
||||||
contactId: Value(fromUserId),
|
contactId: Value(fromUserId),
|
||||||
kind: Value(message.kind),
|
kind: Value(message.kind),
|
||||||
messageOtherId: Value(message.messageId),
|
messageOtherId: Value(message.messageId),
|
||||||
contentJson: Value(content),
|
contentJson: Value(contentJson),
|
||||||
acknowledgeByServer: Value(true),
|
acknowledgeByServer: Value(true),
|
||||||
acknowledgeByUser: Value(acknowledgeByUser),
|
acknowledgeByUser: Value(acknowledgeByUser),
|
||||||
responseToMessageId: Value(responseToMessageId),
|
responseToMessageId: Value(responseToMessageId),
|
||||||
|
|
|
||||||
|
|
@ -414,9 +414,14 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (sendNextMediaToUserId != null) {
|
if (sendNextMediaToUserId != null) {
|
||||||
Uint8List? imageBytes = await getMergedImage();
|
Uint8List? imageBytes = await getMergedImage();
|
||||||
|
if (!context.mounted) return;
|
||||||
|
if (imageBytes == null) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
sendImage(
|
sendImage(
|
||||||
[sendNextMediaToUserId],
|
[sendNextMediaToUserId],
|
||||||
imageBytes!,
|
imageBytes,
|
||||||
_isRealTwonly,
|
_isRealTwonly,
|
||||||
maxShowTime,
|
maxShowTime,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,34 @@ class ChatListEntry extends StatelessWidget {
|
||||||
|
|
||||||
Widget getReactionRow() {
|
Widget getReactionRow() {
|
||||||
List<Widget> children = [];
|
List<Widget> children = [];
|
||||||
|
bool hasOneTextReaction = false;
|
||||||
for (final reaction in reactions) {
|
for (final reaction in reactions) {
|
||||||
if (children.isNotEmpty) break;
|
|
||||||
MessageContent? content = MessageContent.fromJson(
|
MessageContent? content = MessageContent.fromJson(
|
||||||
reaction.kind, jsonDecode(reaction.contentJson!));
|
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) {
|
if (content is TextMessageContent) {
|
||||||
|
hasOneTextReaction = true;
|
||||||
late Widget child;
|
late Widget child;
|
||||||
if (EmojiAnimation.animatedIcons.containsKey(content.text)) {
|
if (EmojiAnimation.animatedIcons.containsKey(content.text)) {
|
||||||
child = SizedBox(
|
child = SizedBox(
|
||||||
|
|
|
||||||
|
|
@ -392,6 +392,9 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
: Theme.of(context).colorScheme.primary,
|
: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
if (allMediaFiles.first.messageOtherId == null) {
|
||||||
|
return; // should not be possible
|
||||||
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
imageSaving = true;
|
imageSaving = true;
|
||||||
});
|
});
|
||||||
|
|
@ -402,7 +405,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
kind: MessageKind.storedMediaFile,
|
kind: MessageKind.storedMediaFile,
|
||||||
messageId: allMediaFiles.first.messageId,
|
messageId: allMediaFiles.first.messageId,
|
||||||
content: StoredMediaFileContent(
|
content: StoredMediaFileContent(
|
||||||
messageId: allMediaFiles.first.messageId,
|
messageId: allMediaFiles.first.messageOtherId!,
|
||||||
),
|
),
|
||||||
timestamp: DateTime.now(),
|
timestamp: DateTime.now(),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue