From 959172fcfe265355056c794f0ee3ce288f94a598 Mon Sep 17 00:00:00 2001 From: Kelrap Date: Tue, 6 Aug 2024 16:40:11 -0400 Subject: [PATCH 1/2] Hide public profile toggle in learning settings --- .../settings_learning_view.dart | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/pangea/pages/settings_learning/settings_learning_view.dart b/lib/pangea/pages/settings_learning/settings_learning_view.dart index 4182ab2d6..1a6576770 100644 --- a/lib/pangea/pages/settings_learning/settings_learning_view.dart +++ b/lib/pangea/pages/settings_learning/settings_learning_view.dart @@ -1,4 +1,3 @@ -import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/pangea/models/space_model.dart'; import 'package:fluffychat/pangea/pages/settings_learning/settings_learning.dart'; import 'package:fluffychat/pangea/widgets/user_settings/country_picker_tile.dart'; @@ -32,15 +31,15 @@ class SettingsLearningView extends StatelessWidget { 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), - ), + // 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), ), From 71650600411b1486d843ff42bbe6b819f76dbbe8 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Wed, 7 Aug 2024 09:59:01 -0400 Subject: [PATCH 2/2] choreographer pulls roomID from chat so input bar key does not change after setting choreo roomID, resolving issues with input bar auto-focus --- lib/pages/chat/chat.dart | 1 - lib/pages/chat/input_bar.dart | 6 +++--- lib/pangea/choreographer/controllers/choreographer.dart | 6 +----- lib/pangea/widgets/igc/pangea_text_controller.dart | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index b2cdc9f47..3e0413230 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -328,7 +328,6 @@ class ChatController extends State ); } await Matrix.of(context).client.roomsLoading; - choreographer.setRoomId(roomId); }); // Pangea# _tryLoadTimeline(); diff --git a/lib/pages/chat/input_bar.dart b/lib/pages/chat/input_bar.dart index 84a802e54..61ce641fc 100644 --- a/lib/pages/chat/input_bar.dart +++ b/lib/pages/chat/input_bar.dart @@ -463,7 +463,7 @@ class InputBar extends StatelessWidget { debounceDuration: const Duration(milliseconds: 50), // show suggestions after 50ms idle time (default is 300) // #Pangea - key: controller!.choreographer.inputLayerLinkAndKey.key, + key: controller?.choreographer.inputLayerLinkAndKey.key, // builder: (context, controller, focusNode) => TextField( builder: (context, _, focusNode) => TextField( // Pangea# @@ -504,11 +504,11 @@ class InputBar extends StatelessWidget { onSubmitted!(text); }, // #Pangea - style: controller?.isMaxLength ?? false + style: controller?.exceededMaxLength ?? false ? const TextStyle(color: Colors.red) : null, onTap: () { - controller!.onInputTap( + controller?.onInputTap( context, fNode: focusNode, ); diff --git a/lib/pangea/choreographer/controllers/choreographer.dart b/lib/pangea/choreographer/controllers/choreographer.dart index dd2078fa2..c3cd0ab09 100644 --- a/lib/pangea/choreographer/controllers/choreographer.dart +++ b/lib/pangea/choreographer/controllers/choreographer.dart @@ -42,7 +42,6 @@ class Choreographer { bool isFetching = false; Timer? debounceTimer; - String? _roomId; ChoreoRecord choreoRecord = ChoreoRecord.newRecord; // last checked by IGC or translation String? _lastChecked; @@ -464,10 +463,7 @@ class Choreographer { setState(); } - get roomId => _roomId; - void setRoomId(String? roomId) { - _roomId = roomId ?? ''; - } + get roomId => chatController.roomId; bool get _useCustomInput => [ EditType.keyboard, diff --git a/lib/pangea/widgets/igc/pangea_text_controller.dart b/lib/pangea/widgets/igc/pangea_text_controller.dart index 8fc136edd..63c5b3f94 100644 --- a/lib/pangea/widgets/igc/pangea_text_controller.dart +++ b/lib/pangea/widgets/igc/pangea_text_controller.dart @@ -27,7 +27,7 @@ class PangeaTextController extends TextEditingController { } static const int maxLength = 1000; - bool get isMaxLength => text.length == 1000; + bool get exceededMaxLength => text.length >= maxLength; bool forceKeepOpen = false;