2020-04-26 18:15:48 +02:00
|
|
|
import 'package:famedlysdk/famedlysdk.dart';
|
2020-05-07 07:52:40 +02:00
|
|
|
import 'package:fluffychat/l10n/l10n.dart';
|
2020-04-26 18:15:48 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2020-05-06 18:31:38 +02:00
|
|
|
import 'date_time_extension.dart';
|
2020-04-26 18:15:48 +02:00
|
|
|
|
|
|
|
extension PresenceExtension on Presence {
|
|
|
|
String getLocalizedStatusMessage(BuildContext context) {
|
2020-06-10 10:07:01 +02:00
|
|
|
if (presence.statusMsg?.isNotEmpty ?? false) {
|
|
|
|
return presence.statusMsg;
|
2020-04-26 18:15:48 +02:00
|
|
|
}
|
2020-06-10 10:07:01 +02:00
|
|
|
return L10n.of(context).lastActiveAgo(
|
|
|
|
DateTime.fromMillisecondsSinceEpoch(presence.lastActiveAgo)
|
|
|
|
.localizedTimeShort(context));
|
2020-04-26 18:15:48 +02:00
|
|
|
}
|
|
|
|
}
|