Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"conversation.wireCells.files.loadMore.title" = "Load more";
"conversation.wireCells.files.noData.title" = "There are no files or folders yet";
"conversation.wireCells.files.noData.message" = "You'll find all files and folders shared in this conversation here";
"conversation.wireCells.files.noSearchResults.title" = "No results found";
"conversation.wireCells.files.noSearchResults.message" = "Try adjusting your search.";
"conversation.wireCells.files.pendingCells.title" = "Files are loading";
"conversation.wireCells.files.pendingCells.message" = "Your documents and media files will be available here once we've uploaded all files and folders.";
"conversation.wireCells.allFiles.noData.message" = "You'll find all files and folders shared across your conversations here.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@
"conversation.wireCells.allFiles.noData.title" = "There are no files yet";
"conversation.wireCells.allFiles.noData.message" = "For conversations that use shared Drive, you'll find all files here.";
"conversation.wireCells.allFiles.noData.learnMore" = "Learn more";
"conversation.wireCells.files.noSearchResults.title" = "No results found";
"conversation.wireCells.files.noSearchResults.message" = "Try adjusting your search.";
"conversation.wireCells.files.pendingCells.title" = "Files are loading";
"conversation.wireCells.files.pendingCells.message" = "Your documents and media files will be available here once we've uploaded all files and folders.";
"conversation.wireCells.files.error.title" = "Can't load files";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct FilesInfoView: View {

enum Info: Equatable {
case preparingFiles
case noFilesFound(scope: Scope)
case noFilesFound(scope: Scope, isSearch: Bool)
case error(isConnectionError: Bool)

enum Scope: Equatable {
Expand All @@ -47,31 +47,40 @@ struct FilesInfoView: View {
}
}

func textForScope(_ scope: Scope) -> String {
switch scope {
case .allConversations: Strings.AllFiles.NoData.message
case .oneConversation: Strings.Files.NoData.message
case .recycleBin: Strings.RecycleBin.NoData.message
func textFor(scope: Scope, isSearch: Bool) -> String {
if isSearch {
Strings.Files.NoSearchResults.message
} else {
switch scope {
case .allConversations: Strings.AllFiles.NoData.message
case .oneConversation: Strings.Files.NoData.message
case .recycleBin: Strings.RecycleBin.NoData.message
}
}
}

func accessibilityTextForScope(_ scope: Scope) -> String {
switch scope {
case .allConversations: Accessibility.AllFiles.NoData.message
case .oneConversation: Accessibility.Files.NoData.message
case .recycleBin: Accessibility.RecycleBin.NoData.message
func accessibilityTextFor(scope: Scope, isSearch: Bool) -> String {
if isSearch {
Accessibility.Files.NoSearchResults.message
} else {
switch scope {
case .allConversations: Accessibility.AllFiles.NoData.message
case .oneConversation: Accessibility.Files.NoData.message
case .recycleBin: Accessibility.RecycleBin.NoData.message
}
}
}

var localizedStrings: (title: String, message: String) {
switch self {
case .preparingFiles:
(Strings.Files.PendingCells.title, Strings.Files.PendingCells.message)
case let .noFilesFound(scope):
case let .noFilesFound(scope, isSearch):
(
scope == .oneConversation || scope == .recycleBin ?
isSearch ? Strings.Files.NoSearchResults.title :
scope == .oneConversation || scope == .recycleBin ?
Strings.Files.NoData.title : Strings.AllFiles.NoData.title,
textForScope(scope)
textFor(scope: scope, isSearch: isSearch)
)
case let .error(isConnectionError):
if isConnectionError {
Expand All @@ -86,10 +95,10 @@ struct FilesInfoView: View {
switch self {
case .preparingFiles:
(Accessibility.Files.PendingCells.title, Accessibility.Files.PendingCells.message)
case let .noFilesFound(scope):
case let .noFilesFound(scope, isSearch):
(
Accessibility.Files.NoData.title,
accessibilityTextForScope(scope)
accessibilityTextFor(scope: scope, isSearch: isSearch)
)
case let .error(isConnectionError):
if isConnectionError {
Expand All @@ -104,11 +113,18 @@ struct FilesInfoView: View {
switch self {
case .preparingFiles:
("preparing-files-title", "preparing-files-message")
case let .noFilesFound(scope):
(
"no-files-title",
scope == .allConversations ? "no-files-all-conversations-message" : "no-files-message"
)
case let .noFilesFound(scope, isSearch):
if isSearch {
(
"no-files-search-title",
"no-files-search-message"
)
} else {
(
"no-files-title",
scope == .allConversations ? "no-files-all-conversations-message" : "no-files-message"
)
}
case .error:
("error-title", "error-message")
}
Expand Down Expand Up @@ -138,8 +154,10 @@ struct FilesInfoView: View {
.accessibilityIdentifier(info.accessibilityIdentifiers.message)

switch info {
case let .noFilesFound(scope):
learnMoreLink(scope: scope)
case let .noFilesFound(scope, isSearch):
if !isSearch {
learnMoreLink(scope: scope)
}
case .error:
retryButton
default:
Expand Down Expand Up @@ -194,15 +212,19 @@ struct FilesInfoView: View {
}

#Preview("no files found - single conversation") {
FilesInfoView(info: .noFilesFound(scope: .oneConversation))
FilesInfoView(info: .noFilesFound(scope: .oneConversation, isSearch: false))
}

#Preview("no files found - all conversations") {
FilesInfoView(info: .noFilesFound(scope: .allConversations))
FilesInfoView(info: .noFilesFound(scope: .allConversations, isSearch: false))
}

#Preview("no files found - recycle bin") {
FilesInfoView(info: .noFilesFound(scope: .recycleBin))
FilesInfoView(info: .noFilesFound(scope: .recycleBin, isSearch: false))
}

#Preview("no files found via search - all conversations") {
FilesInfoView(info: .noFilesFound(scope: .allConversations, isSearch: true))
}

struct LoadMoreView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ extension FilesViewProtocol {
@ViewBuilder private var listBackgroundView: some View {
switch viewModel.state {
case let .received(items) where items.isEmpty:
FilesInfoView(info: .noFilesFound(
scope: viewModel.isRecycleBin ? .recycleBin : isBrowsing ? .allConversations : .oneConversation)
FilesInfoView(
info: .noFilesFound(
scope: viewModel.isRecycleBin ? .recycleBin : isBrowsing ? .allConversations : .oneConversation,
isSearch: !viewModel.searchText.isEmpty
)
)
case .pending:
FilesInfoView(info: .preparingFiles)
Expand Down
Loading