diff --git a/lib/pages/chat_details/chat_details_view.dart b/lib/pages/chat_details/chat_details_view.dart index 5c5d1b840..edf277e86 100644 --- a/lib/pages/chat_details/chat_details_view.dart +++ b/lib/pages/chat_details/chat_details_view.dart @@ -402,64 +402,6 @@ class ChatDetailsView extends StatelessWidget { startOpen: false, ), const Divider(height: 1), - if (!room.isDirectChat) - if (room.isRoomAdmin) - ListTile( - title: Text( - room.isSpace - ? L10n.of(context)!.archiveSpace - : L10n.of(context)!.archive, - style: TextStyle( - color: - Theme.of(context).colorScheme.secondary, - fontWeight: FontWeight.bold, - ), - ), - leading: CircleAvatar( - backgroundColor: - Theme.of(context).scaffoldBackgroundColor, - foregroundColor: iconColor, - child: const Icon( - Icons.archive_outlined, - ), - ), - onTap: () async { - var confirmed = OkCancelResult.ok; - var shouldGo = false; - // archiveSpace has its own popup; only show if not space - if (!room.isSpace) { - confirmed = await showOkCancelAlertDialog( - useRootNavigator: false, - context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, - message: L10n.of(context)! - .archiveRoomDescription, - ); - } - if (confirmed == OkCancelResult.ok) { - if (room.isSpace) { - shouldGo = await room.archiveSpace( - context, - Matrix.of(context).client, - ); - } else { - final success = - await showFutureLoadingDialog( - context: context, - future: () async { - await room.archive(); - }, - ); - shouldGo = (success.error == null); - } - if (shouldGo) { - context.go('/rooms'); - } - } - }, - ), ListTile( title: Text( L10n.of(context)!.leave, diff --git a/lib/pangea/models/space_model.dart b/lib/pangea/models/space_model.dart index 232899bb8..402ba0a14 100644 --- a/lib/pangea/models/space_model.dart +++ b/lib/pangea/models/space_model.dart @@ -269,4 +269,16 @@ extension SettingCopy on ToolSetting { return L10n.of(context)!.autoIGCToolDescription; } } + + bool get isAvailableSetting { + switch (this) { + case ToolSetting.interactiveTranslator: + case ToolSetting.interactiveGrammar: + case ToolSetting.definitions: + return false; + case ToolSetting.immersionMode: + case ToolSetting.autoIGC: + return true; + } + } } diff --git a/lib/pangea/pages/settings_learning/settings_learning_view.dart b/lib/pangea/pages/settings_learning/settings_learning_view.dart index 1a6576770..8a8f6da25 100644 --- a/lib/pangea/pages/settings_learning/settings_learning_view.dart +++ b/lib/pangea/pages/settings_learning/settings_learning_view.dart @@ -28,22 +28,12 @@ class SettingsLearningView extends StatelessWidget { children: [ LanguageTile(controller), CountryPickerTile(controller), - const SizedBox(height: 8), const Divider(height: 1), - const SizedBox(height: 8), - // if (controller.pangeaController.permissionsController.isUser18()) - // SwitchListTile.adaptive( - // activeColor: AppConfig.activeToggleColor, - // title: Text(L10n.of(context)!.publicProfileTitle), - // subtitle: Text(L10n.of(context)!.publicProfileDesc), - // value: controller.pangeaController.userController.isPublic, - // onChanged: (bool isPublicProfile) => - // controller.setPublicProfile(isPublicProfile), - // ), ListTile( - subtitle: Text(L10n.of(context)!.toggleToolSettingsDescription), + title: Text(L10n.of(context)!.toggleToolSettingsDescription), ), - for (final toolSetting in ToolSetting.values) + for (final toolSetting in ToolSetting.values + .where((tool) => tool.isAvailableSetting)) ProfileSettingsSwitchListTile.adaptive( defaultValue: controller.getToolSetting(toolSetting), title: toolSetting.toolName(context), @@ -66,18 +56,18 @@ class SettingsLearningView extends StatelessWidget { return profile; }), ), - ProfileSettingsSwitchListTile.adaptive( - defaultValue: controller.pangeaController.userController.profile - .userSettings.autoPlayMessages, - title: L10n.of(context)!.autoPlayTitle, - subtitle: L10n.of(context)!.autoPlayDesc, - onChange: (bool value) => controller - .pangeaController.userController - .updateProfile((profile) { - profile.userSettings.autoPlayMessages = value; - return profile; - }), - ), + // ProfileSettingsSwitchListTile.adaptive( + // defaultValue: controller.pangeaController.userController.profile + // .userSettings.autoPlayMessages, + // title: L10n.of(context)!.autoPlayTitle, + // subtitle: L10n.of(context)!.autoPlayDesc, + // onChange: (bool value) => controller + // .pangeaController.userController + // .updateProfile((profile) { + // profile.userSettings.autoPlayMessages = value; + // return profile; + // }), + // ), ], ), ), diff --git a/lib/widgets/chat_settings_popup_menu.dart b/lib/widgets/chat_settings_popup_menu.dart index bd4cf0a66..ffbdeec02 100644 --- a/lib/widgets/chat_settings_popup_menu.dart +++ b/lib/widgets/chat_settings_popup_menu.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:adaptive_dialog/adaptive_dialog.dart'; -import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart'; import 'package:fluffychat/pangea/utils/download_chat.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; @@ -18,7 +17,6 @@ enum ChatPopupMenuActions { leave, search, // #Pangea - archive, downloadTxt, downloadCsv, downloadXlsx, @@ -118,25 +116,6 @@ class ChatSettingsPopupMenuState extends State { context.go('/rooms/${widget.room.id}/search'); break; // #Pangea - case ChatPopupMenuActions.archive: - final confirmed = await showOkCancelAlertDialog( - useRootNavigator: false, - context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, - message: L10n.of(context)!.archiveRoomDescription, - ); - if (confirmed == OkCancelResult.ok) { - final success = await showFutureLoadingDialog( - context: context, - future: () => widget.room.archive(), - ); - if (success.error == null) { - context.go('/rooms'); - } - } - break; case ChatPopupMenuActions.downloadTxt: showFutureLoadingDialog( context: context, @@ -246,18 +225,6 @@ class ChatSettingsPopupMenuState extends State { ), ), // #Pangea - if (!widget.room.isArchived) - if (widget.room.isRoomAdmin) - PopupMenuItem( - value: ChatPopupMenuActions.archive, - child: Row( - children: [ - const Icon(Icons.archive_outlined), - const SizedBox(width: 12), - Text(L10n.of(context)!.archive), - ], - ), - ), PopupMenuItem( value: ChatPopupMenuActions.downloadTxt, child: Row(