Skip to content

Commit

Permalink
Merge branch 'main' into practice
Browse files Browse the repository at this point in the history
  • Loading branch information
ggurdin committed Jun 25, 2024
2 parents 22af3d0 + fffa902 commit c304da4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
33 changes: 6 additions & 27 deletions lib/pages/chat_list/chat_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:io';

import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:collection/collection.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/pages/chat_list/chat_list_view.dart';
Expand Down Expand Up @@ -213,32 +212,12 @@ class ChatListController extends State<ChatList>
}

List<Room> get filteredRooms => Matrix.of(context)
.client
.rooms
.where(
getRoomFilterByActiveFilter(activeFilter),
)
// #Pangea
.sorted((roomA, roomB) {
// put rooms with unread messages at the top of the list
if (roomA.membership == Membership.invite &&
roomB.membership != Membership.invite) {
return -1;
}
if (roomA.membership != Membership.invite &&
roomB.membership == Membership.invite) {
return 1;
}

final bool aUnread = roomA.notificationCount > 0 || roomA.markedUnread;
final bool bUnread = roomB.notificationCount > 0 || roomB.markedUnread;
if (aUnread && !bUnread) return -1;
if (!aUnread && bUnread) return 1;

return 0;
})
// Pangea#
.toList();
.client
.rooms
.where(
getRoomFilterByActiveFilter(activeFilter),
)
.toList();

bool isSearchMode = false;
Future<QueryPublicRoomsResponse>? publicRoomsResponse;
Expand Down
5 changes: 4 additions & 1 deletion lib/pages/chat_list/client_chooser_button.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:fluffychat/pangea/constants/class_default_values.dart';
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
import 'package:fluffychat/pangea/utils/find_conversation_partner_dialog.dart';
import 'package:fluffychat/pangea/utils/logout.dart';
import 'package:fluffychat/pangea/utils/space_code.dart';
Expand Down Expand Up @@ -68,7 +69,9 @@ class ClientChooserButton extends StatelessWidget {
),
),
PopupMenuItem(
enabled: matrix.client.rooms.isNotEmpty,
enabled: matrix.client.rooms.any(
(room) => !room.isSpace && !room.isArchived && !room.isAnalyticsRoom,
),
value: SettingsAction.myAnalytics,
child: Row(
children: [
Expand Down

0 comments on commit c304da4

Please sign in to comment.