mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 04:49:21 +00:00
Can set location & email visibility
This commit is contained in:
parent
f995003306
commit
4f72b59265
@ -79,6 +79,7 @@ class ServerConfigurationHelper {
|
|||||||
maxFirstNameLength: accountInformationPolicy["max_first_name_length"],
|
maxFirstNameLength: accountInformationPolicy["max_first_name_length"],
|
||||||
minLastNameLength: accountInformationPolicy["min_last_name_length"],
|
minLastNameLength: accountInformationPolicy["min_last_name_length"],
|
||||||
maxLastNameLength: accountInformationPolicy["max_last_name_length"],
|
maxLastNameLength: accountInformationPolicy["max_last_name_length"],
|
||||||
|
maxLocationLength: accountInformationPolicy["max_location_length"],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -40,33 +40,37 @@ class SettingsHelper {
|
|||||||
allowPostsFromFriends: response["allow_posts_from_friends"],
|
allowPostsFromFriends: response["allow_posts_from_friends"],
|
||||||
allowComunicEmails: response["allow_comunic_mails"],
|
allowComunicEmails: response["allow_comunic_mails"],
|
||||||
publicFriendsList: response["public_friends_list"],
|
publicFriendsList: response["public_friends_list"],
|
||||||
|
publicEmail: response["public_email"],
|
||||||
virtualDirectory: response["virtual_directory"],
|
virtualDirectory: response["virtual_directory"],
|
||||||
personalWebsite: response["personnal_website"],
|
personalWebsite: response["personnal_website"],
|
||||||
publicNote: response["publicNote"],
|
publicNote: response["publicNote"],
|
||||||
|
location: response["location"],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Apply new general settings
|
/// Apply new general settings
|
||||||
static Future<void> updateGeneralSettings(GeneralSettings settings) async {
|
static Future<void> updateGeneralSettings(GeneralSettings settings) async =>
|
||||||
(await APIRequest(uri: "settings/set_general", needLogin: true, args: {
|
await APIRequest.withLogin("settings/set_general", args: {
|
||||||
"firstName": settings.firstName,
|
"firstName": settings.firstName,
|
||||||
"lastName": settings.lastName,
|
"lastName": settings.lastName,
|
||||||
"allow_comunic_mails": settings.allowComunicEmails ? "true" : "false",
|
"allow_comunic_mails": settings.allowComunicEmails ? "true" : "false",
|
||||||
"isPublic": settings.pageVisibility != UserPageVisibility.PRIVATE
|
"isPublic": settings.pageVisibility != UserPageVisibility.PRIVATE
|
||||||
? "true"
|
? "true"
|
||||||
: "false",
|
: "false",
|
||||||
"isOpen":
|
"isOpen": settings.pageVisibility == UserPageVisibility.OPEN
|
||||||
settings.pageVisibility == UserPageVisibility.OPEN ? "true" : "false",
|
? "true"
|
||||||
"allowComments": settings.allowComments ? "true" : "false",
|
: "false",
|
||||||
"allowPostsFromFriends":
|
"allowComments": settings.allowComments ? "true" : "false",
|
||||||
settings.allowPostsFromFriends ? "true" : "false",
|
"allowPostsFromFriends":
|
||||||
"publicFriendsList": settings.publicFriendsList ? "true" : "false",
|
settings.allowPostsFromFriends ? "true" : "false",
|
||||||
"personnalWebsite": settings.personalWebsite,
|
"publicFriendsList": settings.publicFriendsList ? "true" : "false",
|
||||||
"virtualDirectory": settings.virtualDirectory,
|
"personnalWebsite": settings.personalWebsite,
|
||||||
"publicNote": settings.publicNote,
|
"virtualDirectory": settings.virtualDirectory,
|
||||||
}).exec())
|
"publicNote": settings.publicNote,
|
||||||
.assertOk();
|
})
|
||||||
}
|
.addBool("email_public", settings.publicEmail)
|
||||||
|
.addString("location", settings.location ?? "")
|
||||||
|
.execWithThrow();
|
||||||
|
|
||||||
/// Check out whether a virtual directory is available for a user or not
|
/// Check out whether a virtual directory is available for a user or not
|
||||||
///
|
///
|
||||||
|
@ -14,9 +14,11 @@ class GeneralSettings {
|
|||||||
bool allowPostsFromFriends;
|
bool allowPostsFromFriends;
|
||||||
bool allowComunicEmails;
|
bool allowComunicEmails;
|
||||||
bool publicFriendsList;
|
bool publicFriendsList;
|
||||||
|
bool publicEmail;
|
||||||
String virtualDirectory;
|
String virtualDirectory;
|
||||||
String personalWebsite;
|
String personalWebsite;
|
||||||
String publicNote;
|
String publicNote;
|
||||||
|
String location;
|
||||||
|
|
||||||
GeneralSettings({
|
GeneralSettings({
|
||||||
@required this.email,
|
@required this.email,
|
||||||
@ -27,9 +29,11 @@ class GeneralSettings {
|
|||||||
@required this.allowPostsFromFriends,
|
@required this.allowPostsFromFriends,
|
||||||
@required this.allowComunicEmails,
|
@required this.allowComunicEmails,
|
||||||
@required this.publicFriendsList,
|
@required this.publicFriendsList,
|
||||||
|
@required this.publicEmail,
|
||||||
@required this.virtualDirectory,
|
@required this.virtualDirectory,
|
||||||
@required this.personalWebsite,
|
@required this.personalWebsite,
|
||||||
@required this.publicNote,
|
@required this.publicNote,
|
||||||
|
@required this.location,
|
||||||
}) : assert(email != null),
|
}) : assert(email != null),
|
||||||
assert(firstName != null),
|
assert(firstName != null),
|
||||||
assert(lastName != null),
|
assert(lastName != null),
|
||||||
@ -38,6 +42,7 @@ class GeneralSettings {
|
|||||||
assert(allowPostsFromFriends != null),
|
assert(allowPostsFromFriends != null),
|
||||||
assert(allowComunicEmails != null),
|
assert(allowComunicEmails != null),
|
||||||
assert(publicFriendsList != null),
|
assert(publicFriendsList != null),
|
||||||
|
assert(publicEmail != null),
|
||||||
assert(virtualDirectory != null),
|
assert(virtualDirectory != null),
|
||||||
assert(personalWebsite != null),
|
assert(personalWebsite != null),
|
||||||
assert(publicNote != null);
|
assert(publicNote != null);
|
||||||
|
@ -117,16 +117,19 @@ class AccountInformationPolicy {
|
|||||||
final int maxFirstNameLength;
|
final int maxFirstNameLength;
|
||||||
final int minLastNameLength;
|
final int minLastNameLength;
|
||||||
final int maxLastNameLength;
|
final int maxLastNameLength;
|
||||||
|
final int maxLocationLength;
|
||||||
|
|
||||||
const AccountInformationPolicy({
|
const AccountInformationPolicy({
|
||||||
@required this.minFirstNameLength,
|
@required this.minFirstNameLength,
|
||||||
@required this.maxFirstNameLength,
|
@required this.maxFirstNameLength,
|
||||||
@required this.minLastNameLength,
|
@required this.minLastNameLength,
|
||||||
@required this.maxLastNameLength,
|
@required this.maxLastNameLength,
|
||||||
|
@required this.maxLocationLength,
|
||||||
}) : assert(minFirstNameLength != null),
|
}) : assert(minFirstNameLength != null),
|
||||||
assert(maxFirstNameLength != null),
|
assert(maxFirstNameLength != null),
|
||||||
assert(minLastNameLength != null),
|
assert(minLastNameLength != null),
|
||||||
assert(maxLastNameLength != null);
|
assert(maxLastNameLength != null),
|
||||||
|
assert(maxLocationLength != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ServerConfig {
|
class ServerConfig {
|
||||||
|
@ -164,6 +164,7 @@ class _GeneralAccountSettingsScreenState
|
|||||||
_updateSettings();
|
_updateSettings();
|
||||||
},
|
},
|
||||||
switchValue: _settings.allowPostsFromFriends,
|
switchValue: _settings.allowPostsFromFriends,
|
||||||
|
titleMaxLines: 2,
|
||||||
),
|
),
|
||||||
|
|
||||||
// Make friends list public
|
// Make friends list public
|
||||||
@ -176,6 +177,16 @@ class _GeneralAccountSettingsScreenState
|
|||||||
switchValue: _settings.publicFriendsList,
|
switchValue: _settings.publicFriendsList,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Make email address public
|
||||||
|
SettingsTile.switchTile(
|
||||||
|
title: tr("Make your email address public"),
|
||||||
|
onToggle: (v) {
|
||||||
|
_settings.publicEmail = v;
|
||||||
|
_updateSettings();
|
||||||
|
},
|
||||||
|
switchValue: _settings.publicEmail,
|
||||||
|
),
|
||||||
|
|
||||||
// Personal website
|
// Personal website
|
||||||
TextEditSettingsTile(
|
TextEditSettingsTile(
|
||||||
title: tr("Personal website URL (optional)"),
|
title: tr("Personal website URL (optional)"),
|
||||||
@ -188,6 +199,18 @@ class _GeneralAccountSettingsScreenState
|
|||||||
allowEmptyValues: true,
|
allowEmptyValues: true,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Location
|
||||||
|
TextEditSettingsTile(
|
||||||
|
title: tr("Location (optional)"),
|
||||||
|
currValue: _settings.location ?? "",
|
||||||
|
onChanged: (v) {
|
||||||
|
_settings.location = v;
|
||||||
|
_updateSettings();
|
||||||
|
},
|
||||||
|
maxLength: srvConfig.accountInformationPolicy.maxLocationLength,
|
||||||
|
allowEmptyValues: true,
|
||||||
|
),
|
||||||
|
|
||||||
// Public notes
|
// Public notes
|
||||||
TextEditSettingsTile(
|
TextEditSettingsTile(
|
||||||
title: tr("Public note (optional)"),
|
title: tr("Public note (optional)"),
|
||||||
|
Loading…
Reference in New Issue
Block a user