From 59e521b69e758cc31c339de93369ce4f4a0971be Mon Sep 17 00:00:00 2001 From: Kelrap Date: Wed, 26 Jun 2024 12:27:45 -0400 Subject: [PATCH] Hide some Chat permission options --- .../chat_permissions_settings_view.dart | 111 +++++++++++------- .../subscription/subscription_options.dart | 2 +- 2 files changed, 68 insertions(+), 45 deletions(-) diff --git a/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart b/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart index ea81c842c2..2b1dff1874 100644 --- a/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart +++ b/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart @@ -35,11 +35,26 @@ class ChatPermissionsSettingsView extends StatelessWidget { final powerLevels = Map.from(powerLevelsContent) // #Pangea // ..removeWhere((k, v) => v is! int); - ..removeWhere((k, v) => v is! int || k.equals("m.call.invite")); + ..removeWhere( + (k, v) => + v is! int || + k.equals("m.call.invite") || + k.equals("historical") || + k.equals("state_default"), + ); // Pangea# final eventsPowerLevels = Map.from( powerLevelsContent.tryGetMap('events') ?? {}, - )..removeWhere((k, v) => v is! int); + // #Pangea + )..removeWhere( + (k, v) => + v is! int || + k.equals("m.space.child") || + k.equals("pangea.usranalytics") || + k.equals(EventTypes.RoomPowerLevels), + ); + // )..removeWhere((k, v) => v is! int); + // Pangea# return Column( children: [ Column( @@ -57,51 +72,59 @@ class ChatPermissionsSettingsView extends StatelessWidget { ), canEdit: room.canChangePowerLevel, ), - Divider(color: Theme.of(context).dividerColor), - ListTile( - title: Text( - L10n.of(context)!.notifications, - style: TextStyle( - color: Theme.of(context).colorScheme.primary, - fontWeight: FontWeight.bold, - ), - ), - ), - Builder( - builder: (context) { - const key = 'rooms'; - final value = powerLevelsContent - .containsKey('notifications') - ? powerLevelsContent - .tryGetMap('notifications') - ?.tryGet('rooms') ?? - 0 - : 0; - return PermissionsListTile( - permissionKey: key, - permission: value, - category: 'notifications', - canEdit: room.canChangePowerLevel, - onChanged: (level) => controller.editPowerLevel( - context, - key, - value, - newLevel: level, - category: 'notifications', + // #Pangea + // Why would teacher need to stop students from seeing notifications? + // Divider(color: Theme.of(context).dividerColor), + // ListTile( + // title: Text( + // L10n.of(context)!.notifications, + // style: TextStyle( + // color: Theme.of(context).colorScheme.primary, + // fontWeight: FontWeight.bold, + // ), + // ), + // ), + // Builder( + // builder: (context) { + // const key = 'rooms'; + // final value = powerLevelsContent + // .containsKey('notifications') + // ? powerLevelsContent + // .tryGetMap('notifications') + // ?.tryGet('rooms') ?? + // 0 + // : 0; + // return PermissionsListTile( + // permissionKey: key, + // permission: value, + // category: 'notifications', + // canEdit: room.canChangePowerLevel, + // onChanged: (level) => controller.editPowerLevel( + // context, + // key, + // value, + // newLevel: level, + // category: 'notifications', + // ), + // ); + // }, + // ), + // Only show if there are actually items in this category + if (eventsPowerLevels.isNotEmpty) + // Pangea# + Divider(color: Theme.of(context).dividerColor), + // #Pangea + if (eventsPowerLevels.isNotEmpty) + // Pangea# + ListTile( + title: Text( + L10n.of(context)!.configureChat, + style: TextStyle( + color: Theme.of(context).colorScheme.primary, + fontWeight: FontWeight.bold, ), - ); - }, - ), - Divider(color: Theme.of(context).dividerColor), - ListTile( - title: Text( - L10n.of(context)!.configureChat, - style: TextStyle( - color: Theme.of(context).colorScheme.primary, - fontWeight: FontWeight.bold, ), ), - ), for (final entry in eventsPowerLevels.entries) PermissionsListTile( permissionKey: entry.key, diff --git a/lib/pangea/widgets/subscription/subscription_options.dart b/lib/pangea/widgets/subscription/subscription_options.dart index 41c8cbe4f4..d40f680235 100644 --- a/lib/pangea/widgets/subscription/subscription_options.dart +++ b/lib/pangea/widgets/subscription/subscription_options.dart @@ -109,7 +109,7 @@ class SubscriptionCard extends StatelessWidget { title ?? subscription?.displayName(context) ?? '', textAlign: TextAlign.center, style: TextStyle( - fontSize: 24, + fontSize: 20, color: enabled ? null : const Color.fromARGB(255, 174, 174, 174), ),