mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Add a clear all button to recent searches
Lets users wipe their whole search history at once from the recent searches section header, as per the designs.
This commit is contained in:
@@ -52,6 +52,7 @@ enum SearchScreenViewAction: CustomStringConvertible {
|
||||
case selectRoom(roomID: String)
|
||||
case selectMessage(roomID: String, eventID: String)
|
||||
case removeBreadcrumb(SearchScreenBreadcrumb)
|
||||
case clearBreadcrumbs
|
||||
case reachedTop
|
||||
case reachedBottom
|
||||
case cancel
|
||||
@@ -63,6 +64,7 @@ enum SearchScreenViewAction: CustomStringConvertible {
|
||||
case .selectRoom(let roomID): "selectRoom(\(roomID))"
|
||||
case .selectMessage(let roomID, let eventID): "selectMessage(\(roomID), \(eventID))"
|
||||
case .removeBreadcrumb: "removeBreadcrumb"
|
||||
case .clearBreadcrumbs: "clearBreadcrumbs"
|
||||
case .reachedTop: "reachedTop"
|
||||
case .reachedBottom: "reachedBottom"
|
||||
case .cancel: "cancel"
|
||||
|
||||
@@ -149,6 +149,8 @@ class SearchScreenViewModel: SearchScreenViewModelType, SearchScreenViewModelPro
|
||||
actionsSubject.send(.presentRoom(roomID: roomID, eventID: eventID))
|
||||
case .removeBreadcrumb(let breadcrumb):
|
||||
removeBreadcrumb(breadcrumb)
|
||||
case .clearBreadcrumbs:
|
||||
userSettings.searchBreadcrumbs = []
|
||||
case .reachedTop:
|
||||
if state.bindings.searchMode == .rooms {
|
||||
updateVisibleRange(edge: .top)
|
||||
|
||||
@@ -209,8 +209,19 @@ struct SearchScreen: View {
|
||||
}
|
||||
}
|
||||
} header: {
|
||||
Text(UntranslatedL10n.screenSearchRecentSearches)
|
||||
.compoundListSectionHeader()
|
||||
HStack(spacing: 8) {
|
||||
Text(UntranslatedL10n.screenSearchRecentSearches)
|
||||
.compoundListSectionHeader()
|
||||
|
||||
Spacer()
|
||||
|
||||
// The compound text link style has no accent colour variant.
|
||||
Button { context.send(viewAction: .clearBreadcrumbs) } label: {
|
||||
Text(L10n.actionClearAll)
|
||||
.font(.compound.bodyMDSemibold)
|
||||
.foregroundStyle(.compound.textActionAccent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.compoundList(.plain)
|
||||
|
||||
Reference in New Issue
Block a user