chore: Simplify voiceMessage getter
This commit is contained in:
parent
d4f1381a26
commit
40cceb2176
1 changed files with 7 additions and 15 deletions
|
|
@ -354,19 +354,11 @@ class MatrixLocals extends MatrixLocalizations {
|
||||||
String get cancelledSend => l10n.sendCanceled;
|
String get cancelledSend => l10n.sendCanceled;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String voiceMessage(String senderName, Duration? duration) {
|
String voiceMessage(String senderName, Duration? duration) =>
|
||||||
final dateTime = duration == null
|
l10n.sentVoiceMessage(
|
||||||
? null
|
senderName,
|
||||||
: DateTime.fromMillisecondsSinceEpoch(
|
duration == null
|
||||||
duration.inSeconds * 1000,
|
? ''
|
||||||
);
|
: '${duration.inMinutes}:${duration.inSeconds % 60}',
|
||||||
final formattedDuration = dateTime == null
|
);
|
||||||
? ''
|
|
||||||
: DateFormat(
|
|
||||||
DateFormat.MINUTE_SECOND,
|
|
||||||
l10n.localeName,
|
|
||||||
).format(dateTime);
|
|
||||||
|
|
||||||
return l10n.sentVoiceMessage(senderName, formattedDuration);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue