diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index 16f6e97f3..1f1c08ba5 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -3832,5 +3832,7 @@ }, "member": "Member", "powerLevel": "Power level", - "apply": "Apply" + "apply": "Apply", + "invites": "Invites", + "enableInvitesTab": "\"Invites\" tab" } diff --git a/assets/l10n/intl_ru.arb b/assets/l10n/intl_ru.arb index c0ae1aab1..6a70fd513 100644 --- a/assets/l10n/intl_ru.arb +++ b/assets/l10n/intl_ru.arb @@ -3904,5 +3904,7 @@ }, "member": "Участник", "powerLevel": "Уровень прав", - "apply": "Применить" + "apply": "Применить", + "invites": "Приглашения", + "enableInvitesTab": "Вкладка \"Приглашения\"" } diff --git a/lib/config/setting_keys.dart b/lib/config/setting_keys.dart index 7753e9258..d91a11ffb 100644 --- a/lib/config/setting_keys.dart +++ b/lib/config/setting_keys.dart @@ -27,6 +27,7 @@ enum AppSettings { messageStyle('xyz.extera.messageStyle', 'bubbles'), fallbackFonts('xyz.extera.fallbackFonts', ''), enablePeopleTab('xyz.extera.enablePeopleTab', true), + enableInvitesTab('xyz.extera.enableInvitesTab', true), autoLoadMedia('xyz.extera.autoLoadMedia', true), showCameraButton('xyz.extera.cameraButton', true), stickerScale('xyz.extera.stickerScale', 2), diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index fd47058b3..f750d2f24 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -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) { @@ -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: @@ -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: @@ -166,6 +170,7 @@ class ChatListController extends State case .allChats: return (room) => !room.isSpace && + (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && (AppSettings.showSpaceRoomsInGlobalList.value || room.spaceParents .where((space) => spacesIds.contains(space.roomId)) @@ -174,6 +179,7 @@ class ChatListController extends State return (room) => !room.isSpace && room.isDirectChat && + (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && (AppSettings.showSpaceRoomsInGlobalList.value || room.spaceParents .where((space) => spacesIds.contains(space.roomId)) @@ -182,14 +188,17 @@ class ChatListController extends State 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; } diff --git a/lib/pages/chat_list/chat_list_bottom_navbar.dart b/lib/pages/chat_list/chat_list_bottom_navbar.dart index b0879c8e3..6b5bbd5ab 100644 --- a/lib/pages/chat_list/chat_list_bottom_navbar.dart +++ b/lib/pages/chat_list/chat_list_bottom_navbar.dart @@ -51,6 +51,7 @@ class _ChatListBottomNavbarState extends State { ActiveFilter.allChats, if (AppSettings.separateChatTypes.value) ActiveFilter.groups, ActiveFilter.unread, + if (AppSettings.enableInvitesTab.value) ActiveFilter.invites, if (spaceDelegateCandidates.isNotEmpty && !_c.widget.displayNavigationRail) ActiveFilter.spaces, @@ -58,10 +59,11 @@ class _ChatListBottomNavbarState extends State { ]; 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, }; diff --git a/lib/pages/chat_list/chat_list_legacy_bottom_navbar.dart b/lib/pages/chat_list/chat_list_legacy_bottom_navbar.dart index de59c790e..afde21db9 100644 --- a/lib/pages/chat_list/chat_list_legacy_bottom_navbar.dart +++ b/lib/pages/chat_list/chat_list_legacy_bottom_navbar.dart @@ -50,6 +50,7 @@ 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, @@ -57,10 +58,11 @@ class _ChatListLegacyBottomNavbarState ]; 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, }; diff --git a/lib/pages/settings_features/settings_features_view.dart b/lib/pages/settings_features/settings_features_view.dart index ead432002..7d93a6d86 100644 --- a/lib/pages/settings_features/settings_features_view.dart +++ b/lib/pages/settings_features/settings_features_view.dart @@ -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(