Support for animated emoji

This commit is contained in:
Sebastian Wolf 2021-12-04 22:05:22 +01:00
parent 88d385ab0d
commit 0400d12e52
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
23 changed files with 146 additions and 5 deletions

View file

@ -93,6 +93,7 @@ DISTFILES += qml/harbour-fernschreiber.qml \
qml/components/inlineQueryResults/InlineQueryResultVenue.qml \
qml/components/inlineQueryResults/InlineQueryResultVideo.qml \
qml/components/inlineQueryResults/InlineQueryResultVoiceNote.qml \
qml/components/messageContent/MessageAnimatedEmoji.qml \
qml/components/messageContent/MessageAnimation.qml \
qml/components/messageContent/MessageAudio.qml \
qml/components/messageContent/MessageContentBase.qml \

View file

@ -0,0 +1,27 @@
/*
Copyright (C) 2020-21 Sebastian J. Wolf and other contributors
This file is part of Fernschreiber.
Fernschreiber is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import WerkWolf.Fernschreiber 1.0
import "../"
import "../../js/twemoji.js" as Emoji
MessageSticker {
stickerData: messageListItem ? messageListItem.myMessage.content.animated_emoji.sticker : overlayFlickable.overlayMessage.content.animated_emoji.sticker;
}

View file

@ -25,7 +25,7 @@ import "../../js/twemoji.js" as Emoji
MessageContentBase {
id: thisItem
readonly property var stickerData: messageListItem ? messageListItem.myMessage.content.sticker : overlayFlickable.overlayMessage.content.sticker;
property var stickerData: messageListItem ? messageListItem.myMessage.content.sticker : overlayFlickable.overlayMessage.content.sticker;
readonly property bool asEmoji: appSettings.showStickersAsEmojis
readonly property bool animated: stickerData.is_animated && appSettings.animateStickers
readonly property bool stickerVisible: staticStickerLoader.item ? staticStickerLoader.item.visible :
@ -44,6 +44,7 @@ MessageContentBase {
}
Item {
width: Math.min( stickerData.width, parent.width )
height: width * aspectRatio
// (centered in image mode, text-like in sticker mode)

View file

@ -45,6 +45,8 @@ function getMessageText(message, simple, currentUserId, ignoreEntities) {
}
case 'messageSticker':
return simple ? qsTr("Sticker: %1").arg(message.content.sticker.emoji) : "";
case 'messageAnimatedEmoji':
return simple ? qsTr("Animated Emoji: %1").arg(message.content.animated_emoji.sticker.emoji) : "";
case 'messagePhoto':
if (message.content.caption.text !== "") {
return simple ? qsTr("Picture: %1").arg(message.content.caption.text) : enhanceMessageText(message.content.caption, ignoreEntities)

View file

@ -59,7 +59,7 @@ Page {
}
Label {
text: "Fernschreiber 0.10.1"
text: "Fernschreiber 0.11"
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraLarge
anchors {

View file

@ -1220,6 +1220,8 @@ Page {
function getContentComponentHeight(contentType, content, parentWidth) {
switch(contentType) {
case "messageAnimatedEmoji":
return content.animated_emoji.sticker.height;
case "messageAnimation":
return Functions.getVideoHeight(parentWidth, content.animation);
case "messageAudio":
@ -1247,6 +1249,7 @@ Page {
}
readonly property var delegateMessagesContent: [
"messageAnimatedEmoji",
"messageAnimation",
"messageAudio",
// "messageContact",

View file

@ -11,7 +11,7 @@ Name: harbour-fernschreiber
# << macros
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.10.1
Version: 0.11
Release: 1
Group: Qt/Qt
License: LICENSE

View file

@ -1,6 +1,6 @@
Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.10.1
Version: 0.11
Release: 1
# The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS

View file

@ -93,6 +93,9 @@ QString FernschreiberUtils::getMessageShortText(TDLibWrapper *tdLibWrapper, cons
if (contentType == "messageSticker") {
return tr("Sticker: %1").arg(messageContent.value("sticker").toMap().value("emoji").toString());
}
if (contentType == "messageAnimatedEmoji") {
return tr("Animated Emoji: %1").arg(messageContent.value("animated_emoji").toMap().value("sticker").toMap().value("emoji").toString());
}
if (contentType == "messagePhoto") {
return myself ? tr("sent a picture", "myself") : tr("sent a picture");
}

View file

@ -1853,7 +1853,7 @@ void TDLibWrapper::setInitialParameters()
QSettings hardwareSettings("/etc/hw-release", QSettings::NativeFormat);
initialParameters.insert("device_model", hardwareSettings.value("NAME", "Unknown Mobile Device").toString());
initialParameters.insert("system_version", QSysInfo::prettyProductName());
initialParameters.insert("application_version", "0.10.1");
initialParameters.insert("application_version", "0.11");
initialParameters.insert("enable_storage_optimizer", appSettings->storageOptimizer());
// initialParameters.insert("use_test_dc", true);
requestObject.insert("parameters", initialParameters);

View file

@ -934,6 +934,10 @@
<source>sent a video note</source>
<translation>hat eine Videonachricht geschickt</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation>Animiertes Emoji: %1</translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2255,5 +2259,9 @@
<source>sent a game</source>
<translation>hat ein Spiel gesendet</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation>Animiertes Emoji: %1</translation>
</message>
</context>
</TS>

View file

@ -936,6 +936,10 @@ messages</numerusform>
<source>sent a video note</source>
<translation>sent a video note</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation>Animated Emoji: %1</translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2257,5 +2261,9 @@ messages</numerusform>
<source>sent a game</source>
<translation>sent a game</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation>Animated Emoji: %1</translation>
</message>
</context>
</TS>

View file

@ -934,6 +934,10 @@
<source>sent a video note</source>
<translation>envió una nota de video</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2255,5 +2259,9 @@
<source>sent a game</source>
<translation>envió un juego</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -935,6 +935,10 @@
<source>sent a video note</source>
<translation>lähetti videoviestin</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2256,5 +2260,9 @@
<source>sent a game</source>
<translation>lähetti pelin</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -934,6 +934,10 @@
<source>sent a video note</source>
<translation>a envoyé une note vidéo</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2255,5 +2259,9 @@
<source>sent a game</source>
<translation>a envoyé un jeu</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -920,6 +920,10 @@
<source>sent a video note</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2227,5 +2231,9 @@
<source>sent a game</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -934,6 +934,10 @@
<source>sent a video note</source>
<translation>ha inviato un videomessaggio</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2255,5 +2259,9 @@
<source>sent a game</source>
<translation>ha inviato un gioco</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -948,6 +948,10 @@
<source>sent a video note</source>
<translation>wysłał notatkę video</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2283,5 +2287,9 @@
<source>sent a game</source>
<translation>wysłał grę</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -951,6 +951,10 @@
<source>sent a video note</source>
<translation>отправил(а) видео заметку</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2286,5 +2290,9 @@
<source>sent a game</source>
<translation>отправил(а) игру</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -948,6 +948,10 @@
<source>sent a video note</source>
<translation>poslal video-poznámku</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2283,5 +2287,9 @@
<source>sent a game</source>
<translation>poslal hru</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -934,6 +934,10 @@
<source>sent a video note</source>
<translation>skickade ett videomeddelande</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2255,5 +2259,9 @@
<source>sent a game</source>
<translation>skickade ett spel</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -921,6 +921,10 @@
<source>sent a video note</source>
<translation></translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2228,5 +2232,9 @@
<source>sent a game</source>
<translation></translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -934,6 +934,10 @@
<source>sent a video note</source>
<translation type="unfinished">sent a video note</translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImagePage</name>
@ -2255,5 +2259,9 @@
<source>sent a game</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Animated Emoji: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>