1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Can change group members visibility settings

This commit is contained in:
Pierre HUBERT 2021-03-17 18:50:37 +01:00
parent bd548fe532
commit 6d1fc388d0
5 changed files with 24 additions and 2 deletions

View File

@ -4,14 +4,14 @@
// ignore_for_file: lines_longer_than_80_chars // ignore_for_file: lines_longer_than_80_chars
// ignore: implementation_imports
import 'package:file_picker/src/file_picker_web.dart'; 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:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart'; import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_web.dart'; import 'package:video_player_web/video_player_web.dart';
import 'package:wakelock_web/wakelock_web.dart'; import 'package:wakelock_web/wakelock_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs // ignore: public_member_api_docs
void registerPlugins(Registrar registrar) { void registerPlugins(Registrar registrar) {
FilePickerWeb.registerWith(registrar); FilePickerWeb.registerWith(registrar);

View File

@ -236,6 +236,7 @@ class GroupsHelper {
"posts_level", "posts_level",
invertMap( invertMap(
_APIGroupsPostsCreationLevelsMap)[settings.postCreationLevel]) _APIGroupsPostsCreationLevelsMap)[settings.postCreationLevel])
.addBool("is_members_list_public", settings.isMembersListPublic)
.addString("description", settings.description) .addString("description", settings.description)
.addString("url", settings.url) .addString("url", settings.url)
.execWithThrow(); .execWithThrow();
@ -356,6 +357,7 @@ class GroupsHelper {
registrationLevel: registrationLevel:
_APIGroupsRegistrationLevelsMap[map["registration_level"]], _APIGroupsRegistrationLevelsMap[map["registration_level"]],
postCreationLevel: _APIGroupsPostsCreationLevelsMap[map["posts_level"]], postCreationLevel: _APIGroupsPostsCreationLevelsMap[map["posts_level"]],
isMembersListPublic: map["is_members_list_public"],
virtualDirectory: nullToEmpty(map["virtual_directory"]), virtualDirectory: nullToEmpty(map["virtual_directory"]),
following: map["following"], following: map["following"],
timeCreate: map["time_create"], timeCreate: map["time_create"],

View File

@ -9,6 +9,7 @@ import 'group.dart';
/// @author Pierre Hubert /// @author Pierre Hubert
class AdvancedGroupInfo extends Group implements LikeElement { class AdvancedGroupInfo extends Group implements LikeElement {
bool isMembersListPublic;
final int timeCreate; final int timeCreate;
String description; String description;
String url; String url;
@ -26,6 +27,7 @@ class AdvancedGroupInfo extends Group implements LikeElement {
@required GroupPostCreationLevel postCreationLevel, @required GroupPostCreationLevel postCreationLevel,
@required String virtualDirectory, @required String virtualDirectory,
@required bool following, @required bool following,
@required this.isMembersListPublic,
@required this.timeCreate, @required this.timeCreate,
@required this.description, @required this.description,
@required this.url, @required this.url,

View File

@ -88,6 +88,14 @@ class AboutGroupSection extends StatelessWidget {
? tr("Private group") ? tr("Private group")
: tr("Open 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")),
),
], ],
); );
} }

View File

@ -243,6 +243,16 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
_groupSettings.postCreationLevel = s; _groupSettings.postCreationLevel = s;
_updateSettings(); _updateSettings();
}), }),
// Groups members list visibility
SettingsTile.switchTile(
title: tr("Make members list public"),
onToggle: (s) {
_groupSettings.isMembersListPublic = s;
_updateSettings();
},
switchValue: _groupSettings.isMembersListPublic,
)
], ],
); );