Skip to content

Commit

Permalink
Merge pull request #223 from pangeachat/archive-only-show-chats
Browse files Browse the repository at this point in the history
Archive list only shows chats
  • Loading branch information
ggurdin authored May 20, 2024
2 parents e156408 + 8c421d8 commit 4466c64
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
16 changes: 10 additions & 6 deletions lib/pages/archive/archive.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'package:flutter/material.dart';

import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:fluffychat/pages/archive/archive_view.dart';
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart';

import 'package:fluffychat/pages/archive/archive_view.dart';
import 'package:fluffychat/widgets/matrix.dart';

class Archive extends StatefulWidget {
const Archive({super.key});

Expand All @@ -20,7 +19,12 @@ class ArchiveController extends State<Archive> {

Future<List<Room>> getArchive(BuildContext context) async {
if (archive.isNotEmpty) return archive;
return archive = await Matrix.of(context).client.loadArchive();
// #Pangea
//return archive = await Matrix.of(context).client.loadArchive();
return archive = (await Matrix.of(context).client.loadArchive())
.where((e) => (!e.isSpace && !e.isAnalyticsRoom))
.toList();
// Pangea#
}

void forgetRoomAction(int i) async {
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/chat/chat_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class ChatView extends StatelessWidget {
// #Pangea
} else {
return [
ChatSettingsPopupMenu(controller.room, !controller.room.isDirectChat),
ChatSettingsPopupMenu(controller.room,
(!controller.room.isDirectChat && !controller.room.isArchived)),
];
}

Expand Down
27 changes: 15 additions & 12 deletions lib/widgets/chat_settings_popup_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,22 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
],
),
),
PopupMenuItem<String>(
value: 'leave',
child: Row(
children: [
// #Pangea
// const Icon(Icons.delete_outlined),
const Icon(Icons.arrow_forward),
// Pangea#
const SizedBox(width: 12),
Text(L10n.of(context)!.leave),
],
// #Pangea
if (!widget.room.isArchived)
// Pangea#
PopupMenuItem<String>(
value: 'leave',
child: Row(
children: [
// #Pangea
// const Icon(Icons.delete_outlined),
const Icon(Icons.arrow_forward),
// Pangea#
const SizedBox(width: 12),
Text(L10n.of(context)!.leave),
],
),
),
),
// #Pangea
if (classSettings != null)
PopupMenuItem<String>(
Expand Down

0 comments on commit 4466c64

Please sign in to comment.