Skip to content

Commit 9197c40

Browse files
authored
feat: search files in conversation - WPB-21647 (#4051)
1 parent ecafb40 commit 9197c40

File tree

18 files changed

+246
-50
lines changed

18 files changed

+246
-50
lines changed

WireMessaging/Sources/WireMessagingData/WireCells/NodesAPI/RestAPI.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,11 @@ private extension WireCellsGetNodesRequest {
464464
deleted: .not,
465465
isDraft: false
466466
),
467+
text: LookupFilterTextSearch(searchIn: .baseName, term: searchTerm ?? "*"),
467468
type: isFoldersEnabled ? .unknown : .leaf // .unknown includes files (leafs) & folders (collections)
468469
)
469470
request.scope = RestLookupScope(
470-
recursive: isFoldersEnabled ? false : true,
471+
recursive: searchTerm?.isEmpty == false,
471472
root: RestNodeLocator(root)
472473
)
473474
case let .recycleBinView(root: root, isFoldersEnabled):

WireMessaging/Sources/WireMessagingUI/WireCells/Components/Files/FilenameValidator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct FilenameValidator {
3838
.failure(.dotPrefix)
3939
} else if input.count > Constants.maxInputLength {
4040
.failure(.tooLong)
41-
} else if input.contains("/") {
41+
} else if input.contains("/") || input.contains("\\") {
4242
.failure(.slashCharacter)
4343
} else {
4444
.success(())

WireMessaging/Sources/WireMessagingUI/WireCells/Components/Files/FilesBrowserView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private extension FilesBrowserView {
111111

112112
// MARK: - Helper
113113

114-
private extension View {
114+
extension View {
115115
@ViewBuilder
116116
func `if`(
117117
_ condition: Bool,

WireMessaging/Sources/WireMessagingUI/WireCells/Components/Files/FilesView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ package struct FilesView: FilesViewProtocol {
7070
.toolbarBackground(.visible, for: .navigationBar) // shows navigation bar divider
7171
.toolbarBackground(ColorTheme.Backgrounds.background.color, for: .navigationBar)
7272
.toolbar { toolbarContent }
73+
.if(viewModel.showSearchBar) { view in
74+
view.searchable(
75+
text: $viewModel.searchText,
76+
placement: .navigationBarDrawer,
77+
prompt: Strings.Files.Search.title
78+
)
79+
}
7380
.onAppear { reloadTask() }
7481
.onReceive(viewModel.triggerReload) { _ in
7582
Task {
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

WireUI/Sources/WireDesign/Colors/ColorTheme.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ public enum ColorTheme {
109109

110110
public enum Buttons {
111111

112-
enum Primary {
112+
public enum Primary {
113113

114-
static let enabled = UIColor(light: .blue500Light, dark: .blue500Dark)
114+
public static let enabled = UIColor(light: .blue500Light, dark: .blue500Dark)
115115
static let onEnabled = UIColor(light: .white, dark: .black)
116116

117117
static let disabled = UIColor(light: .gray50, dark: .gray80)

wire-ios/Wire-iOS Tests/Collection/CollectionsViewControllerTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ final class CollectionsViewControllerTests: XCTestCase {
126126
func testThatNoElementStateIsShownWhenCollectionIsEmpty() {
127127
let controller = CollectionsViewController(
128128
collection: emptyCollection,
129+
isCellsEnabled: false,
129130
fetchingDone: true,
130131
userSession: userSession,
131132
mainCoordinator: mockMainCoordinator,
@@ -138,6 +139,7 @@ final class CollectionsViewControllerTests: XCTestCase {
138139
func testThatLoadingIsShownWhenFetching() {
139140
let controller = CollectionsViewController(
140141
collection: emptyCollection,
142+
isCellsEnabled: false,
141143
fetchingDone: false,
142144
userSession: userSession,
143145
mainCoordinator: mockMainCoordinator,
@@ -244,6 +246,7 @@ final class CollectionsViewControllerTests: XCTestCase {
244246

245247
let controller = CollectionsViewController(
246248
collection: collection,
249+
isCellsEnabled: false,
247250
userSession: userSession,
248251
mainCoordinator: mockMainCoordinator,
249252
selfProfileUIBuilder: MockSelfProfileViewControllerBuilderProtocol(),

0 commit comments

Comments
 (0)