✨ Call records
This commit is contained in:
parent
ec14d1e3b3
commit
459469998b
@ -168,6 +168,8 @@ class SolianMessages extends Translations {
|
||||
'messageUnsyncCaption': '@count message(s) still in un-synced.',
|
||||
'messageEditDesc': 'Edited message @id',
|
||||
'messageDeleteDesc': 'Deleted message @id',
|
||||
'messageCallStartDesc': '@user starts a call',
|
||||
'messageCallEndDesc': 'Call last for @duration',
|
||||
'messageTypeUnsupported': 'Unsupported Message: @type',
|
||||
'messageInputPlaceholder': 'Message @channel',
|
||||
'messageActionList': 'Actions of Message',
|
||||
@ -385,6 +387,8 @@ class SolianMessages extends Translations {
|
||||
'messageDecoding': '解码信息中…',
|
||||
'messageEditDesc': '修改了消息 @id',
|
||||
'messageDeleteDesc': '删除了消息 @id',
|
||||
'messageCallStartDesc': '@user 发起了一次童话',
|
||||
'messageCallEndDesc': '通话持续了 @duration',
|
||||
'messageTypeUnsupported': '不支持的消息类型 @type',
|
||||
'messageActionList': '消息的操作',
|
||||
'messageDeletionConfirm': '确认删除消息',
|
||||
|
@ -1,5 +1,3 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -30,6 +28,14 @@ class ChatEvent extends StatelessWidget {
|
||||
this.chatController,
|
||||
});
|
||||
|
||||
String _formatDuration(Duration duration) {
|
||||
String negativeSign = duration.isNegative ? '-' : '';
|
||||
String twoDigits(int n) => n.toString().padLeft(2, '0');
|
||||
String twoDigitMinutes = twoDigits(duration.inMinutes.remainder(60).abs());
|
||||
String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60).abs());
|
||||
return '$negativeSign${twoDigits(duration.inHours)}:$twoDigitMinutes:$twoDigitSeconds';
|
||||
}
|
||||
|
||||
Widget buildQuote() {
|
||||
return FutureBuilder(
|
||||
future: chatController!.getEvent(
|
||||
@ -75,6 +81,27 @@ class ChatEvent extends StatelessWidget {
|
||||
isHasMerged: isHasMerged,
|
||||
isQuote: isQuote,
|
||||
);
|
||||
case 'calls.start':
|
||||
return ChatEventMessageActionLog(
|
||||
icon: const Icon(Icons.call_made, size: 16),
|
||||
text: 'messageCallStartDesc'
|
||||
.trParams({'user': '@${item.sender.account.name}'}),
|
||||
isMerged: isMerged,
|
||||
isHasMerged: isHasMerged,
|
||||
isQuote: isQuote,
|
||||
);
|
||||
case 'calls.end':
|
||||
return ChatEventMessageActionLog(
|
||||
icon: const Icon(Icons.call_received, size: 16),
|
||||
text: 'messageCallEndDesc'.trParams({
|
||||
'duration': _formatDuration(
|
||||
Duration(milliseconds: item.body['last']),
|
||||
),
|
||||
}),
|
||||
isMerged: isMerged,
|
||||
isHasMerged: isHasMerged,
|
||||
isQuote: isQuote,
|
||||
);
|
||||
case 'system.changes':
|
||||
return ChatEventMessageActionLog(
|
||||
icon: const Icon(Icons.manage_history, size: 16),
|
||||
|
@ -65,8 +65,9 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
||||
|
||||
// TODO Deal with the @ ping (query uid with username), and then add into related_user and replace the @ with internal link in body
|
||||
|
||||
const uuid = Uuid();
|
||||
final payload = {
|
||||
'uuid': const Uuid().v4(),
|
||||
'uuid': uuid.v4(),
|
||||
'type': _editTo == null ? 'messages.new' : 'messages.edit',
|
||||
'body': {
|
||||
'text': _textController.value.text,
|
||||
|
Loading…
Reference in New Issue
Block a user