diff --git a/Sources/SearchFeature/Controllers/SearchUsernameController.swift b/Sources/SearchFeature/Controllers/SearchUsernameController.swift index d40aac049fa9af53e0d67ea160ec1b7d0f91b309..45cfd638b772321dcff81ed5b10f0436c5b08e04 100644 --- a/Sources/SearchFeature/Controllers/SearchUsernameController.swift +++ b/Sources/SearchFeature/Controllers/SearchUsernameController.swift @@ -80,6 +80,8 @@ final class SearchUsernameController: UIViewController { .receive(on: DispatchQueue.main) .sink { [unowned self] in screenView.placeholderView.isHidden = true + screenView.emptyView.isHidden = $0.numberOfItems != 0 + dataSource.apply($0, animatingDifferences: false) }.store(in: &cancellables) diff --git a/Sources/SearchFeature/Views/SearchUsernameView.swift b/Sources/SearchFeature/Views/SearchUsernameView.swift index 4e60479d0cd75f75e46847a94ce2cb0984007b60..bd9798030884d601b544ee3084a0acf705eda17d 100644 --- a/Sources/SearchFeature/Views/SearchUsernameView.swift +++ b/Sources/SearchFeature/Views/SearchUsernameView.swift @@ -4,6 +4,26 @@ import Shared final class SearchUsernameView: UIView { let tableView = UITableView() let inputField = SearchComponent() + let emptyView: UIView = { + let view = UIView() + let label = UILabel() + + label.numberOfLines = 0 + label.textAlignment = .center + label.font = Fonts.Mulish.regular.font(size: 15.0) + label.text = Localized.Ud.Search.Username.Empty.title + label.textColor = Asset.neutralSecondaryAlternative.color + + view.addSubview(label) + label.snp.makeConstraints { + $0.center.equalToSuperview() + $0.left.equalToSuperview().offset(20) + $0.right.equalToSuperview().offset(-20) + } + + return view + }() + let placeholderView = SearchUsernamePlaceholderView() init() { @@ -14,8 +34,11 @@ final class SearchUsernameView: UIView { imageAtRight: nil ) + emptyView.isHidden = true + addSubview(tableView) addSubview(inputField) + addSubview(emptyView) addSubview(placeholderView) setupConstraints() @@ -37,6 +60,13 @@ final class SearchUsernameView: UIView { $0.bottom.equalToSuperview() } + emptyView.snp.makeConstraints { + $0.top.equalTo(inputField.snp.bottom).offset(20) + $0.left.equalToSuperview() + $0.right.equalToSuperview() + $0.bottom.equalToSuperview() + } + placeholderView.snp.makeConstraints { $0.top.equalTo(inputField.snp.bottom) $0.left.equalToSuperview().offset(32.5) diff --git a/Sources/Shared/AutoGenerated/Strings.swift b/Sources/Shared/AutoGenerated/Strings.swift index 0117c9b8d9abd5c6a51d004886c649c491e3e918..ada5805cb79cece20fc7c23c6a6d435a8b0e319b 100644 --- a/Sources/Shared/AutoGenerated/Strings.swift +++ b/Sources/Shared/AutoGenerated/Strings.swift @@ -218,7 +218,7 @@ public enum Localized { public static let login = Localized.tr("Localizable", "accountRestore.sftp.login") /// Password public static let password = Localized.tr("Localizable", "accountRestore.sftp.password") - /// Login to your server. Your credentials will be automatically and securley saved locally on your device. + /// Login to your server. Your credentials will be automatically and securely saved locally on your device. public static let subtitle = Localized.tr("Localizable", "accountRestore.sftp.subtitle") /// Login to your SFTP public static let title = Localized.tr("Localizable", "accountRestore.sftp.title") @@ -1249,6 +1249,10 @@ public enum Localized { public enum Username { /// Search by username public static let input = Localized.tr("Localizable", "ud.search.username.input") + public enum Empty { + /// There are no users with that username + public static let title = Localized.tr("Localizable", "ud.search.username.empty.title") + } public enum Placeholder { /// Your searches are anonymous. Search information is never linked to your account or personally identifiable. public static let subtitle = Localized.tr("Localizable", "ud.search.username.placeholder.subtitle") diff --git a/Sources/Shared/Resources/en.lproj/Localizable.strings b/Sources/Shared/Resources/en.lproj/Localizable.strings index fb5ab0e271d09d6da94605606504f46ba9a757df..0668a396144a736f712d0c79f0986dba83a7a74e 100644 --- a/Sources/Shared/Resources/en.lproj/Localizable.strings +++ b/Sources/Shared/Resources/en.lproj/Localizable.strings @@ -989,6 +989,9 @@ "ud.search.phone.input" = "Search by phone number"; +"ud.search.username.empty.title" += "There are no users with that username"; + "ud.search.username.placeholder.title" = "Search for #friends# anonymously, add them to your #connections# to start a completely private messaging channel."; "ud.search.username.placeholder.subtitle"