Use updated membersTyping functions from libquotient
This commit is contained in:
committed by
Tobias Fella
parent
bae9f39719
commit
607b6bcef0
@@ -257,23 +257,6 @@ void NeoChatRoom::forget()
|
||||
connection()->forgetRoom(id());
|
||||
}
|
||||
|
||||
QVariantList NeoChatRoom::getUsersTyping() const
|
||||
{
|
||||
auto members = membersTyping();
|
||||
members.removeAll(localMember());
|
||||
QVariantList userVariants;
|
||||
for (const auto &member : members) {
|
||||
if (connection()->isIgnored(member.id())) {
|
||||
continue;
|
||||
}
|
||||
userVariants.append(QVariantMap{
|
||||
{"id"_ls, member.id()},
|
||||
{"displayName"_ls, member.displayName()},
|
||||
});
|
||||
}
|
||||
return userVariants;
|
||||
}
|
||||
|
||||
void NeoChatRoom::sendTypingNotification(bool isTyping)
|
||||
{
|
||||
connection()->callApi<SetTypingJob>(BackgroundRequest, localMember().id(), id(), isTyping, 10000);
|
||||
|
||||
@@ -40,27 +40,6 @@ class NeoChatRoom : public Quotient::Room
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
|
||||
/**
|
||||
* @brief A list of users currently typing in the room.
|
||||
*
|
||||
* The list does not include the local user.
|
||||
*
|
||||
* This is different to getting a list of Quotient::User objects
|
||||
* as neither of those can provide details like the displayName or avatarMediaId
|
||||
* without the room context as these can vary from room to room. This function
|
||||
* provides the room context and puts the result as a list of QVariantMap objects.
|
||||
*
|
||||
* @return a QVariantMap for the user with the following
|
||||
* parameters:
|
||||
* - id - User ID.
|
||||
* - avatarMediaId - Avatar id in the context of this room.
|
||||
* - displayName - Display name in the context of this room.
|
||||
* - display - Name in the context of this room.
|
||||
*
|
||||
* @sa Quotient::User
|
||||
*/
|
||||
Q_PROPERTY(QVariantList usersTyping READ getUsersTyping NOTIFY typingChanged)
|
||||
|
||||
/**
|
||||
* @brief Convenience function to get the QDateTime of the last event.
|
||||
*
|
||||
@@ -235,8 +214,6 @@ public:
|
||||
|
||||
explicit NeoChatRoom(Quotient::Connection *connection, QString roomId, Quotient::JoinState joinState = {});
|
||||
|
||||
[[nodiscard]] QVariantList getUsersTyping() const;
|
||||
|
||||
[[nodiscard]] QDateTime lastActiveTime();
|
||||
|
||||
/**
|
||||
|
||||
@@ -263,8 +263,8 @@ QQC2.ScrollView {
|
||||
|
||||
TypingPane {
|
||||
id: typingPane
|
||||
visible: root.currentRoom && root.currentRoom.usersTyping.length > 0
|
||||
labelText: visible ? i18ncp("Message displayed when some users are typing", "%2 is typing", "%2 are typing", root.currentRoom.usersTyping.length, root.currentRoom.usersTyping.map(user => user.displayName).join(", ")) : ""
|
||||
visible: root.currentRoom && root.currentRoom.otherMembersTyping.length > 0
|
||||
labelText: visible ? i18ncp("Message displayed when some users are typing", "%2 is typing", "%2 are typing", root.currentRoom.otherMembersTyping.length, root.currentRoom.otherMembersTyping.map(member => member.displayName).join(", ")) : ""
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
height: visible ? implicitHeight : 0
|
||||
|
||||
Reference in New Issue
Block a user