mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-06 07:57:42 +02:00
MESSENGER-4806 new room filter behaviour
This commit is contained in:
@@ -663,6 +663,9 @@ class BWIBuildSettings: NSObject {
|
||||
|
||||
// MARK: itunes
|
||||
var showAllChatsFilterMenu = false
|
||||
|
||||
// MARK: itunes
|
||||
var roomFiltersToggle = true
|
||||
|
||||
// MARK: OIDC
|
||||
var isOIDCEnabled = true
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Filter-dark.svg",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11 19C10.7167 19 10.4792 18.9042 10.2875 18.7125C10.0958 18.5208 10 18.2833 10 18C10 17.7167 10.0958 17.4792 10.2875 17.2875C10.4792 17.0958 10.7167 17 11 17H13C13.2833 17 13.5208 17.0958 13.7125 17.2875C13.9042 17.4792 14 17.7167 14 18C14 18.2833 13.9042 18.5208 13.7125 18.7125C13.5208 18.9042 13.2833 19 13 19H11ZM4 9C3.71667 9 3.47917 8.90417 3.2875 8.7125C3.09583 8.52083 3 8.28333 3 8C3 7.71667 3.09583 7.47917 3.2875 7.2875C3.47917 7.09583 3.71667 7 4 7H20C20.2833 7 20.5208 7.09583 20.7125 7.2875C20.9042 7.47917 21 7.71667 21 8C21 8.28333 20.9042 8.52083 20.7125 8.7125C20.5208 8.90417 20.2833 9 20 9H4ZM7 14C6.71667 14 6.47917 13.9042 6.2875 13.7125C6.09583 13.5208 6 13.2833 6 13C6 12.7167 6.09583 12.4792 6.2875 12.2875C6.47917 12.0958 6.71667 12 7 12H17C17.2833 12 17.5208 12.0958 17.7125 12.2875C17.9042 12.4792 18 12.7167 18 13C18 13.2833 17.9042 13.5208 17.7125 13.7125C17.5208 13.9042 17.2833 14 17 14H7Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Filter-pressed-dark.svg",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_101_2907)">
|
||||
<circle cx="12" cy="12" r="12" fill="#425464"/>
|
||||
<path d="M11.1111 18.6667C10.8593 18.6667 10.6481 18.5815 10.4778 18.4111C10.3074 18.2407 10.2222 18.0296 10.2222 17.7778C10.2222 17.5259 10.3074 17.3148 10.4778 17.1444C10.6481 16.9741 10.8593 16.8889 11.1111 16.8889H12.8889C13.1407 16.8889 13.3519 16.9741 13.5222 17.1444C13.6926 17.3148 13.7778 17.5259 13.7778 17.7778C13.7778 18.0296 13.6926 18.2407 13.5222 18.4111C13.3519 18.5815 13.1407 18.6667 12.8889 18.6667H11.1111ZM4.88889 9.77778C4.63704 9.77778 4.42593 9.69259 4.25556 9.52222C4.08519 9.35185 4 9.14074 4 8.88889C4 8.63704 4.08519 8.42593 4.25556 8.25556C4.42593 8.08519 4.63704 8 4.88889 8H19.1111C19.363 8 19.5741 8.08519 19.7444 8.25556C19.9148 8.42593 20 8.63704 20 8.88889C20 9.14074 19.9148 9.35185 19.7444 9.52222C19.5741 9.69259 19.363 9.77778 19.1111 9.77778H4.88889ZM7.55556 14.2222C7.3037 14.2222 7.09259 14.137 6.92222 13.9667C6.75185 13.7963 6.66667 13.5852 6.66667 13.3333C6.66667 13.0815 6.75185 12.8704 6.92222 12.7C7.09259 12.5296 7.3037 12.4444 7.55556 12.4444H16.4444C16.6963 12.4444 16.9074 12.5296 17.0778 12.7C17.2481 12.8704 17.3333 13.0815 17.3333 13.3333C17.3333 13.5852 17.2481 13.7963 17.0778 13.9667C16.9074 14.137 16.6963 14.2222 16.4444 14.2222H7.55556Z" fill="white"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_101_2907">
|
||||
<rect width="24" height="24" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Filter-light.svg",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11 19C10.7167 19 10.4792 18.9042 10.2875 18.7125C10.0958 18.5208 10 18.2833 10 18C10 17.7167 10.0958 17.4792 10.2875 17.2875C10.4792 17.0958 10.7167 17 11 17H13C13.2833 17 13.5208 17.0958 13.7125 17.2875C13.9042 17.4792 14 17.7167 14 18C14 18.2833 13.9042 18.5208 13.7125 18.7125C13.5208 18.9042 13.2833 19 13 19H11ZM4 9C3.71667 9 3.47917 8.90417 3.2875 8.7125C3.09583 8.52083 3 8.28333 3 8C3 7.71667 3.09583 7.47917 3.2875 7.2875C3.47917 7.09583 3.71667 7 4 7H20C20.2833 7 20.5208 7.09583 20.7125 7.2875C20.9042 7.47917 21 7.71667 21 8C21 8.28333 20.9042 8.52083 20.7125 8.7125C20.5208 8.90417 20.2833 9 20 9H4ZM7 14C6.71667 14 6.47917 13.9042 6.2875 13.7125C6.09583 13.5208 6 13.2833 6 13C6 12.7167 6.09583 12.4792 6.2875 12.2875C6.47917 12.0958 6.71667 12 7 12H17C17.2833 12 17.5208 12.0958 17.7125 12.2875C17.9042 12.4792 18 12.7167 18 13C18 13.2833 17.9042 13.5208 17.7125 13.7125C17.5208 13.9042 17.2833 14 17 14H7Z" fill="#13293D"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Filter-pressed-light.svg",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_141_5661)">
|
||||
<circle cx="12" cy="12" r="12" fill="#E3E8F0"/>
|
||||
<path d="M11.1111 18.6667C10.8593 18.6667 10.6481 18.5815 10.4778 18.4111C10.3074 18.2407 10.2222 18.0296 10.2222 17.7778C10.2222 17.5259 10.3074 17.3148 10.4778 17.1444C10.6481 16.9741 10.8593 16.8889 11.1111 16.8889H12.8889C13.1407 16.8889 13.3519 16.9741 13.5222 17.1444C13.6926 17.3148 13.7778 17.5259 13.7778 17.7778C13.7778 18.0296 13.6926 18.2407 13.5222 18.4111C13.3519 18.5815 13.1407 18.6667 12.8889 18.6667H11.1111ZM4.88889 9.77778C4.63704 9.77778 4.42593 9.69259 4.25556 9.52222C4.08519 9.35185 4 9.14074 4 8.88889C4 8.63704 4.08519 8.42593 4.25556 8.25556C4.42593 8.08519 4.63704 8 4.88889 8H19.1111C19.363 8 19.5741 8.08519 19.7444 8.25556C19.9148 8.42593 20 8.63704 20 8.88889C20 9.14074 19.9148 9.35185 19.7444 9.52222C19.5741 9.69259 19.363 9.77778 19.1111 9.77778H4.88889ZM7.55556 14.2222C7.3037 14.2222 7.09259 14.137 6.92222 13.9667C6.75185 13.7963 6.66667 13.5852 6.66667 13.3333C6.66667 13.0815 6.75185 12.8704 6.92222 12.7C7.09259 12.5296 7.3037 12.4444 7.55556 12.4444H16.4444C16.6963 12.4444 16.9074 12.5296 17.0778 12.7C17.2481 12.8704 17.3333 13.0815 17.3333 13.3333C17.3333 13.5852 17.2481 13.7963 17.0778 13.9667C16.9074 14.137 16.6963 14.2222 16.4444 14.2222H7.55556Z" fill="#13293D"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_141_5661">
|
||||
<rect width="24" height="24" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -584,6 +584,7 @@
|
||||
|
||||
// MARK: - New Layout
|
||||
"all_chats_edit_layout_show_personal_notes" = "Notizenraum anzeigen";
|
||||
"all_chats_searchbar_prompt" = "Suche";
|
||||
|
||||
// MARK: - Permalink Scan
|
||||
"room_recents_scan_qr_code" = "QR Code scannen";
|
||||
|
||||
@@ -494,6 +494,7 @@
|
||||
|
||||
// MARK: - New Layout
|
||||
"all_chats_edit_layout_show_personal_notes" = "Show personal notes";
|
||||
"all_chats_searchbar_prompt" = "Suche";
|
||||
|
||||
// MARK: - Permalink Scan
|
||||
"room_recents_scan_qr_code" = "Scan QR Code";
|
||||
|
||||
@@ -117,6 +117,8 @@ class AllChatsViewController: HomeViewController {
|
||||
|
||||
private var toolbarHeight: CGFloat = 0
|
||||
|
||||
private weak var roomFilterButton: UIButton?
|
||||
|
||||
// MARK: - Lifecycle
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -135,9 +137,7 @@ class AllChatsViewController: HomeViewController {
|
||||
|
||||
toolbarHeight = toolbar.frame.height
|
||||
emptyViewBottomAnchor = toolbar.topAnchor
|
||||
|
||||
// bwi: 4179
|
||||
|
||||
|
||||
if BWIBuildSettings.shared.useNewBumColors { // bwi: #4883
|
||||
toolbar.tintColor = ThemeService.shared().theme.tintColor
|
||||
toolbar.barTintColor = ThemeService.shared().theme.backgroundColor
|
||||
@@ -145,15 +145,21 @@ class AllChatsViewController: HomeViewController {
|
||||
toolbar.tintColor = theme.colors.accent
|
||||
}
|
||||
|
||||
if BWIBuildSettings.shared.roomFiltersToggle {
|
||||
updateNewFilterSearchAndToggleButton()
|
||||
}
|
||||
|
||||
updateUI()
|
||||
|
||||
navigationItem.largeTitleDisplayMode = .never
|
||||
navigationController?.navigationBar.prefersLargeTitles = false
|
||||
|
||||
searchController.obscuresBackgroundDuringPresentation = false
|
||||
searchController.searchResultsUpdater = self
|
||||
searchController.delegate = self
|
||||
|
||||
if !BWIBuildSettings.shared.roomFiltersToggle {
|
||||
searchController.obscuresBackgroundDuringPresentation = false
|
||||
searchController.searchResultsUpdater = self
|
||||
searchController.delegate = self
|
||||
}
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(self.setupEditOptions), name: AllChatsLayoutSettingsManager.didUpdateSettings, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(self.updateBadgeButton), name: MXSpaceNotificationCounter.didUpdateNotificationCount, object: nil)
|
||||
|
||||
@@ -161,6 +167,76 @@ class AllChatsViewController: HomeViewController {
|
||||
self.registerThemeServiceDidChangeThemeNotification()
|
||||
}
|
||||
|
||||
// bwi: 4806
|
||||
private func updateNewFilterSearchAndToggleButton() {
|
||||
let customHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: recentsTableView.frame.width, height: 50))
|
||||
let searchBar = UISearchBar(frame: CGRect(x: 8, y: 0, width: customHeaderView.frame.width - 48, height: 50))
|
||||
let button = UIButton(frame: CGRect(x: customHeaderView.frame.width - 48 + 8, y: 0, width: 40, height: 50))
|
||||
|
||||
if ThemeService.shared().isCurrentThemeDark() {
|
||||
button.setImage(Asset.Images.roomFilterToggleDarkOff.image, for: .normal)
|
||||
button.setImage(Asset.Images.roomFilterToggleDarkOn.image, for: .selected)
|
||||
} else {
|
||||
button.setImage(Asset.Images.roomFilterToggleLightOff.image, for: .normal)
|
||||
button.setImage(Asset.Images.roomFilterToggleLightOn.image, for: .selected)
|
||||
}
|
||||
let settings = AllChatsLayoutSettingsManager.shared.allChatLayoutSettings
|
||||
let areFiltersVisible = !settings.filters.isEmpty
|
||||
button.isSelected = !AllChatsLayoutSettingsManager.shared.allChatLayoutSettings.filters.isEmpty
|
||||
button.addTarget(self, action: #selector(onFilterToggleTapped), for: .touchUpInside)
|
||||
|
||||
roomFilterButton = button // keep a reference to handle theme changes
|
||||
|
||||
searchBar.placeholder = BWIL10n.allChatsSearchbarPrompt
|
||||
searchBar.backgroundImage = UIImage() // this hides the separator lines above and below
|
||||
searchBar.delegate = self
|
||||
|
||||
customHeaderView.addSubview(searchBar)
|
||||
customHeaderView.addSubview(button)
|
||||
|
||||
recentsTableView.tableHeaderView = customHeaderView
|
||||
|
||||
// set some constraints for landscape and iPad
|
||||
customHeaderView.translatesAutoresizingMaskIntoConstraints = false
|
||||
let constraints = [
|
||||
searchBar.leadingAnchor.constraint(equalTo: customHeaderView.leadingAnchor),
|
||||
searchBar.centerYAnchor.constraint(equalTo: button.centerYAnchor),
|
||||
searchBar.widthAnchor.constraint(equalToConstant: 40),
|
||||
searchBar.heightAnchor.constraint(equalToConstant: 40),
|
||||
button.leadingAnchor.constraint(equalTo: searchBar.trailingAnchor),
|
||||
button.trailingAnchor.constraint(equalTo: customHeaderView.trailingAnchor),
|
||||
button.topAnchor.constraint(equalTo: customHeaderView.topAnchor),
|
||||
button.bottomAnchor.constraint(equalTo: customHeaderView.bottomAnchor),
|
||||
customHeaderView.centerXAnchor.constraint(equalTo: recentsTableView.centerXAnchor),
|
||||
customHeaderView.widthAnchor.constraint(equalTo: recentsTableView.widthAnchor),
|
||||
customHeaderView.topAnchor.constraint(equalTo: recentsTableView.topAnchor)
|
||||
]
|
||||
NSLayoutConstraint.activate(constraints)
|
||||
}
|
||||
|
||||
@objc
|
||||
func onSearchTextChanged(searchBar: UISearchBar) {
|
||||
guard let searchText = searchBar.text, !searchText.isEmpty else {
|
||||
self.dataSource?.search(withPatterns: nil)
|
||||
return
|
||||
}
|
||||
|
||||
self.dataSource?.search(withPatterns: [searchText])
|
||||
}
|
||||
|
||||
@objc
|
||||
func onFilterToggleTapped() {
|
||||
let settings = AllChatsLayoutSettingsManager.shared.allChatLayoutSettings
|
||||
let areFiltersVisible = !settings.filters.isEmpty
|
||||
let newSettings = AllChatsLayoutSettings(sections: settings.sections,
|
||||
filters: areFiltersVisible ? [] : [.unreads, .favourites, .people],
|
||||
sorting: settings.sorting)
|
||||
AllChatsLayoutSettingsManager.shared.allChatLayoutSettings = newSettings
|
||||
Analytics.shared.trackInteraction(areFiltersVisible ? .allChatsFiltersDisabled : .allChatsFiltersEnabled)
|
||||
|
||||
roomFilterButton?.isSelected = !AllChatsLayoutSettingsManager.shared.allChatLayoutSettings.filters.isEmpty
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
@@ -172,8 +248,18 @@ class AllChatsViewController: HomeViewController {
|
||||
self.toolbar.tintColor = theme.colors.accent
|
||||
}
|
||||
|
||||
if self.navigationItem.searchController == nil {
|
||||
self.navigationItem.searchController = searchController
|
||||
if BWIBuildSettings.shared.roomFiltersToggle {
|
||||
if ThemeService.shared().isCurrentThemeDark() {
|
||||
roomFilterButton?.setImage(Asset.Images.roomFilterToggleDarkOff.image, for: .normal)
|
||||
roomFilterButton?.setImage(Asset.Images.roomFilterToggleDarkOn.image, for: .selected)
|
||||
} else {
|
||||
roomFilterButton?.setImage(Asset.Images.roomFilterToggleLightOff.image, for: .normal)
|
||||
roomFilterButton?.setImage(Asset.Images.roomFilterToggleLightOn.image, for: .selected)
|
||||
}
|
||||
} else {
|
||||
if self.navigationItem.searchController == nil {
|
||||
self.navigationItem.searchController = searchController
|
||||
}
|
||||
}
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(self.spaceListDidChange), name: MXSpaceService.didInitialise, object: nil)
|
||||
@@ -217,7 +303,7 @@ class AllChatsViewController: HomeViewController {
|
||||
|
||||
coordinator.animate { context in
|
||||
self.recentsTableView?.tableHeaderView?.layoutIfNeeded()
|
||||
self.recentsTableView?.tableHeaderView = self.recentsTableView?.tableHeaderView
|
||||
// self.recentsTableView?.tableHeaderView = self.recentsTableView?.tableHeaderView
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,14 +627,16 @@ class AllChatsViewController: HomeViewController {
|
||||
override func shouldShowEmptyView() -> Bool {
|
||||
let shouldShowEmptyView = super.shouldShowEmptyView() && !AllChatsLayoutSettingsManager.shared.hasAnActiveFilter
|
||||
|
||||
if shouldShowEmptyView {
|
||||
self.navigationItem.searchController = nil
|
||||
navigationItem.largeTitleDisplayMode = .never
|
||||
} else {
|
||||
self.navigationItem.searchController = searchController
|
||||
navigationItem.largeTitleDisplayMode = .automatic
|
||||
if !BWIBuildSettings.shared.roomFiltersToggle {
|
||||
if shouldShowEmptyView {
|
||||
self.navigationItem.searchController = nil
|
||||
navigationItem.largeTitleDisplayMode = .never
|
||||
} else {
|
||||
self.navigationItem.searchController = searchController
|
||||
navigationItem.largeTitleDisplayMode = .automatic
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return shouldShowEmptyView
|
||||
}
|
||||
|
||||
@@ -589,10 +677,10 @@ class AllChatsViewController: HomeViewController {
|
||||
return
|
||||
}
|
||||
|
||||
tableView.tableHeaderView = tableHeadeView
|
||||
tableView.tableHeaderView?.widthAnchor.constraint(equalTo: tableView.widthAnchor).isActive = true
|
||||
tableView.tableHeaderView?.layoutIfNeeded()
|
||||
tableView.tableHeaderView = self.recentsTableView?.tableHeaderView
|
||||
// tableView.tableHeaderView = tableHeadeView
|
||||
// tableView.tableHeaderView?.widthAnchor.constraint(equalTo: tableView.widthAnchor).isActive = true
|
||||
// tableView.tableHeaderView?.layoutIfNeeded()
|
||||
// tableView.tableHeaderView = self.recentsTableView?.tableHeaderView
|
||||
}
|
||||
|
||||
@objc private func setupEditOptions() {
|
||||
@@ -849,7 +937,7 @@ extension AllChatsViewController: UISearchResultsUpdating {
|
||||
self.dataSource?.search(withPatterns: nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
self.dataSource?.search(withPatterns: [searchText])
|
||||
}
|
||||
}
|
||||
@@ -862,6 +950,17 @@ extension AllChatsViewController: UISearchControllerDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
extension AllChatsViewController {
|
||||
override func searchBar(_ searchBar: UISearchBar, textDidChange: String) {
|
||||
guard let searchText = searchBar.text, !searchText.isEmpty else {
|
||||
self.dataSource?.search(withPatterns: nil)
|
||||
return
|
||||
}
|
||||
|
||||
self.dataSource?.search(withPatterns: [searchText])
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - UIAdaptivePresentationControllerDelegate
|
||||
extension AllChatsViewController: UIAdaptivePresentationControllerDelegate {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user