Commit b1e932a3 authored by Gil Eluard's avatar Gil Eluard
Browse files

Merge branch 'develop' into element_4218

# Conflicts:
#	CHANGES.rst
#	Riot/Managers/Settings/RiotSettings.swift
parents 30e7373d 8fab4438
......@@ -10,7 +10,9 @@ 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).
* Make room settings screen configurable dynamically (#4219).
* RoomVC: Show / Hide integrations and actions (#4245).
🐛 Bugfix
* PublicRoomsDirectoryDataSource: Fix search when NSFW filter is off.
......
......@@ -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")
......@@ -262,6 +264,14 @@ final class BuildSettings: NSObject {
static let roomScreenAllowVoIPForDirectRoom: Bool = true
static let roomScreenAllowVoIPForNonDirectRoom: Bool = true
static let roomScreenAllowCameraAction: Bool = true
static let roomScreenAllowMediaLibraryAction: Bool = true
static let roomScreenAllowStickerAction: Bool = true
static let roomScreenAllowFilesAction: Bool = true
// MARK: - Room Info Screen
static let roomInfoScreenShowIntegrations: Bool = true
// MARK: - Room Settings Screen
......
......@@ -60,12 +60,18 @@ final class RiotSettings: NSObject {
static let roomSettingsScreenShowFlairSettings = "roomSettingsScreenShowFlairSettings"
static let roomSettingsScreenShowAdvancedSettings = "roomSettingsScreenShowAdvancedSettings"
static let roomSettingsScreenAdvancedShowEncryptToVerifiedOption = "roomSettingsScreenAdvancedShowEncryptToVerifiedOption"
static let roomsAllowToJoinPublicRooms = "roomsAllowToJoinPublicRooms"
static let homeScreenShowFavouritesTab = "homeScreenShowFavouritesTab"
static let homeScreenShowPeopleTab = "homeScreenShowPeopleTab"
static let homeScreenShowRoomsTab = "homeScreenShowRoomsTab"
static let homeScreenShowCommunitiesTab = "homeScreenShowCommunitiesTab"
static let roomScreenAllowVoIPForDirectRoom = "roomScreenAllowVoIPForDirectRoom"
static let roomScreenAllowVoIPForNonDirectRoom = "roomScreenAllowVoIPForNonDirectRoom"
static let roomScreenAllowCameraAction = "roomScreenAllowCameraAction"
static let roomScreenAllowMediaLibraryAction = "roomScreenAllowMediaLibraryAction"
static let roomScreenAllowStickerAction = "roomScreenAllowStickerAction"
static let roomScreenAllowFilesAction = "roomScreenAllowFilesAction"
static let roomInfoScreenShowIntegrations = "roomInfoScreenShowIntegrations"
static let unifiedSearchScreenShowPublicDirectory = "unifiedSearchScreenShowPublicDirectory"
}
......@@ -92,6 +98,10 @@ 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.roomSettingsScreenShowLowPriorityOption)
defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenShowDirectChatOption)
......@@ -101,6 +111,8 @@ final class RiotSettings: NSObject {
defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenShowFlairSettings)
defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenShowAdvancedSettings)
defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenAdvancedShowEncryptToVerifiedOption)
defaults.removeObject(forKey: UserDefaultsKeys.allowInviteExernalUsers)
defaults.removeObject(forKey: UserDefaultsKeys.roomsAllowToJoinPublicRooms)
}
// MARK: Servers
......@@ -265,6 +277,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 {
......@@ -287,6 +312,59 @@ final class RiotSettings: NSObject {
defaults.set(newValue, forKey: UserDefaultsKeys.roomScreenAllowVoIPForNonDirectRoom)
}
}
var roomScreenAllowCameraAction: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.roomScreenAllowCameraAction) != nil else {
return BuildSettings.roomScreenAllowCameraAction
}
return defaults.bool(forKey: UserDefaultsKeys.roomScreenAllowCameraAction)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.roomScreenAllowCameraAction)
}
}
var roomScreenAllowMediaLibraryAction: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.roomScreenAllowMediaLibraryAction) != nil else {
return BuildSettings.roomScreenAllowMediaLibraryAction
}
return defaults.bool(forKey: UserDefaultsKeys.roomScreenAllowMediaLibraryAction)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.roomScreenAllowMediaLibraryAction)
}
}
var roomScreenAllowStickerAction: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.roomScreenAllowStickerAction) != nil else {
return BuildSettings.roomScreenAllowStickerAction
}
return defaults.bool(forKey: UserDefaultsKeys.roomScreenAllowStickerAction)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.roomScreenAllowStickerAction)
}
}
var roomScreenAllowFilesAction: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.roomScreenAllowFilesAction) != nil else {
return BuildSettings.roomScreenAllowFilesAction
}
return defaults.bool(forKey: UserDefaultsKeys.roomScreenAllowFilesAction)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.roomScreenAllowFilesAction)
}
}
// MARK: - Room Info Screen
var roomInfoScreenShowIntegrations: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.roomInfoScreenShowIntegrations) != nil else {
return BuildSettings.roomInfoScreenShowIntegrations
}
return defaults.bool(forKey: UserDefaultsKeys.roomInfoScreenShowIntegrations)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.roomInfoScreenShowIntegrations)
}
}
// MARK: - Room Creation Screen
......
......@@ -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
......
......@@ -164,12 +164,17 @@ final class RoomInfoListViewController: UIViewController {
self.viewModel.process(viewAction: .navigate(target: .integrations))
}
var rows = [rowSettings]
if (RiotSettings.shared.roomInfoScreenShowIntegrations)
{
rows.append(rowIntegrations)
}
rows.append(rowMembers)
rows.append(rowUploads)
rows.append(rowSearch)
let sectionSettings = Section(header: VectorL10n.roomInfoListSectionOther,
rows: [rowSettings,
rowIntegrations,
rowMembers,
rowUploads,
rowSearch],
rows: rows,
footer: nil)
let leaveTitle = viewData.basicInfoViewData.isDirect ?
......
......@@ -1731,36 +1731,48 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
RoomInputToolbarView *roomInputView = ((RoomInputToolbarView *) self.inputToolbarView);
MXWeakify(self);
roomInputView.actionsBar.actionItems = @[
[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_camera"] andAction:^{
NSMutableArray *actionItems = [NSMutableArray new];
if (RiotSettings.shared.roomScreenAllowCameraAction)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_camera"] andAction:^{
MXStrongifyAndReturnIfNil(self);
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) {
((RoomInputToolbarView *) self.inputToolbarView).actionMenuOpened = NO;
}
[self showCameraControllerAnimated:YES];
}],
[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_media_library"] andAction:^{
}]];
}
if (RiotSettings.shared.roomScreenAllowMediaLibraryAction)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_media_library"] andAction:^{
MXStrongifyAndReturnIfNil(self);
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) {
((RoomInputToolbarView *) self.inputToolbarView).actionMenuOpened = NO;
}
[self showMediaPickerAnimated:YES];
}],
[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_sticker"] andAction:^{
}]];
}
if (RiotSettings.shared.roomScreenAllowStickerAction)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_sticker"] andAction:^{
MXStrongifyAndReturnIfNil(self);
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) {
((RoomInputToolbarView *) self.inputToolbarView).actionMenuOpened = NO;
}
[self roomInputToolbarViewPresentStickerPicker];
}],
[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_file"] andAction:^{
}]];
}
if (RiotSettings.shared.roomScreenAllowFilesAction)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_file"] andAction:^{
MXStrongifyAndReturnIfNil(self);
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) {
((RoomInputToolbarView *) self.inputToolbarView).actionMenuOpened = NO;
}
[self roomInputToolbarViewDidTapFileUpload];
}],
];
}]];
}
roomInputView.actionsBar.actionItems = actionItems;
}
- (void)roomInputToolbarViewPresentStickerPicker
......
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