FurryChat/lib/utils/presence_extension.dart

19 lines
619 B
Dart
Raw Normal View History

import 'package:famedlysdk/famedlysdk.dart';
2020-05-07 05:52:40 +00:00
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
2020-05-06 16:31:38 +00:00
import 'date_time_extension.dart';
extension PresenceExtension on Presence {
String getLocalizedStatusMessage(BuildContext context) {
2020-06-10 08:07:01 +00:00
if (presence.statusMsg?.isNotEmpty ?? false) {
return presence.statusMsg;
}
2020-06-19 13:10:26 +00:00
if (presence.lastActiveAgo != null) {
return L10n.of(context).lastActiveAgo(
DateTime.fromMillisecondsSinceEpoch(presence.lastActiveAgo)
.localizedTimeShort(context));
}
return L10n.of(context).lastSeenLongTimeAgo;
}
}