Various Fixes

This commit is contained in:
Ilya Laktyushin
2021-10-28 16:37:34 +04:00
parent 83e17029fc
commit d80ead5f67
7 changed files with 111 additions and 27 deletions

View File

@@ -14,17 +14,6 @@ import SearchBarNode
import SearchUI
import ChatListSearchItemHeader
/*extension NavigationBarSearchContentNode: ItemListControllerSearchNavigationContentNode {
public func activate() {
}
public func deactivate() {
}
public func setQueryUpdated(_ f: @escaping (String) -> Void) {
}
}*/
extension SettingsSearchableItemIcon {
func image() -> UIImage? {
switch self {
@@ -298,8 +287,14 @@ private enum SettingsSearchRecentEntry: Comparable, Identifiable {
func item(account: Account, theme: PresentationTheme, strings: PresentationStrings, interaction: SettingsSearchInteraction) -> ListViewItem {
switch self {
case let .recent(_, item, header), let .faq(_, item, header):
return SettingsSearchRecentItem(account: account, theme: theme, strings: strings, title: item.title, breadcrumbs: item.breadcrumbs, action: {
case let .recent(_, item, header):
return SettingsSearchRecentItem(account: account, theme: theme, strings: strings, title: item.title, breadcrumbs: item.breadcrumbs, isFaq: false, action: {
interaction.openItem(item)
}, deleted: {
interaction.deleteRecentItem(item.id)
}, header: header)
case let .faq(_, item, header):
return SettingsSearchRecentItem(account: account, theme: theme, strings: strings, title: item.title, breadcrumbs: item.breadcrumbs, isFaq: true, action: {
interaction.openItem(item)
}, deleted: {
interaction.deleteRecentItem(item.id)

View File

@@ -19,17 +19,19 @@ class SettingsSearchRecentItem: ListViewItem {
let account: Account
let title: String
let breadcrumbs: [String]
let isFaq: Bool
let action: () -> Void
let deleted: () -> Void
let header: ListViewItemHeader?
init(account: Account, theme: PresentationTheme, strings: PresentationStrings, title: String, breadcrumbs: [String], action: @escaping () -> Void, deleted: @escaping () -> Void, header: ListViewItemHeader) {
init(account: Account, theme: PresentationTheme, strings: PresentationStrings, title: String, breadcrumbs: [String], isFaq: Bool, action: @escaping () -> Void, deleted: @escaping () -> Void, header: ListViewItemHeader) {
self.theme = theme
self.strings = strings
self.account = account
self.title = title
self.breadcrumbs = breadcrumbs
self.isFaq = isFaq
self.action = action
self.deleted = deleted
self.header = header
@@ -227,7 +229,12 @@ class SettingsSearchRecentItemNode: ItemListRevealOptionsItemNode {
strongSelf.updateLayout(size: nodeLayout.contentSize, leftInset: params.leftInset, rightInset: params.rightInset)
strongSelf.setRevealOptions((left: [], right: [ItemListRevealOption(key: RevealOptionKey.delete.rawValue, title: item.strings.Common_Delete, icon: .none, color: item.theme.list.itemDisclosureActions.destructive.fillColor, textColor: item.theme.list.itemDisclosureActions.destructive.foregroundColor)]))
var revealOptions: [ItemListRevealOption] = []
if item.isFaq {
} else {
revealOptions.append(ItemListRevealOption(key: RevealOptionKey.delete.rawValue, title: item.strings.Common_Delete, icon: .none, color: item.theme.list.itemDisclosureActions.destructive.fillColor, textColor: item.theme.list.itemDisclosureActions.destructive.foregroundColor))
}
strongSelf.setRevealOptions((left: [], right: revealOptions))
}
})
})