From 6c96f849faf1959f4abd1fbe2f1dcff89c382081 Mon Sep 17 00:00:00 2001 From: Waqas Date: Mon, 29 Apr 2024 11:20:27 -0400 Subject: [PATCH 1/3] Archive Button --- lib/pages/chat_details/chat_details_view.dart | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/pages/chat_details/chat_details_view.dart b/lib/pages/chat_details/chat_details_view.dart index ddb64b167..2b6f22d5f 100644 --- a/lib/pages/chat_details/chat_details_view.dart +++ b/lib/pages/chat_details/chat_details_view.dart @@ -559,6 +559,39 @@ class ChatDetailsView extends StatelessWidget { } }, ), + if (!room.isDirectChat) + ListTile( + title: Text(L10n.of(context)!.archive), + subtitle: Text( + L10n.of(context)!.archiveRoomDescription, + ), + leading: CircleAvatar( + backgroundColor: + Theme.of(context).scaffoldBackgroundColor, + foregroundColor: iconColor, + child: const Icon( + Icons.edit_attributes_outlined, + ), + ), + trailing: const Icon(Icons.chevron_right_outlined), + onTap: () async { + final confirmed = await showOkCancelAlertDialog( + useRootNavigator: false, + context: context, + title: L10n.of(context)!.areYouSure, + okLabel: L10n.of(context)!.yes, + cancelLabel: L10n.of(context)!.no, + message: + L10n.of(context)!.archiveRoomDescription, + ); + if (confirmed == OkCancelResult.cancel) return; + await showFutureLoadingDialog( + context: context, + future: () => room.leave(), + ); + }, + ), + if (room.isRoomAdmin && !room.isDirectChat) SwitchListTile.adaptive( activeColor: AppConfig.activeToggleColor, From 60f202b0193692c01586deb6f1e1f0974d58baad Mon Sep 17 00:00:00 2001 From: Gabby Gurdin Date: Wed, 1 May 2024 09:09:21 -0400 Subject: [PATCH 2/3] allow students to leave chats and class via the archive button --- lib/pages/chat_details/chat_details_view.dart | 4 +--- lib/pages/chat_list/space_view.dart | 18 +++++++++++------- linux/flutter/generated_plugin_registrant.cc | 4 ---- linux/flutter/generated_plugins.cmake | 1 - macos/Flutter/GeneratedPluginRegistrant.swift | 8 ++------ windows/flutter/generated_plugin_registrant.cc | 6 ------ windows/flutter/generated_plugins.cmake | 2 -- 7 files changed, 14 insertions(+), 29 deletions(-) diff --git a/lib/pages/chat_details/chat_details_view.dart b/lib/pages/chat_details/chat_details_view.dart index 2b6f22d5f..b8892f0b7 100644 --- a/lib/pages/chat_details/chat_details_view.dart +++ b/lib/pages/chat_details/chat_details_view.dart @@ -510,9 +510,7 @@ class ChatDetailsView extends StatelessWidget { : AddToClassMode.chat, ), const Divider(height: 1), - if (!room.isDirectChat && - (!room.isSpace || - (room.isSpace && room.isRoomAdmin))) + if (!room.isDirectChat) ListTile( title: Text( room.isSpace diff --git a/lib/pages/chat_list/space_view.dart b/lib/pages/chat_list/space_view.dart index bc92ab4ef..c82838f12 100644 --- a/lib/pages/chat_list/space_view.dart +++ b/lib/pages/chat_list/space_view.dart @@ -45,6 +45,7 @@ class _SpaceViewState extends State { bool loading = false; // #Pangea StreamSubscription? _roomSubscription; + bool refreshing = false; // Pangea# @override @@ -377,18 +378,20 @@ class _SpaceViewState extends State { } // #Pangea - void refreshOnUpdate(SyncUpdate event) { + Future refreshOnUpdate(SyncUpdate event) async { /* refresh on leave, invite, and space child update not join events, because there's already a listener on onTapSpaceChild, and they interfere with each other */ - if (widget.controller.activeSpaceId == null || !mounted) { + if (widget.controller.activeSpaceId == null || !mounted || refreshing) { return; } + setState(() => refreshing = true); final client = Matrix.of(context).client; - if (event.isMembershipUpdateByType( - Membership.leave, - client.userID!, - ) || + if (mounted && + event.isMembershipUpdateByType( + Membership.leave, + client.userID!, + ) || event.isMembershipUpdateByType( Membership.invite, client.userID!, @@ -396,8 +399,9 @@ class _SpaceViewState extends State { event.isSpaceChildUpdate( widget.controller.activeSpaceId!, )) { - _refresh(); + await loadHierarchy(); } + setState(() => refreshing = false); } // Pangea# diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index f1b16b116..0764f8001 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,7 +6,6 @@ #include "generated_plugin_registrant.h" -#include #include #include #include @@ -20,9 +19,6 @@ #include void fl_register_plugins(FlPluginRegistry* registry) { - g_autoptr(FlPluginRegistrar) desktop_lifecycle_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopLifecyclePlugin"); - desktop_lifecycle_plugin_register_with_registrar(desktop_lifecycle_registrar); g_autoptr(FlPluginRegistrar) dynamic_color_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin"); dynamic_color_plugin_register_with_registrar(dynamic_color_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 26540a8d9..92fe21eec 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - desktop_lifecycle dynamic_color emoji_picker_flutter file_selector_linux diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index ca9f6a185..ce6ae4707 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -7,8 +7,6 @@ import Foundation import appkit_ui_element_colors import audio_session -import connectivity_plus -import desktop_lifecycle import device_info_plus import dynamic_color import emoji_picker_flutter @@ -30,7 +28,7 @@ import package_info_plus import pasteboard import path_provider_foundation import purchases_flutter -import record_darwin +import record_macos import sentry_flutter import share_plus import shared_preferences_foundation @@ -45,8 +43,6 @@ import window_to_front func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AppkitUiElementColorsPlugin.register(with: registry.registrar(forPlugin: "AppkitUiElementColorsPlugin")) AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) - ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) - DesktopLifecyclePlugin.register(with: registry.registrar(forPlugin: "DesktopLifecyclePlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin")) @@ -68,7 +64,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PurchasesFlutterPlugin.register(with: registry.registrar(forPlugin: "PurchasesFlutterPlugin")) - RecordPlugin.register(with: registry.registrar(forPlugin: "RecordPlugin")) + RecordMacosPlugin.register(with: registry.registrar(forPlugin: "RecordMacosPlugin")) SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 83c63ff60..4798ca389 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,8 +6,6 @@ #include "generated_plugin_registrant.h" -#include -#include #include #include #include @@ -24,10 +22,6 @@ #include void RegisterPlugins(flutter::PluginRegistry* registry) { - ConnectivityPlusWindowsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); - DesktopLifecyclePluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("DesktopLifecyclePlugin")); DynamicColorPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); EmojiPickerFlutterPluginCApiRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index e4a58181e..bf885c6b1 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,8 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - connectivity_plus - desktop_lifecycle dynamic_color emoji_picker_flutter file_selector_windows From 7964d155cef747896f689b534feb9a695e5d4194 Mon Sep 17 00:00:00 2001 From: Gabby Gurdin Date: Wed, 1 May 2024 09:16:50 -0400 Subject: [PATCH 3/3] remove duplicate archive button --- lib/pages/chat_details/chat_details_view.dart | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/lib/pages/chat_details/chat_details_view.dart b/lib/pages/chat_details/chat_details_view.dart index b8892f0b7..9dbdc640c 100644 --- a/lib/pages/chat_details/chat_details_view.dart +++ b/lib/pages/chat_details/chat_details_view.dart @@ -557,39 +557,6 @@ class ChatDetailsView extends StatelessWidget { } }, ), - if (!room.isDirectChat) - ListTile( - title: Text(L10n.of(context)!.archive), - subtitle: Text( - L10n.of(context)!.archiveRoomDescription, - ), - leading: CircleAvatar( - backgroundColor: - Theme.of(context).scaffoldBackgroundColor, - foregroundColor: iconColor, - child: const Icon( - Icons.edit_attributes_outlined, - ), - ), - trailing: const Icon(Icons.chevron_right_outlined), - onTap: () async { - final confirmed = await showOkCancelAlertDialog( - useRootNavigator: false, - context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.no, - message: - L10n.of(context)!.archiveRoomDescription, - ); - if (confirmed == OkCancelResult.cancel) return; - await showFutureLoadingDialog( - context: context, - future: () => room.leave(), - ); - }, - ), - if (room.isRoomAdmin && !room.isDirectChat) SwitchListTile.adaptive( activeColor: AppConfig.activeToggleColor,