Merge pull request #4179 from vector-im/element_4173

Enable / disable external friends invite
This commit is contained in:
Gil Eluard
2021-04-06 15:54:12 +02:00
committed by GitHub
5 changed files with 25 additions and 1 deletions
+1
View File
@@ -6,6 +6,7 @@ Changes to be released in next version
🙌 Improvements
* Make the application settings more configurable (#4171)
* Enable / disable external friends invite (#4173)
🐛 Bugfix
*
+2
View File
@@ -195,6 +195,8 @@ final class BuildSettings: NSObject {
static let allowLocalContactsAccess: Bool = true
static let allowInviteExernalUsers: Bool = true
// MARK: - Feature Specifics
/// Not allowed pin codes. User won't be able to select one of the pin in the list.
+15
View File
@@ -47,6 +47,7 @@ final class RiotSettings: NSObject {
static let settingsSecurityScreenShowCryptographyInfo = "settingsSecurityScreenShowCryptographyInfo"
static let settingsSecurityScreenShowCryptographyExport = "settingsSecurityScreenShowCryptographyExport"
static let settingsSecurityScreenShowAdvancedUnverifiedDevices = "settingsSecurityScreenShowAdvancedBlacklistUnverifiedDevices"
static let allowInviteExernalUsers = "allowInviteExernalUsers"
}
static let shared = RiotSettings()
@@ -72,6 +73,7 @@ final class RiotSettings: NSObject {
defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowCryptographyInfo)
defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowCryptographyExport)
defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowAdvancedUnverifiedDevices)
defaults.removeObject(forKey: UserDefaultsKeys.allowInviteExernalUsers)
}
// MARK: Servers
@@ -236,6 +238,19 @@ final class RiotSettings: NSObject {
}
}
// MARK: Features
var allowInviteExernalUsers: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.allowInviteExernalUsers) != nil else {
return BuildSettings.allowInviteExernalUsers
}
return defaults.bool(forKey: UserDefaultsKeys.allowInviteExernalUsers)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.allowInviteExernalUsers)
}
}
// MARK: General Settings
var settingsScreenShowChangePassword: Bool {
@@ -499,7 +499,7 @@
if (section == searchInputSection)
{
count = 1;
count = RiotSettings.shared.allowInviteExernalUsers ? 1 : 0;
}
else if (section == filteredLocalContactsSection && !(shrinkedSectionsBitMask & CONTACTSDATASOURCE_LOCALCONTACTS_BITWISE))
{
@@ -133,6 +133,12 @@
- (void)setupInviteFriendsHeaderView
{
if (!RiotSettings.shared.allowInviteExernalUsers)
{
self.contactsTableView.tableHeaderView = nil;
return;
}
InviteFriendsHeaderView *inviteFriendsHeaderView = [InviteFriendsHeaderView instantiate];
inviteFriendsHeaderView.delegate = self;
self.contactsTableView.tableHeaderView = inviteFriendsHeaderView;