Implement channel stories views / reactions.

This commit is contained in:
John Preston
2023-09-13 10:30:16 +04:00
parent 1c2951598b
commit f3db7e636b
15 changed files with 247 additions and 53 deletions

View File

@@ -937,6 +937,10 @@ ShortenedCount FormatCountToShort(int64 number) {
return result;
}
QString FormatCountDecimal(int64 number) {
return QString("%L1").arg(number);
}
PluralResult Plural(
ushort keyBase,
float64 value,
@@ -973,7 +977,7 @@ PluralResult Plural(
if (type == lt_count_short) {
return { shift, shortened.string };
} else if (type == lt_count_decimal) {
return { shift, QString("%L1").arg(round) };
return { shift, FormatCountDecimal(round) };
}
return { shift, QString::number(round) };
}

View File

@@ -14,13 +14,16 @@ namespace Lang {
inline constexpr auto kTextCommandLangTag = 0x20;
constexpr auto kTagReplacementSize = 4;
int FindTagReplacementPosition(const QString &original, ushort tag);
[[nodiscard]] int FindTagReplacementPosition(
const QString &original,
ushort tag);
struct ShortenedCount {
int64 number = 0;
QString string;
};
ShortenedCount FormatCountToShort(int64 number);
[[nodiscard]] ShortenedCount FormatCountToShort(int64 number);
[[nodiscard]] QString FormatCountDecimal(int64 number);
struct PluralResult {
int keyShift = 0;