status-desktop/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChannelIdentifier.qml

146 lines
5.3 KiB
QML
Raw Normal View History

import QtQuick 2.3
import "../../../../../shared"
import "../../../../../imports"
2021-01-25 20:01:00 +00:00
Column {
property string authorCurrentMsg: "authorCurrentMsg"
2020-11-30 17:03:52 +00:00
property string profileImage
id: channelIdentifier
2021-01-25 20:01:00 +00:00
spacing: Style.current.padding
2020-11-30 17:03:52 +00:00
visible: authorCurrentMsg === ""
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: this.visible ? Style.current.bigPadding : 0
Rectangle {
id: circleId
anchors.horizontalCenter: parent.horizontalCenter
width: 120
height: 120
radius: 120
border.width: chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne ? 2 : 0
border.color: Style.current.border
color: {
if (chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne) {
return Style.current.transparent
}
2021-03-02 20:43:32 +00:00
if (chatsModel.activeChannel.color) {
return chatsModel.activeChannel.color
}
const color = chatsModel.getChannelColor(chatId)
if (!color) {
return Style.current.orange
}
return color
}
2020-11-30 17:03:52 +00:00
RoundedImage {
visible: chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: 120
height: 120
2020-11-30 17:03:52 +00:00
source: channelIdentifier.profileImage || chatsModel.activeChannel.identicon
smooth: false
antialiasing: true
}
StyledText {
visible: chatsModel.activeChannel.chatType !== Constants.chatTypeOneToOne
text: Utils.removeStatusEns((chatsModel.activeChannel.name.charAt(0) === "#" ? chatsModel.activeChannel.name.charAt(1) : chatsModel.activeChannel.name.charAt(0)).toUpperCase())
opacity: 0.7
font.weight: Font.Bold
font.pixelSize: 51
color: Style.current.white
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
StyledText {
id: channelName
wrapMode: Text.Wrap
text: {
switch(chatsModel.activeChannel.chatType) {
case Constants.chatTypePublic: return "#" + chatsModel.activeChannel.name;
case Constants.chatTypeOneToOne: return Utils.removeStatusEns(chatsModel.userNameOrAlias(chatsModel.activeChannel.id))
default: return chatsModel.activeChannel.name
}
}
font.weight: Font.Bold
font.pixelSize: 22
2020-07-17 11:36:36 +00:00
color: Style.current.textColor
anchors.horizontalCenter: parent.horizontalCenter
}
StyledText {
id: descText
wrapMode: Text.Wrap
anchors.horizontalCenter: parent.horizontalCenter
width: 310
text: {
switch(chatsModel.activeChannel.chatType) {
//% "Welcome to the beginning of the <span style='color: %1'>%2</span> group!"
case Constants.chatTypePrivateGroupChat: return qsTrId("welcome-to-the-beginning-of-the--span-style--color---1---2--span--group-").arg(Style.current.textColor).arg(chatsModel.activeChannel.name);
//% "Any messages you send here are encrypted and can only be read by you and <span style='color: %1'>%2</span>"
case Constants.chatTypeOneToOne: return qsTrId("any-messages-you-send-here-are-encrypted-and-can-only-be-read-by-you-and--span-style--color---1---2--span-").arg(Style.current.textColor).arg(channelName.text)
default: return "";
}
}
font.pixelSize: Style.current.primaryTextFontSize
color: Style.current.secondaryText
horizontalAlignment: Text.AlignHCenter
textFormat: Text.RichText
}
Item {
fix: kick and re-invite user to group chat Fixes: #2601. Kicking a user and re-inviting them now correctly redisplays the join/decline options. Other combinations of User B leaving or declining an invitation are not handled. Please see the notes below for clarification. Additionally, the group invite popup (that shows the list of members belonging to the group) correctly shows when a user is kicked or when a user leaves the group in real time. Previously, the popup needed to be reopened to display this. fix: decline invitation crash Declining a group invitation was crashing the app. This has been fixed. ### NOTES 1. In the case where User A invites User B to a group, but User B declines (or User B joins, then leaves), then from a status-go standpoint, User B is still part of the group, but the chat is marked as `active: false` for User B. This creates a situation where User B cannot re-join the group once s/he has declined the invitation. @cammellos mentioned there possibly will need to be a refactor of https://github.com/status-im/status-go/blob/cab6281dc520c24912de5b5226b42a2f8415aa40/protocol/messenger.go#L1710 (which, by retaining User B as a member, effectively prevents the re-invitation) once “swipe to delete” is implemented on mobile. There is an activity center notification received for User B that is meant to allow re-joining of the group when the notification is accepted. The activity center notification received from status-go looks like the following: ```json "activityCenterNotifications": [ { "id": "0x0e342d33", "chatId": "e342d33f-dd05-4d7b-b14e-b5335e1a3ee9-0x043bf46aa874c377a34946eab67a32cf36c15907b328216dfce375d169fed7d81c21cada3229db1fd37c762d2c02702111a646657feca6621e2e948febcf378fb4", "name": "test-22", "type": 2, "lastMessage": null, "message": null, "timestamp": 1623305612000, "read": false, "dismissed": false, "accepted": false } ] ```
2021-06-10 07:29:05 +00:00
visible: chatsModel.activeChannel.chatType === Constants.chatTypePrivateGroupChat && chatsModel.activeChannel.isMemberButNotJoined
2020-09-18 13:11:51 +00:00
anchors.horizontalCenter: parent.horizontalCenter
width: visible ? joinChat.width : 0
height: visible ? 100 : 0
id: joinOrDecline
StyledText {
id: joinChat
//% "Join chat"
text: qsTrId("join-chat")
font.pixelSize: 20
color: Style.current.blue
anchors.horizontalCenter: parent.horizontalCenter
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: {
chatsModel.groups.join()
}
}
}
StyledText {
//% "Decline invitation"
text: qsTrId("group-chat-decline-invitation")
font.pixelSize: 20
color: Style.current.blue
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: joinChat.bottom
anchors.topMargin: Style.current.padding
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: {
chatsModel.leaveActiveChat()
}
}
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;formeditorZoom:0.5;height:480;width:640}
}
##^##*/