From 6d1fc388d02290da7ed74e82161b3a73611960f2 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 17 Mar 2021 18:50:37 +0100 Subject: [PATCH] Can change group members visibility settings --- lib/generated_plugin_registrant.dart | 4 ++-- lib/helpers/groups_helper.dart | 2 ++ lib/models/advanced_group_info.dart | 2 ++ lib/ui/screens/group_sections/about_group_section.dart | 8 ++++++++ lib/ui/screens/group_settings_screen.dart | 10 ++++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/generated_plugin_registrant.dart b/lib/generated_plugin_registrant.dart index ef6f366..910f932 100644 --- a/lib/generated_plugin_registrant.dart +++ b/lib/generated_plugin_registrant.dart @@ -4,14 +4,14 @@ // ignore_for_file: lines_longer_than_80_chars +// ignore: implementation_imports import 'package:file_picker/src/file_picker_web.dart'; +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; import 'package:shared_preferences_web/shared_preferences_web.dart'; import 'package:url_launcher_web/url_launcher_web.dart'; import 'package:video_player_web/video_player_web.dart'; import 'package:wakelock_web/wakelock_web.dart'; -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; - // ignore: public_member_api_docs void registerPlugins(Registrar registrar) { FilePickerWeb.registerWith(registrar); diff --git a/lib/helpers/groups_helper.dart b/lib/helpers/groups_helper.dart index 8524511..0bbd954 100644 --- a/lib/helpers/groups_helper.dart +++ b/lib/helpers/groups_helper.dart @@ -236,6 +236,7 @@ class GroupsHelper { "posts_level", invertMap( _APIGroupsPostsCreationLevelsMap)[settings.postCreationLevel]) + .addBool("is_members_list_public", settings.isMembersListPublic) .addString("description", settings.description) .addString("url", settings.url) .execWithThrow(); @@ -356,6 +357,7 @@ class GroupsHelper { registrationLevel: _APIGroupsRegistrationLevelsMap[map["registration_level"]], postCreationLevel: _APIGroupsPostsCreationLevelsMap[map["posts_level"]], + isMembersListPublic: map["is_members_list_public"], virtualDirectory: nullToEmpty(map["virtual_directory"]), following: map["following"], timeCreate: map["time_create"], diff --git a/lib/models/advanced_group_info.dart b/lib/models/advanced_group_info.dart index d1adb7b..1da015c 100644 --- a/lib/models/advanced_group_info.dart +++ b/lib/models/advanced_group_info.dart @@ -9,6 +9,7 @@ import 'group.dart'; /// @author Pierre Hubert class AdvancedGroupInfo extends Group implements LikeElement { + bool isMembersListPublic; final int timeCreate; String description; String url; @@ -26,6 +27,7 @@ class AdvancedGroupInfo extends Group implements LikeElement { @required GroupPostCreationLevel postCreationLevel, @required String virtualDirectory, @required bool following, + @required this.isMembersListPublic, @required this.timeCreate, @required this.description, @required this.url, diff --git a/lib/ui/screens/group_sections/about_group_section.dart b/lib/ui/screens/group_sections/about_group_section.dart index 9b7002b..d3c4c8a 100644 --- a/lib/ui/screens/group_sections/about_group_section.dart +++ b/lib/ui/screens/group_sections/about_group_section.dart @@ -88,6 +88,14 @@ class AboutGroupSection extends StatelessWidget { ? tr("Private group") : tr("Open group"))), ), + + // Group members visibility + ListTile( + leading: Icon(Icons.remove_red_eye), + title: Text(tr("Members list visibility")), + subtitle: + Text(group.isMembersListPublic ? tr("Public") : tr("Private")), + ), ], ); } diff --git a/lib/ui/screens/group_settings_screen.dart b/lib/ui/screens/group_settings_screen.dart index 8d7438d..fa3156f 100644 --- a/lib/ui/screens/group_settings_screen.dart +++ b/lib/ui/screens/group_settings_screen.dart @@ -243,6 +243,16 @@ class _GroupSettingsScreenState extends SafeState { _groupSettings.postCreationLevel = s; _updateSettings(); }), + + // Groups members list visibility + SettingsTile.switchTile( + title: tr("Make members list public"), + onToggle: (s) { + _groupSettings.isMembersListPublic = s; + _updateSettings(); + }, + switchValue: _groupSettings.isMembersListPublic, + ) ], );