2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-10-03 13:26:03 +00:00

Added animation of send action for stickers to middle of text.

This commit is contained in:
23rd
2021-08-30 20:38:11 +03:00
parent 8c17e3e578
commit 436212bb88
8 changed files with 93 additions and 9 deletions

View File

@@ -303,6 +303,7 @@ void Instance::reset(const Language &data) {
_values[i] = GetOriginalValue(ushort(i));
}
ranges::fill(_nonDefaultSet, 0);
updateSupportChoosingStickerReplacement();
_idChanges.fire_copy(_id);
}
@@ -548,6 +549,7 @@ void Instance::fillFromSerialized(
applyValue(nonDefaultStrings[i], nonDefaultStrings[i + 1]);
}
updatePluralRules();
updateSupportChoosingStickerReplacement();
_idChanges.fire_copy(_id);
}
@@ -572,6 +574,7 @@ void Instance::fillFromCustomContent(
_pluralId = PluralCodeForCustom(absolutePath, relativePath);
_name = _nativeName = QString();
loadFromCustomContent(absolutePath, relativePath, content);
updateSupportChoosingStickerReplacement();
_idChanges.fire_copy(_id);
}
@@ -602,6 +605,20 @@ bool Instance::loadFromCustomFile(const QString &filePath) {
return false;
}
void Instance::updateSupportChoosingStickerReplacement() {
// A language changing in the runtime is not supported.
const auto phrase = tr::lng_send_action_choose_sticker(tr::now);
const auto first = phrase.indexOf(kChoosingStickerReplacement.utf8());
const auto last = phrase.lastIndexOf(kChoosingStickerReplacement.utf8());
_supportChoosingStickerReplacement = (first == last)
? (first != -1)
: false;
}
bool Instance::supportChoosingStickerReplacement() const {
return _supportChoosingStickerReplacement;
}
// SetCallback takes two QByteArrays: key, value.
// It is called for all key-value pairs in string.
// ResetCallback takes one QByteArray: key.