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

Merge branch 'develop' into element_4211

# Conflicts:
#	CHANGES.rst
parents 0e678dac 6123b3ee
......@@ -11,6 +11,7 @@ Changes to be released in next version
* 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
* PublicRoomsDirectoryDataSource: Fix search when NSFW filter is off.
......
......@@ -264,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
......
......@@ -59,6 +59,11 @@ final class RiotSettings: NSObject {
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"
}
......@@ -291,6 +296,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
......
......@@ -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