Add verification badge to verified chats
This commit is contained in:
parent
0241817678
commit
38165c4f67
4 changed files with 63 additions and 13 deletions
26
images/icon-verified.svg
Normal file
26
images/icon-verified.svg
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
width="32px"
|
||||
height="32px"
|
||||
viewBox="0 0 32 32"
|
||||
style="enable-background:new 0 0 32 32;"
|
||||
xml:space="preserve"
|
||||
inkscape:version="0.92.4 (unknown)"
|
||||
sodipodi:docname="icon-verified.svg">
|
||||
<rect
|
||||
style="opacity:0;fill:#ffffff;"
|
||||
width="32"
|
||||
height="32"/>
|
||||
<path
|
||||
style="opacity:1;fill:#039be5;fill-opacity:1;stroke:#ffffff;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers fill stroke"
|
||||
d="m 16,0.5 c -2.139766,0 -2.562241,3.72027517 -4.539128,4.53912797 -1.9776441,0.8191667 -4.908136,-1.5136233 -6.4217591,0 -1.5136231,1.513623 0.819167,4.4441148 0,6.4217592 C 4.2202751,13.437745 0.5,13.86022 0.5,16 c 0,2.139765 3.7202751,2.562242 4.5391279,4.539127 0.819167,1.977644 -1.513623,4.908137 0,6.421759 1.5136231,1.513623 4.444115,-0.819166 6.4217591,0 1.976887,0.818854 2.4,4.539128 4.539128,4.539128 2.139766,0 2.562242,-3.720274 4.539128,-4.539128 1.977643,-0.819166 4.908136,1.513623 6.421759,0 1.513622,-1.513622 -0.819166,-4.444115 0,-6.421759 0.818854,-1.976885 4.539128,-2.4 4.539128,-4.539127 0,-2.139766 -3.720274,-2.562241 -4.539128,-4.539128 -0.819166,-1.9776444 1.513622,-4.9081362 0,-6.4217592 -1.513623,-1.5136232 -4.444116,0.8191667 -6.421759,0 C 18.562257,4.220246 18.139781,0.5 16,0.5 Z"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="sssssssssssssssss"/>
|
||||
<path
|
||||
style="fill:#ffffff;"
|
||||
d="M15.611,17.738c-0.389,0.389-1.025,0.389-1.415,0l-3.164-3.163c-0.389-0.389-1.025-0.389-1.414,0 L8.62,15.574c-0.389,0.389-0.389,1.025,0,1.414l3.164,3.164c0.389,0.389,1.025,1.025,1.414,1.414l0.277,0.277 c0.765,0.766,1.935,0.924,2.885-0.026l0.25-0.25c0.389-0.389,1.025-1.025,1.414-1.414l6.075-6.075c0.389-0.389,0.389-1.025,0-1.414 l-1-1c-0.389-0.389-1.025-0.389-1.414,0L15.611,17.738z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2 KiB |
|
@ -3,7 +3,6 @@ import Sailfish.Silica 1.0
|
|||
import WerkWolf.Fernschreiber 1.0
|
||||
|
||||
ListItem {
|
||||
|
||||
id: chatListViewItem
|
||||
|
||||
property alias primaryText: primaryText //usually chat name
|
||||
|
@ -13,13 +12,12 @@ ListItem {
|
|||
|
||||
property int unreadCount: 0
|
||||
property bool isSecret: false
|
||||
property bool isVerified: false
|
||||
property alias pictureThumbnail: pictureThumbnail
|
||||
|
||||
contentHeight: mainRow.height + separator.height + 2 * Theme.paddingMedium
|
||||
contentWidth: parent.width
|
||||
|
||||
|
||||
|
||||
Column {
|
||||
id: mainColumn
|
||||
width: parent.width - ( 2 * Theme.horizontalPageMargin )
|
||||
|
@ -31,7 +29,6 @@ ListItem {
|
|||
|
||||
Row {
|
||||
id: mainRow
|
||||
width: parent.width
|
||||
height: contentColumn.height
|
||||
spacing: Theme.paddingMedium
|
||||
|
||||
|
@ -42,7 +39,6 @@ ListItem {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Item {
|
||||
id: chatListPictureItem
|
||||
width: parent.width
|
||||
height: parent.width
|
||||
|
||||
|
@ -96,19 +92,33 @@ ListItem {
|
|||
|
||||
Column {
|
||||
id: contentColumn
|
||||
width: parent.width * 5 / 6 - Theme.horizontalPageMargin
|
||||
width: mainColumn.width - pictureColumn.width - mainRow.spacing
|
||||
spacing: Theme.paddingSmall
|
||||
|
||||
Row {
|
||||
id: primaryTextRow
|
||||
spacing: Theme.paddingMedium
|
||||
|
||||
Label {
|
||||
id: primaryText
|
||||
textFormat: Text.StyledText
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
truncationMode: TruncationMode.Fade
|
||||
width: parent.width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Math.min(contentColumn.width - (verifiedImage.visible ? (verifiedImage.width + primaryTextRow.spacing) : 0), implicitWidth)
|
||||
}
|
||||
|
||||
Image {
|
||||
id: verifiedImage
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
source: chatListViewItem.isVerified ? "../../images/icon-verified.svg" : ""
|
||||
sourceSize.width: Theme.iconSizeExtraSmall
|
||||
width: Theme.iconSizeExtraSmall
|
||||
visible: status === Image.Ready
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: additionalTextRow
|
||||
width: parent.width
|
||||
spacing: Theme.paddingSmall
|
||||
Label {
|
||||
|
|
|
@ -249,6 +249,7 @@ Page {
|
|||
model: chatListModel
|
||||
delegate: ChatListViewItem {
|
||||
ownUserId: overviewPage.ownUserId
|
||||
isVerified: is_verified
|
||||
|
||||
onClicked: {
|
||||
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), {
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace {
|
|||
const QString LAST_READ_OUTBOX_MESSAGE_ID("last_read_outbox_message_id");
|
||||
const QString SENDING_STATE("sending_state");
|
||||
const QString IS_CHANNEL("is_channel");
|
||||
const QString IS_VERIFIED("is_verified");
|
||||
const QString PINNED_MESSAGE_ID("pinned_message_id");
|
||||
const QString _TYPE("@type");
|
||||
const QString SECRET_CHAT_ID("secret_chat_id");
|
||||
|
@ -66,6 +67,7 @@ public:
|
|||
RoleLastMessageStatus,
|
||||
RoleChatMemberStatus,
|
||||
RoleSecretChatState,
|
||||
RoleIsVerified,
|
||||
RoleIsChannel
|
||||
};
|
||||
|
||||
|
@ -95,6 +97,7 @@ public:
|
|||
qlonglong chatId;
|
||||
qlonglong order;
|
||||
qlonglong groupId;
|
||||
bool verified;
|
||||
TDLibWrapper::ChatType chatType;
|
||||
TDLibWrapper::ChatMemberStatus memberStatus;
|
||||
TDLibWrapper::SecretChatState secretChatState;
|
||||
|
@ -106,6 +109,7 @@ ChatListModel::ChatData::ChatData(const QVariantMap &data, const QVariantMap &us
|
|||
chatId(data.value(ID).toLongLong()),
|
||||
order(data.value(ORDER).toLongLong()),
|
||||
groupId(0),
|
||||
verified(false),
|
||||
memberStatus(TDLibWrapper::ChatMemberStatusUnknown),
|
||||
secretChatState(TDLibWrapper::SecretChatStateUnknown),
|
||||
userInformation(userInfo)
|
||||
|
@ -293,6 +297,13 @@ QVector<int> ChatListModel::ChatData::updateGroup(const TDLibWrapper::Group *gro
|
|||
memberStatus = groupMemberStatus;
|
||||
changedRoles.append(RoleChatMemberStatus);
|
||||
}
|
||||
// There's no "is_verified" in "basic_group" but that's ok since
|
||||
// it naturally becomes false
|
||||
const bool groupIsVerified = group->groupInfo.value(IS_VERIFIED).toBool();
|
||||
if (verified != groupIsVerified) {
|
||||
verified = groupIsVerified;
|
||||
changedRoles.append(RoleIsVerified);
|
||||
}
|
||||
}
|
||||
return changedRoles;
|
||||
}
|
||||
|
@ -357,6 +368,7 @@ QHash<int,QByteArray> ChatListModel::roleNames() const
|
|||
roles.insert(ChatData::RoleLastMessageStatus, "last_message_status");
|
||||
roles.insert(ChatData::RoleChatMemberStatus, "chat_member_status");
|
||||
roles.insert(ChatData::RoleSecretChatState, "secret_chat_state");
|
||||
roles.insert(ChatData::RoleIsVerified, "is_verified");
|
||||
roles.insert(ChatData::RoleIsChannel, "is_channel");
|
||||
return roles;
|
||||
}
|
||||
|
@ -385,6 +397,7 @@ QVariant ChatListModel::data(const QModelIndex &index, int role) const
|
|||
case ChatData::RoleLastMessageStatus: return data->senderMessageStatus();
|
||||
case ChatData::RoleChatMemberStatus: return data->memberStatus;
|
||||
case ChatData::RoleSecretChatState: return data->secretChatState;
|
||||
case ChatData::RoleIsVerified: return data->verified;
|
||||
case ChatData::RoleIsChannel: return data->isChannel();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue