Merge pull request #4243 from vector-im/element_4242

Show/Hide public directory in Unified Search
This commit is contained in:
Gil Eluard
2021-04-20 12:40:29 +02:00
committed by GitHub
4 changed files with 24 additions and 1 deletions
+1
View File
@@ -7,6 +7,7 @@ Changes to be released in next version
🙌 Improvements
* MasterTabBarController: Show/Hide Home Screen tabs (#4234).
* RoomVC: Enable / Disable VoIP feature in Rooms (#4236).
* UnifiedSearchRecentsDataSource: Show/Hide public directory (#4242).
🐛 Bugfix
*
+3
View File
@@ -291,4 +291,7 @@ final class BuildSettings: NSObject {
static let authScreenShowPhoneNumber = true
static let authScreenShowForgotPassword = true
static let authScreenShowCustomServerOptions = true
// Mark: - Unified Search
static let unifiedSearchScreenShowPublicDirectory = true
}
+15
View File
@@ -58,6 +58,7 @@ final class RiotSettings: NSObject {
static let homeScreenShowCommunitiesTab = "homeScreenShowCommunitiesTab"
static let roomScreenAllowVoIPForDirectRoom = "roomScreenAllowVoIPForDirectRoom"
static let roomScreenAllowVoIPForNonDirectRoom = "roomScreenAllowVoIPForNonDirectRoom"
static let unifiedSearchScreenShowPublicDirectory = "unifiedSearchScreenShowPublicDirectory"
}
static let shared = RiotSettings()
@@ -472,4 +473,18 @@ final class RiotSettings: NSObject {
defaults.set(newValue, forKey: UserDefaultsKeys.settingsSecurityScreenShowAdvancedUnverifiedDevices)
}
}
// Mark: - Unified Search
var unifiedSearchScreenShowPublicDirectory: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.unifiedSearchScreenShowPublicDirectory) != nil else {
return BuildSettings.unifiedSearchScreenShowPublicDirectory
}
return defaults.bool(forKey: UserDefaultsKeys.unifiedSearchScreenShowPublicDirectory)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.unifiedSearchScreenShowPublicDirectory)
}
}
}
@@ -22,6 +22,7 @@
#import "DirectoryRecentTableViewCell.h"
#import "MXRoom+Riot.h"
#import "Riot-Swift.h"
@interface UnifiedSearchRecentsDataSource()
{
@@ -85,7 +86,10 @@
}
// The public rooms directory cell is then visible whatever the search activity.
self.directorySection = sectionsOffset++;
if (RiotSettings.shared.unifiedSearchScreenShowPublicDirectory)
{
self.directorySection = sectionsOffset++;
}
if (_hideRecents)
{