Fix ephemeral start

This commit is contained in:
Julien Wadel 2021-08-17 18:20:54 +02:00
parent d2f4a43d92
commit 029fba05e0
3 changed files with 8 additions and 3 deletions

View file

@ -415,6 +415,10 @@ qint64 ChatMessageModel::getEphemeralExpireTime() const{
//return QDateTime::fromMSecsSinceEpoch(mChatMessage->getEphemeralExpireTime() * 1000)
}
long ChatMessageModel::getEphemeralLifetime() const{
return mChatMessage->getEphemeralLifetime();
}
LinphoneEnums::ChatMessageState ChatMessageModel::getState() const{
return LinphoneEnums::fromLinphone(mChatMessage->getState());
}

View file

@ -142,6 +142,7 @@ public:
Q_PROPERTY(bool isEphemeral READ isEphemeral NOTIFY isEphemeralChanged)
Q_PROPERTY(qint64 ephemeralExpireTime READ getEphemeralExpireTime NOTIFY ephemeralExpireTimeChanged)
Q_PROPERTY(long ephemeralLifetime READ getEphemeralLifetime CONSTANT)
Q_PROPERTY(LinphoneEnums::ChatMessageState state READ getState NOTIFY stateChanged)
Q_PROPERTY(bool isOutgoing READ isOutgoing NOTIFY isOutgoingChanged)
@ -167,6 +168,7 @@ public:
ContactModel * getContactModel() const;
bool isEphemeral() const;
Q_INVOKABLE qint64 getEphemeralExpireTime() const;
Q_INVOKABLE long getEphemeralLifetime() const;
LinphoneEnums::ChatMessageState getState() const;
bool isOutgoing() const;
ContentModel * getFileContentModel() const;

View file

@ -56,15 +56,14 @@ Item {
visible:$chatEntry.isEphemeral
spacing:5
Text{
visible : $chatEntry.ephemeralExpireTime > 0
text: Utils.formatElapsedTime($chatEntry.ephemeralExpireTime)
text: $chatEntry.ephemeralExpireTime > 0 ? Utils.formatElapsedTime($chatEntry.ephemeralExpireTime) : Utils.formatElapsedTime($chatEntry.ephemeralLifetime)
color:"#FF5E00"
font.pointSize: Units.dp * 8
Timer{
running:parent.visible
interval: 1000
repeat:true
onTriggered: parent.text = Utils.formatElapsedTime($chatEntry.getEphemeralExpireTime())// Use the function
onTriggered: if($chatEntry.getEphemeralExpireTime() > 0 ) parent.text = Utils.formatElapsedTime($chatEntry.getEphemeralExpireTime())// Use the function
}
}
Icon{