Skip to content

Commit

Permalink
Update date time when use sendEvent()
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev committed Jun 26, 2024
1 parent ad561ad commit 399375e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/src/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,13 @@ class Room {
threadRootEventId: threadRootEventId,
threadLastEventId: threadLastEventId);
}

final eventContent = getEventContentFromMsgText(
message: message,
parseMarkdown: parseMarkdown,
msgtype: msgtype,
);
return sendEvent(
eventContent,
return sendEvent(eventContent,
txid: txid,
inReplyTo: inReplyTo,
editEventId: editEventId,
Expand Down Expand Up @@ -783,6 +782,7 @@ class Room {
String? editEventId,
String? threadRootEventId,
String? threadLastEventId,
DateTime? sentDate,
}) async {
// Create new transaction id
final String messageID;
Expand Down Expand Up @@ -854,7 +854,6 @@ class Room {
content['formatted_body'] = '* ${content['formatted_body']}';
}
}
final sentDate = DateTime.now();
final syncUpdate = SyncUpdate(
nextBatch: '',
rooms: RoomsUpdate(
Expand All @@ -867,7 +866,7 @@ class Room {
type: type,
eventId: messageID,
senderId: client.userID!,
originServerTs: sentDate,
originServerTs: sentDate ?? DateTime.now(),
unsigned: {
messageSendingStatusKey: EventStatus.sending.intValue,
'transaction_id': messageID,
Expand Down Expand Up @@ -1022,9 +1021,11 @@ class Room {
}

/// Call the Matrix API to invite a user to this room.
Future<void> invite(String userID, {
Future<void> invite(
String userID, {
String reason = 'Welcome',
}) => client.inviteUser(id, userID, reason: reason);
}) =>
client.inviteUser(id, userID, reason: reason);

/// Request more previous events from the server. [historyCount] defines how much events should
/// be received maximum. When the request is answered, [onHistoryReceived] will be triggered **before**
Expand Down

0 comments on commit 399375e

Please sign in to comment.