mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-17 01:19:29 +01:00
19 lines
619 B
Dart
19 lines
619 B
Dart
import 'package:famedlysdk/famedlysdk.dart';
|
|
import 'package:fluffychat/l10n/l10n.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'date_time_extension.dart';
|
|
|
|
extension PresenceExtension on Presence {
|
|
String getLocalizedStatusMessage(BuildContext context) {
|
|
if (presence.statusMsg?.isNotEmpty ?? false) {
|
|
return presence.statusMsg;
|
|
}
|
|
if (presence.lastActiveAgo != null) {
|
|
return L10n.of(context).lastActiveAgo(
|
|
DateTime.fromMillisecondsSinceEpoch(presence.lastActiveAgo)
|
|
.localizedTimeShort(context));
|
|
}
|
|
return L10n.of(context).lastSeenLongTimeAgo;
|
|
}
|
|
}
|