From 3f96c03df570181761723a6b619982d372e9f415 Mon Sep 17 00:00:00 2001 From: CherretGit Date: Mon, 1 Jun 2026 19:41:35 +0700 Subject: [PATCH 1/2] add invites tab --- assets/l10n/intl_en.arb | 7 ++++++- assets/l10n/intl_ru.arb | 7 ++++++- lib/pages/chat_list/chat_list.dart | 15 ++++++++++++--- lib/pages/chat_list/chat_list_bottom_navbar.dart | 10 ++++++---- .../chat_list_legacy_bottom_navbar.dart | 10 ++++++---- pubspec.lock | 16 ++++++++-------- 6 files changed, 44 insertions(+), 21 deletions(-) diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index 9dcf6b3c5..a9c25cdc0 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -3788,5 +3788,10 @@ "interactiveVerificationDescription": "If you are next to each other or communicate over a secure channel, then you may verify all devices at once.", "messageLayout": "Message layout", "bubblesLayout": "Bubbles", - "modernLayout": "Modern" + "modernLayout": "Modern", + "invites": "Invites", + "@invites": { + "type": "String", + "placeholders": {} + } } diff --git a/assets/l10n/intl_ru.arb b/assets/l10n/intl_ru.arb index baa9b0fa1..4bb726926 100644 --- a/assets/l10n/intl_ru.arb +++ b/assets/l10n/intl_ru.arb @@ -3860,5 +3860,10 @@ "interactiveVerificationDescription": "Если вы находитесь рядом или разговариваете по защищённому каналу связи, вы можете подтвердить все устройства.", "messageLayout": "Вид сообщений", "bubblesLayout": "Пузыри", - "modernLayout": "Современный" + "modernLayout": "Современный", + "invites": "Приглашения", + "@invites": { + "type": "String", + "placeholders": {} + } } diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index fd47058b3..dc3425383 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 && + !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 && + !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 && + !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) => !room.membership.isInvite && room.isUnreadOrInvited; case .spaces: - return (room) => room.isSpace; + return (room) => !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..ea05ad6dd 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, + 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.unread: (Room room) => room.isUnread, + ActiveFilter.allChats: (Room room) => !room.membership.isInvite, + ActiveFilter.messages: (Room room) => !room.membership.isInvite && room.isDirectChat, + ActiveFilter.groups: (Room room) => !room.membership.isInvite && !room.isDirectChat, + ActiveFilter.unread: (Room room) => !room.membership.isInvite && 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..2544a09f9 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, + 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.unread: (Room room) => room.isUnread, + ActiveFilter.allChats: (Room room) => !room.membership.isInvite, + ActiveFilter.messages: (Room room) => !room.membership.isInvite && room.isDirectChat, + ActiveFilter.groups: (Room room) => !room.membership.isInvite && !room.isDirectChat, + ActiveFilter.unread: (Room room) => !room.membership.isInvite && room.isUnread, + ActiveFilter.invites: (Room room) => room.membership.isInvite, ActiveFilter.spaces: (Room room) => false, ActiveFilter.people: (Room room) => false, }; diff --git a/pubspec.lock b/pubspec.lock index b0a67b078..b5c73a7ab 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1394,10 +1394,10 @@ packages: dependency: transitive description: name: meta - sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349" + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.17.0" mgrs_dart: dependency: transitive description: @@ -2271,26 +2271,26 @@ packages: dependency: transitive description: name: test - sha256: "8d9ceddbab833f180fbefed08afa76d7c03513dfdba87ffcec2718b02bbcbf20" + sha256: "280d6d890011ca966ad08df7e8a4ddfab0fb3aa49f96ed6de56e3521347a9ae7" url: "https://pub.dev" source: hosted - version: "1.31.0" + version: "1.30.0" test_api: dependency: transitive description: name: test_api - sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e" + sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a" url: "https://pub.dev" source: hosted - version: "0.7.11" + version: "0.7.10" test_core: dependency: transitive description: name: test_core - sha256: "1991d4cfe85d5043241acac92962c3977c8d2f2add1ee73130c7b286417d1d34" + sha256: "0381bd1585d1a924763c308100f2138205252fb90c9d4eeaf28489ee65ccde51" url: "https://pub.dev" source: hosted - version: "0.6.17" + version: "0.6.16" timezone: dependency: transitive description: From 62b76a11fe7b65204730135ac1bbefc11125c4ab Mon Sep 17 00:00:00 2001 From: CherretGit Date: Mon, 1 Jun 2026 20:43:38 +0700 Subject: [PATCH 2/2] Add toggle for invites tab --- assets/l10n/intl_en.arb | 5 +++++ assets/l10n/intl_ru.arb | 5 +++++ lib/config/setting_keys.dart | 1 + lib/pages/chat_list/chat_list.dart | 10 +++++----- lib/pages/chat_list/chat_list_bottom_navbar.dart | 10 +++++----- .../chat_list/chat_list_legacy_bottom_navbar.dart | 10 +++++----- .../settings_features/settings_features_view.dart | 5 +++++ 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index a9c25cdc0..91923529d 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -3793,5 +3793,10 @@ "@invites": { "type": "String", "placeholders": {} + }, + "enableInvitesTab": "\"Invites\" tab", + "@enableInvitesTab": { + "type": "String", + "placeholders": {} } } diff --git a/assets/l10n/intl_ru.arb b/assets/l10n/intl_ru.arb index 4bb726926..10c98076f 100644 --- a/assets/l10n/intl_ru.arb +++ b/assets/l10n/intl_ru.arb @@ -3865,5 +3865,10 @@ "@invites": { "type": "String", "placeholders": {} + }, + "enableInvitesTab": "Вкладка \"Приглашения\"", + "@enableInvitesTab": { + "type": "String", + "placeholders": {} } } 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 dc3425383..f750d2f24 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -170,7 +170,7 @@ class ChatListController extends State case .allChats: return (room) => !room.isSpace && - !room.membership.isInvite && + (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && (AppSettings.showSpaceRoomsInGlobalList.value || room.spaceParents .where((space) => spacesIds.contains(space.roomId)) @@ -179,7 +179,7 @@ class ChatListController extends State return (room) => !room.isSpace && room.isDirectChat && - !room.membership.isInvite && + (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && (AppSettings.showSpaceRoomsInGlobalList.value || room.spaceParents .where((space) => spacesIds.contains(space.roomId)) @@ -188,7 +188,7 @@ class ChatListController extends State return (room) => !room.isSpace && !room.isDirectChat && - !room.membership.isInvite && + (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && (AppSettings.showSpaceRoomsInGlobalList.value || room.spaceParents .where((space) => spacesIds.contains(space.roomId)) @@ -196,9 +196,9 @@ class ChatListController extends State case .invites: return (room) => room.membership.isInvite; case .unread: - return (room) => !room.membership.isInvite && room.isUnreadOrInvited; + return (room) => (!AppSettings.enableInvitesTab.value || !room.membership.isInvite) && room.isUnreadOrInvited; case .spaces: - return (room) => !room.membership.isInvite && 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 ea05ad6dd..6b5bbd5ab 100644 --- a/lib/pages/chat_list/chat_list_bottom_navbar.dart +++ b/lib/pages/chat_list/chat_list_bottom_navbar.dart @@ -51,7 +51,7 @@ class _ChatListBottomNavbarState extends State { ActiveFilter.allChats, if (AppSettings.separateChatTypes.value) ActiveFilter.groups, ActiveFilter.unread, - ActiveFilter.invites, + if (AppSettings.enableInvitesTab.value) ActiveFilter.invites, if (spaceDelegateCandidates.isNotEmpty && !_c.widget.displayNavigationRail) ActiveFilter.spaces, @@ -59,10 +59,10 @@ class _ChatListBottomNavbarState extends State { ]; final filterLambdas = { - ActiveFilter.allChats: (Room room) => !room.membership.isInvite, - ActiveFilter.messages: (Room room) => !room.membership.isInvite && room.isDirectChat, - ActiveFilter.groups: (Room room) => !room.membership.isInvite && !room.isDirectChat, - ActiveFilter.unread: (Room room) => !room.membership.isInvite && room.isUnread, + 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 2544a09f9..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,7 +50,7 @@ class _ChatListLegacyBottomNavbarState ActiveFilter.allChats, if (AppSettings.separateChatTypes.value) ActiveFilter.groups, ActiveFilter.unread, - ActiveFilter.invites, + if (AppSettings.enableInvitesTab.value) ActiveFilter.invites, if (spaceDelegateCandidates.isNotEmpty && !_c.widget.displayNavigationRail) ActiveFilter.spaces, @@ -58,10 +58,10 @@ class _ChatListLegacyBottomNavbarState ]; final filterLambdas = { - ActiveFilter.allChats: (Room room) => !room.membership.isInvite, - ActiveFilter.messages: (Room room) => !room.membership.isInvite && room.isDirectChat, - ActiveFilter.groups: (Room room) => !room.membership.isInvite && !room.isDirectChat, - ActiveFilter.unread: (Room room) => !room.membership.isInvite && room.isUnread, + 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(