mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-10-14 17:59:24 +02:00
21 lines
648 B
Dart
21 lines
648 B
Dart
import 'package:famedlysdk/famedlysdk.dart';
|
|
import 'package:fluffychat/i18n/i18n.dart';
|
|
|
|
extension LocalizedRoomDisplayname on Room {
|
|
String getLocalizedDisplayname(I18n i18n) {
|
|
if ((this.name?.isEmpty ?? true) &&
|
|
(this.canonicalAlias?.isEmpty ?? true) &&
|
|
!this.isDirectChat &&
|
|
(this.mHeroes != null && this.mHeroes.isNotEmpty)) {
|
|
return i18n.groupWith(this.displayname);
|
|
}
|
|
if ((this.name?.isEmpty ?? true) &&
|
|
(this.canonicalAlias?.isEmpty ?? true) &&
|
|
!this.isDirectChat &&
|
|
(this.mHeroes?.isEmpty ?? true)) {
|
|
return i18n.emptyChat;
|
|
}
|
|
return this.displayname;
|
|
}
|
|
}
|