From 761c8ed3bef41edcc404089bbfbf05d87a8848ee Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sat, 4 Mar 2023 09:50:13 +0100 Subject: [PATCH] Composer: Sort suggested tags by usage + display it --- .../Localization/be.lproj/Localizable.strings | 2 ++ .../Localization/ca.lproj/Localizable.strings | 2 ++ .../Localization/de.lproj/Localizable.strings | 2 ++ .../Localization/en-GB.lproj/Localizable.strings | 2 ++ .../Localization/en.lproj/Localizable.strings | 1 + .../Localization/es.lproj/Localizable.strings | 2 ++ .../Localization/eu.lproj/Localizable.strings | 2 ++ .../Localization/fr.lproj/Localizable.strings | 2 ++ .../Localization/it.lproj/Localizable.strings | 2 ++ .../Localization/ja.lproj/Localizable.strings | 2 ++ .../Localization/ko.lproj/Localizable.strings | 2 ++ .../Localization/nb.lproj/Localizable.strings | 2 ++ .../Localization/nl.lproj/Localizable.strings | 2 ++ .../Localization/pl.lproj/Localizable.strings | 2 ++ .../Localization/pt-BR.lproj/Localizable.strings | 2 ++ .../Localization/tr.lproj/Localizable.strings | 2 ++ .../Localization/uk.lproj/Localizable.strings | 2 ++ .../Localization/zh-Hans.lproj/Localizable.strings | 2 ++ .../Components/StatusEditorAutoCompleteView.swift | 11 ++++++++--- .../Sources/Status/Editor/StatusEditorViewModel.swift | 2 +- 20 files changed, 44 insertions(+), 4 deletions(-) diff --git a/IceCubesApp/Resources/Localization/be.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/be.lproj/Localizable.strings index 4ac971e2..5fb1a8ad 100644 --- a/IceCubesApp/Resources/Localization/be.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/be.lproj/Localizable.strings @@ -516,3 +516,5 @@ "report.action.send" = "Адправіць"; "status.action.report" = "Паскардзіцца"; +"tag.suggested.mentions-%@" = "%@ mentions"; + diff --git a/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings index 259d4ebc..a84841fe 100644 --- a/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings @@ -509,3 +509,5 @@ "report.title" = "Report Post"; "report.action.send" = "Send"; "status.action.report" = "Report Post"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings index df5612c9..0a90aea6 100644 --- a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings @@ -505,3 +505,5 @@ "report.title" = "Beitrag melden"; "report.action.send" = "Absenden"; "status.action.report" = "Beitrag melden"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings index df435ac1..ad43219e 100644 --- a/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings @@ -512,3 +512,5 @@ "report.title" = "Report Post"; "report.action.send" = "Send"; "status.action.report" = "Report Post"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings index ac42aaa6..c1cb04f5 100644 --- a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings @@ -512,3 +512,4 @@ "report.action.send" = "Send"; "status.action.report" = "Report Post"; +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings index f578fdc6..63c5073c 100644 --- a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings @@ -511,3 +511,5 @@ "report.title" = "Denunciar publicación"; "report.action.send" = "Enviar"; "status.action.report" = "Denunciar publicación"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings index 73fee49a..bab7d2f3 100644 --- a/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings @@ -500,3 +500,5 @@ "report.title" = "Salaketa"; "report.action.send" = "Bidali"; "status.action.report" = "Salatu edukia"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings index 239000ae..962221ee 100644 --- a/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings @@ -506,3 +506,5 @@ "report.title" = "Signaler la publication"; "report.action.send" = "Envoyer"; "status.action.report" = "Signaler la publication"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings index 920c7736..bfd9e1d2 100644 --- a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings @@ -511,3 +511,5 @@ "report.title" = "Segnala il messaggio"; "report.action.send" = "Invia"; "status.action.report" = "Segnala il messaggio"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings index 56ec4117..29dce5a3 100644 --- a/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings @@ -510,3 +510,5 @@ "report.title" = "投稿を報告"; "report.action.send" = "送信"; "status.action.report" = "投稿を報告"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings index b0ab6936..853f1bdc 100644 --- a/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings @@ -512,3 +512,5 @@ "report.title" = "신고"; "report.action.send" = "제출"; "status.action.report" = "글 신고"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings index 0ab65d54..26784582 100644 --- a/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings @@ -510,3 +510,5 @@ "report.title" = "Report Post"; "report.action.send" = "Send"; "status.action.report" = "Report Post"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings index d32a0def..8580abe8 100644 --- a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings @@ -507,3 +507,5 @@ "report.title" = "Meld post"; "report.action.send" = "Verstuur"; "status.action.report" = "Meld post"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings index f91c8ac2..b2c8d4f4 100644 --- a/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings @@ -502,3 +502,5 @@ "report.title" = "Zgłoszenie postu"; "report.action.send" = "Wyślij"; "status.action.report" = "Zgłoś post"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings index ac35ae00..43e4cb66 100644 --- a/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings @@ -510,3 +510,5 @@ "report.title" = "Reportar Postagem"; "report.action.send" = "Enviar"; "status.action.report" = "Repostar Postagem"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings index e8c89ae8..ef60af63 100644 --- a/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings @@ -510,3 +510,5 @@ "report.title" = "Report Post"; "report.action.send" = "Send"; "status.action.report" = "Report Post"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/IceCubesApp/Resources/Localization/uk.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/uk.lproj/Localizable.strings index 04a2736d..9ef86d58 100644 --- a/IceCubesApp/Resources/Localization/uk.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/uk.lproj/Localizable.strings @@ -512,3 +512,5 @@ "report.action.send" = "Надіслати"; "status.action.report" = "Поскаржитися на допис"; +"tag.suggested.mentions-%@" = "%@ mentions"; + diff --git a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings index ac755969..7ee1e37b 100644 --- a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings @@ -512,3 +512,5 @@ "report.title" = "举报嘟文"; "report.action.send" = "发送"; "status.action.report" = "举报嘟文"; + +"tag.suggested.mentions-%@" = "%@ mentions"; diff --git a/Packages/Status/Sources/Status/Editor/Components/StatusEditorAutoCompleteView.swift b/Packages/Status/Sources/Status/Editor/Components/StatusEditorAutoCompleteView.swift index 3720e24c..4e72ca0f 100644 --- a/Packages/Status/Sources/Status/Editor/Components/StatusEditorAutoCompleteView.swift +++ b/Packages/Status/Sources/Status/Editor/Components/StatusEditorAutoCompleteView.swift @@ -51,9 +51,14 @@ struct StatusEditorAutoCompleteView: View { Button { viewModel.selectHashtagSuggestion(tag: tag) } label: { - Text("#\(tag.name)") - .font(.scaledCaption) - .foregroundColor(theme.tintColor) + VStack(alignment: .leading) { + Text("#\(tag.name)") + .font(.scaledFootnote) + .foregroundColor(theme.tintColor) + Text("tag.suggested.mentions-\(String(tag.totalUses))") + .font(.scaledCaption) + .foregroundColor(.gray) + } } } } diff --git a/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift b/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift index 0a633898..323eed30 100644 --- a/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift +++ b/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift @@ -445,7 +445,7 @@ public class StatusEditorViewModel: NSObject, ObservableObject { following: nil), forceVersion: .v2) withAnimation { - tagsSuggestions = results?.hashtags ?? [] + tagsSuggestions = results?.hashtags.sorted(by: { $0.totalUses > $1.totalUses }) ?? [] } case "@": query.removeFirst()