Unverified Commit 8fab4438 authored by Gil Eluard's avatar Gil Eluard Committed by GitHub
Browse files

Merge pull request #4212 from vector-im/element_4211

Make joining public rooms configurable
parents 6123b3ee ae3b6950
......@@ -10,6 +10,7 @@ Changes to be released in next version
* RoomVC: Enable / Disable VoIP feature in Rooms (#4236).
* UnifiedSearchRecentsDataSource: Show/Hide public directory (#4242).
* DirectoryRecentTableViewCell: Do not use "directory_search_results_more_than" string when there is no rooms and the search is on.
* RecentsVC: Make joining public rooms configurable (#4211).
* RoomVC: Show / Hide integrations and actions (#4245).
🐛 Bugfix
......
......@@ -154,6 +154,8 @@ final class BuildSettings: NSObject {
"gitter.im"
]
// MARK: - Rooms Screen
static let roomsAllowToJoinPublicRooms: Bool = true
// MARK: - Analytics
static let analyticsServerUrl = URL(string: "https://piwik.riot.im/piwik.php")
......
......@@ -52,6 +52,7 @@ final class RiotSettings: NSObject {
static let roomCreationScreenAllowRoomTypeConfiguration = "roomCreationScreenAllowRoomTypeConfiguration"
static let roomCreationScreenRoomIsPublic = "roomCreationScreenRoomIsPublic"
static let allowInviteExernalUsers = "allowInviteExernalUsers"
static let roomsAllowToJoinPublicRooms = "roomsAllowToJoinPublicRooms"
static let homeScreenShowFavouritesTab = "homeScreenShowFavouritesTab"
static let homeScreenShowPeopleTab = "homeScreenShowPeopleTab"
static let homeScreenShowRoomsTab = "homeScreenShowRoomsTab"
......@@ -89,7 +90,13 @@ final class RiotSettings: NSObject {
defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowCryptographyInfo)
defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowCryptographyExport)
defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowAdvancedUnverifiedDevices)
defaults.removeObject(forKey: UserDefaultsKeys.roomCreationScreenAllowEncryptionConfiguration)
defaults.removeObject(forKey: UserDefaultsKeys.roomCreationScreenRoomIsEncrypted)
defaults.removeObject(forKey: UserDefaultsKeys.roomCreationScreenAllowRoomTypeConfiguration)
defaults.removeObject(forKey: UserDefaultsKeys.roomCreationScreenRoomIsPublic)
defaults.removeObject(forKey: UserDefaultsKeys.allowInviteExernalUsers)
defaults.removeObject(forKey: UserDefaultsKeys.allowInviteExernalUsers)
defaults.removeObject(forKey: UserDefaultsKeys.roomsAllowToJoinPublicRooms)
}
// MARK: Servers
......@@ -254,6 +261,19 @@ final class RiotSettings: NSObject {
}
}
// MARK: - Rooms Screen
var roomsAllowToJoinPublicRooms: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.roomsAllowToJoinPublicRooms) != nil else {
return BuildSettings.roomsAllowToJoinPublicRooms
}
return defaults.bool(forKey: UserDefaultsKeys.roomsAllowToJoinPublicRooms)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.roomsAllowToJoinPublicRooms)
}
}
// MARK: - Room Screen
var roomScreenAllowVoIPForDirectRoom: Bool {
......
......@@ -1808,9 +1808,16 @@
return;
}
self.roomsDirectoryCoordinatorBridgePresenter = [[RoomsDirectoryCoordinatorBridgePresenter alloc] initWithSession:self.mainSession dataSource:[self.recentsDataSource.publicRoomsDirectoryDataSource copy]];
self.roomsDirectoryCoordinatorBridgePresenter.delegate = self;
[self.roomsDirectoryCoordinatorBridgePresenter presentFrom:self animated:YES];
if (RiotSettings.shared.roomsAllowToJoinPublicRooms)
{
self.roomsDirectoryCoordinatorBridgePresenter = [[RoomsDirectoryCoordinatorBridgePresenter alloc] initWithSession:self.mainSession dataSource:[self.recentsDataSource.publicRoomsDirectoryDataSource copy]];
self.roomsDirectoryCoordinatorBridgePresenter.delegate = self;
[self.roomsDirectoryCoordinatorBridgePresenter presentFrom:self animated:YES];
}
else
{
[self createNewRoom];
}
}
- (void)openPublicRoom:(MXPublicRoom *)publicRoom
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment