Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion assets/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -3832,5 +3832,7 @@
},
"member": "Member",
"powerLevel": "Power level",
"apply": "Apply"
"apply": "Apply",
"invites": "Invites",
"enableInvitesTab": "\"Invites\" tab"
}
4 changes: 3 additions & 1 deletion assets/l10n/intl_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -3904,5 +3904,7 @@
},
"member": "Участник",
"powerLevel": "Уровень прав",
"apply": "Применить"
"apply": "Применить",
"invites": "Приглашения",
"enableInvitesTab": "Вкладка \"Приглашения\""
}
1 change: 1 addition & 0 deletions lib/config/setting_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enum AppSettings<T> {
messageStyle<String>('xyz.extera.messageStyle', 'bubbles'),
fallbackFonts<String>('xyz.extera.fallbackFonts', ''),
enablePeopleTab<bool>('xyz.extera.enablePeopleTab', true),
enableInvitesTab<bool>('xyz.extera.enableInvitesTab', true),
autoLoadMedia<bool>('xyz.extera.autoLoadMedia', true),
showCameraButton<bool>('xyz.extera.cameraButton', true),
stickerScale<double>('xyz.extera.stickerScale', 2),
Expand Down
15 changes: 12 additions & 3 deletions lib/pages/chat_list/chat_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ enum PopupMenuAction {
archive,
}

enum ActiveFilter { allChats, messages, groups, unread, spaces, people }
enum ActiveFilter { allChats, messages, groups, unread, invites, spaces, people }

extension LocalizedActiveFilter on ActiveFilter {
String toLocalizedString(BuildContext context) {
Expand All @@ -57,6 +57,8 @@ extension LocalizedActiveFilter on ActiveFilter {
return L10n.of(context).unread;
case ActiveFilter.groups:
return L10n.of(context).groups;
case ActiveFilter.invites:
return L10n.of(context).invites;
case ActiveFilter.spaces:
return L10n.of(context).spaces;
case ActiveFilter.people:
Expand All @@ -75,6 +77,8 @@ extension LocalizedActiveFilter on ActiveFilter {
: Icons.mark_unread_chat_alt;
case .groups:
return outline ? Icons.people_outline : Icons.people;
case .invites:
return outline ? Icons.mail_outline : Icons.mail;
case .spaces:
return outline ? Icons.grid_view_outlined : Icons.grid_view_rounded;
case .people:
Expand Down Expand Up @@ -166,6 +170,7 @@ class ChatListController extends State<ChatList>
case .allChats:
return (room) =>
!room.isSpace &&
(!AppSettings.enableInvitesTab.value || !room.membership.isInvite) &&
(AppSettings.showSpaceRoomsInGlobalList.value ||
room.spaceParents
.where((space) => spacesIds.contains(space.roomId))
Expand All @@ -174,6 +179,7 @@ class ChatListController extends State<ChatList>
return (room) =>
!room.isSpace &&
room.isDirectChat &&
(!AppSettings.enableInvitesTab.value || !room.membership.isInvite) &&
(AppSettings.showSpaceRoomsInGlobalList.value ||
room.spaceParents
.where((space) => spacesIds.contains(space.roomId))
Expand All @@ -182,14 +188,17 @@ class ChatListController extends State<ChatList>
return (room) =>
!room.isSpace &&
!room.isDirectChat &&
(!AppSettings.enableInvitesTab.value || !room.membership.isInvite) &&
(AppSettings.showSpaceRoomsInGlobalList.value ||
room.spaceParents
.where((space) => spacesIds.contains(space.roomId))
.isEmpty);
case .invites:
return (room) => room.membership.isInvite;
case .unread:
return (room) => room.isUnreadOrInvited;
return (room) => (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && room.isUnreadOrInvited;
case .spaces:
return (room) => room.isSpace;
return (room) => (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && room.isSpace;
case .people:
return (room) => false;
}
Expand Down
8 changes: 5 additions & 3 deletions lib/pages/chat_list/chat_list_bottom_navbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,19 @@ class _ChatListBottomNavbarState extends State<ChatListBottomNavbar> {
ActiveFilter.allChats,
if (AppSettings.separateChatTypes.value) ActiveFilter.groups,
ActiveFilter.unread,
if (AppSettings.enableInvitesTab.value) ActiveFilter.invites,
if (spaceDelegateCandidates.isNotEmpty &&
!_c.widget.displayNavigationRail)
ActiveFilter.spaces,
if (AppSettings.enablePeopleTab.value) ActiveFilter.people,
];

final filterLambdas = {
ActiveFilter.allChats: (Room room) => true,
ActiveFilter.messages: (Room room) => room.isDirectChat,
ActiveFilter.groups: (Room room) => !room.isDirectChat,
ActiveFilter.allChats: (Room room) =>(!AppSettings.enableInvitesTab.value || !room.membership.isInvite),
ActiveFilter.messages: (Room room) => (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && room.isDirectChat,
ActiveFilter.groups: (Room room) => (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && !room.isDirectChat,
ActiveFilter.unread: (Room room) => room.isUnread,
ActiveFilter.invites: (Room room) => room.membership.isInvite,
ActiveFilter.spaces: (Room room) => false,
ActiveFilter.people: (Room room) => false,
};
Expand Down
8 changes: 5 additions & 3 deletions lib/pages/chat_list/chat_list_legacy_bottom_navbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@ class _ChatListLegacyBottomNavbarState
ActiveFilter.allChats,
if (AppSettings.separateChatTypes.value) ActiveFilter.groups,
ActiveFilter.unread,
if (AppSettings.enableInvitesTab.value) ActiveFilter.invites,
if (spaceDelegateCandidates.isNotEmpty &&
!_c.widget.displayNavigationRail)
ActiveFilter.spaces,
if (AppSettings.enablePeopleTab.value) ActiveFilter.people,
];

final filterLambdas = {
ActiveFilter.allChats: (Room room) => true,
ActiveFilter.messages: (Room room) => room.isDirectChat,
ActiveFilter.groups: (Room room) => !room.isDirectChat,
ActiveFilter.allChats: (Room room) =>(!AppSettings.enableInvitesTab.value || !room.membership.isInvite),
ActiveFilter.messages: (Room room) => (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && room.isDirectChat,
ActiveFilter.groups: (Room room) => (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && !room.isDirectChat,
ActiveFilter.unread: (Room room) => room.isUnread,
ActiveFilter.invites: (Room room) => room.membership.isInvite,
ActiveFilter.spaces: (Room room) => false,
ActiveFilter.people: (Room room) => false,
};
Expand Down
5 changes: 5 additions & 0 deletions lib/pages/settings_features/settings_features_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ class SettingsFeaturesView extends StatelessWidget {
title: L10n.of(context).enablePeopleTab,
setting: AppSettings.enablePeopleTab,
),
const ListDivider(),
SettingsSwitchListTile.adaptive(
title: L10n.of(context).enableInvitesTab,
setting: AppSettings.enableInvitesTab,
),
if (PlatformInfos.isMobile) ...[
const ListDivider(),
SettingsSwitchListTile.adaptive(
Expand Down