chore: Simplify voiceMessage getter

This commit is contained in:
Christian Kußowski 2025-05-22 15:51:39 +02:00
parent d4f1381a26
commit 40cceb2176
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652

View file

@ -354,19 +354,11 @@ class MatrixLocals extends MatrixLocalizations {
String get cancelledSend => l10n.sendCanceled;
@override
String voiceMessage(String senderName, Duration? duration) {
final dateTime = duration == null
? null
: DateTime.fromMillisecondsSinceEpoch(
duration.inSeconds * 1000,
);
final formattedDuration = dateTime == null
? ''
: DateFormat(
DateFormat.MINUTE_SECOND,
l10n.localeName,
).format(dateTime);
return l10n.sentVoiceMessage(senderName, formattedDuration);
}
String voiceMessage(String senderName, Duration? duration) =>
l10n.sentVoiceMessage(
senderName,
duration == null
? ''
: '${duration.inMinutes}:${duration.inSeconds % 60}',
);
}