diff --git a/Localization/app.json b/Localization/app.json index 95410b8b..f370022a 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -382,7 +382,8 @@ }, "auto_complete": { "single_people_talking": "%ld people talking", - "multiple_people_talking": "%ld people talking" + "multiple_people_talking": "%ld people talking", + "space_to_add": "Space to add" }, "accessibility": { "append_attachment": "Append attachment", diff --git a/Mastodon/Diffiable/Section/AutoCompleteSection.swift b/Mastodon/Diffiable/Section/AutoCompleteSection.swift index 39aa6e9c..8de32a28 100644 --- a/Mastodon/Diffiable/Section/AutoCompleteSection.swift +++ b/Mastodon/Diffiable/Section/AutoCompleteSection.swift @@ -33,7 +33,7 @@ extension AutoCompleteSection { return cell case .emoji(let emoji): let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: AutoCompleteTableViewCell.self), for: indexPath) as! AutoCompleteTableViewCell - configureEmoji(cell: cell, emoji: emoji) + configureEmoji(cell: cell, emoji: emoji, isFirst: indexPath.row == 0) return cell case .bottomLoader: let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: TimelineBottomLoaderTableViewCell.self), for: indexPath) as! TimelineBottomLoaderTableViewCell @@ -80,8 +80,10 @@ extension AutoCompleteSection { cell.configure(with: AvatarConfigurableViewConfiguration(avatarImageURL: URL(string: account.avatar))) } - private static func configureEmoji(cell: AutoCompleteTableViewCell, emoji: Mastodon.Entity.Emoji) { + private static func configureEmoji(cell: AutoCompleteTableViewCell, emoji: Mastodon.Entity.Emoji, isFirst: Bool) { cell.titleLabel.text = ":" + emoji.shortcode + ":" + // FIXME: handle spacer enter to complete emoji + // cell.subtitleLabel.text = isFirst ? L10n.Scene.Compose.AutoComplete.spaceToAdd : " " cell.subtitleLabel.text = " " cell.avatarImageView.isHidden = false cell.configure(with: AvatarConfigurableViewConfiguration(avatarImageURL: URL(string: emoji.url))) diff --git a/Mastodon/Generated/Strings.swift b/Mastodon/Generated/Strings.swift index d1014b4b..07cab397 100644 --- a/Mastodon/Generated/Strings.swift +++ b/Mastodon/Generated/Strings.swift @@ -457,6 +457,8 @@ internal enum L10n { internal static func singlePeopleTalking(_ p1: Int) -> String { return L10n.tr("Localizable", "Scene.Compose.AutoComplete.SinglePeopleTalking", p1) } + /// Space to add + internal static let spaceToAdd = L10n.tr("Localizable", "Scene.Compose.AutoComplete.SpaceToAdd") } internal enum ContentWarning { /// Write an accurate warning here... diff --git a/Mastodon/Resources/ar.lproj/Localizable.strings b/Mastodon/Resources/ar.lproj/Localizable.strings index ad7e4dd8..e6bb7b21 100644 --- a/Mastodon/Resources/ar.lproj/Localizable.strings +++ b/Mastodon/Resources/ar.lproj/Localizable.strings @@ -153,6 +153,7 @@ uploaded to Mastodon."; "Scene.Compose.Attachment.Video" = "video"; "Scene.Compose.AutoComplete.MultiplePeopleTalking" = "%ld people talking"; "Scene.Compose.AutoComplete.SinglePeopleTalking" = "%ld people talking"; +"Scene.Compose.AutoComplete.SpaceToAdd" = "Space to add"; "Scene.Compose.ComposeAction" = "Publish"; "Scene.Compose.ContentInputPlaceholder" = "Type or paste what’s on your mind"; "Scene.Compose.ContentWarning.Placeholder" = "Write an accurate warning here..."; diff --git a/Mastodon/Resources/en.lproj/Localizable.strings b/Mastodon/Resources/en.lproj/Localizable.strings index ad7e4dd8..e6bb7b21 100644 --- a/Mastodon/Resources/en.lproj/Localizable.strings +++ b/Mastodon/Resources/en.lproj/Localizable.strings @@ -153,6 +153,7 @@ uploaded to Mastodon."; "Scene.Compose.Attachment.Video" = "video"; "Scene.Compose.AutoComplete.MultiplePeopleTalking" = "%ld people talking"; "Scene.Compose.AutoComplete.SinglePeopleTalking" = "%ld people talking"; +"Scene.Compose.AutoComplete.SpaceToAdd" = "Space to add"; "Scene.Compose.ComposeAction" = "Publish"; "Scene.Compose.ContentInputPlaceholder" = "Type or paste what’s on your mind"; "Scene.Compose.ContentWarning.Placeholder" = "Write an accurate warning here..."; diff --git a/Mastodon/Scene/Compose/AutoComplete/Cell/AutoCompleteTableViewCell.swift b/Mastodon/Scene/Compose/AutoComplete/Cell/AutoCompleteTableViewCell.swift index 324f5354..c9f0a55d 100644 --- a/Mastodon/Scene/Compose/AutoComplete/Cell/AutoCompleteTableViewCell.swift +++ b/Mastodon/Scene/Compose/AutoComplete/Cell/AutoCompleteTableViewCell.swift @@ -45,6 +45,8 @@ final class AutoCompleteTableViewCell: UITableViewCell { return label }() + let separatorLine = UIView.separatorLine + override func prepareForReuse() { super.prepareForReuse() avatarImageView.af.cancelImageRequest() @@ -118,6 +120,15 @@ extension AutoCompleteTableViewCell { bottomPaddingView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), bottomPaddingView.heightAnchor.constraint(equalTo: topPaddingView.heightAnchor, multiplier: 1.0), ]) + + separatorLine.translatesAutoresizingMaskIntoConstraints = false + contentView.addSubview(separatorLine) + NSLayoutConstraint.activate([ + separatorLine.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), + separatorLine.trailingAnchor.constraint(equalTo: contentView.trailingAnchor), + separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), + separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)).priority(.defaultHigh), + ]) } }