parent
2cc819af46
commit
aa87a3f7fe
|
@ -420,3 +420,5 @@ proc toActivityCenterNotification*(jsonNotification: JsonNode): ActivityCenterNo
|
|||
|
||||
if jsonNotification.contains("message") and jsonNotification{"message"}.kind != JNull:
|
||||
result.message = jsonNotification{"message"}.toMessage()
|
||||
elif activityCenterNotificationType == ActivityCenterNotificationType.NewOneToOne and jsonNotification.contains("lastMessage") and jsonNotification{"lastMessage"}.kind != JNull:
|
||||
result.message = jsonNotification{"lastMessage"}.toMessage()
|
|
@ -155,7 +155,8 @@ Popup {
|
|||
width: parent.width
|
||||
sourceComponent: {
|
||||
switch (model.notificationType) {
|
||||
case Constants.activityCenterNotificationTypeMention:return messageNotificationComponent
|
||||
case Constants.activityCenterNotificationTypeOneToOne:
|
||||
case Constants.activityCenterNotificationTypeMention:
|
||||
case Constants.activityCenterNotificationTypeReply: return messageNotificationComponent
|
||||
case Constants.activityCenterNotificationTypeGroupRequest: return groupRequestNotificationComponent
|
||||
default: return null
|
||||
|
|
|
@ -2,10 +2,13 @@ import QtQuick 2.13
|
|||
import "../../../../../imports"
|
||||
import "../../../../../shared"
|
||||
import "../../../../../shared/status"
|
||||
import "../../components"
|
||||
import ".."
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
visible: {
|
||||
if (hideReadNotifications && model.read) {
|
||||
return false
|
||||
|
@ -13,11 +16,20 @@ Item {
|
|||
|
||||
return activityCenter.currentFilter === ActivityCenter.Filter.All ||
|
||||
(model.notificationType === Constants.activityCenterNotificationTypeMention && activityCenter.currentFilter === ActivityCenter.Filter.Mentions) ||
|
||||
(model.notificationType === Constants.activityCenterNotificationTypeOneToOne && activityCenter.currentFilter === ActivityCenter.Filter.ContactRequests) ||
|
||||
(model.notificationType === Constants.activityCenterNotificationTypeReply && activityCenter.currentFilter === ActivityCenter.Filter.Replies)
|
||||
}
|
||||
width: parent.width
|
||||
height: visible ? messageNotificationContent.height : 0
|
||||
|
||||
function openProfile() {
|
||||
const pk = model.author
|
||||
const userProfileImage = appMain.getProfileImage(pk)
|
||||
openProfilePopup(chatsModel.userNameOrAlias(pk), pk, userProfileImage || utilsModel.generateIdenticon(pk))
|
||||
}
|
||||
|
||||
Component {
|
||||
id: markReadBtnComponent
|
||||
StatusIconButton {
|
||||
id: markReadBtn
|
||||
icon.name: "double-check"
|
||||
|
@ -27,20 +39,45 @@ Item {
|
|||
width: 32
|
||||
height: 32
|
||||
onClicked: chatsModel.activityNotificationList.markActivityCenterNotificationRead(model.id)
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.verticalCenter: messageNotificationContent.verticalCenter
|
||||
z: 52
|
||||
|
||||
StatusToolTip {
|
||||
visible: markReadBtn.hovered
|
||||
//% "Mark as Read"
|
||||
text: qsTrId("mark-as-read")
|
||||
text: qsTr("Mark as Read")
|
||||
orientation: "left"
|
||||
x: - width - Style.current.padding
|
||||
y: markReadBtn.height / 2 - height / 2 + 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Component {
|
||||
id: acceptRejectComponent
|
||||
AcceptRejectOptionsButtons {
|
||||
id: buttons
|
||||
onAcceptClicked: {
|
||||
profileModel.contacts.addContact(model.author)
|
||||
chatsModel.activityNotificationList.acceptActivityCenterNotification(model.id)
|
||||
}
|
||||
onDeclineClicked: chatsModel.activityNotificationList.dismissActivityCenterNotification(model.id)
|
||||
onProfileClicked: root.openProfile()
|
||||
onBlockClicked: {
|
||||
const pk = model.author
|
||||
blockContactConfirmationDialog.contactName = chatsModel.userNameOrAlias(pk)
|
||||
blockContactConfirmationDialog.contactAddress = pk
|
||||
blockContactConfirmationDialog.open()
|
||||
}
|
||||
|
||||
BlockContactConfirmationDialog {
|
||||
id: blockContactConfirmationDialog
|
||||
onBlockButtonClicked: {
|
||||
profileModel.contacts.blockContact(blockContactConfirmationDialog.contactAddress)
|
||||
chatsModel.activityNotificationList.dismissActivityCenterNotification(model.id)
|
||||
blockContactConfirmationDialog.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: messageNotificationContent
|
||||
|
@ -96,16 +133,34 @@ Item {
|
|||
}
|
||||
|
||||
Rectangle {
|
||||
id: bottomBackdrop
|
||||
visible: badge.visible
|
||||
anchors.top: notificationMessage.bottom
|
||||
anchors.bottom: badge.bottom
|
||||
anchors.bottomMargin: -Style.current.smallPadding
|
||||
anchors.bottomMargin: visible ? -Style.current.smallPadding : 0
|
||||
width: parent.width
|
||||
color: model.read ? Style.current.transparent : Utils.setColorAlpha(Style.current.blue, 0.1)
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: true
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.bottom: notificationMessage.bottom
|
||||
anchors.bottomMargin: 14
|
||||
z: 52
|
||||
|
||||
sourceComponent: {
|
||||
if (model.notificationType === Constants.activityCenterNotificationTypeOneToOne) {
|
||||
return acceptRejectComponent
|
||||
}
|
||||
return markReadBtnComponent
|
||||
}
|
||||
}
|
||||
|
||||
ActivityChannelBadge {
|
||||
id: badge
|
||||
visible: model.notificationType !== Constants.activityCenterNotificationTypeOneToOne
|
||||
name: model.name
|
||||
chatId: model.chatId
|
||||
notificationType: model.notificationType
|
||||
|
|
|
@ -25,7 +25,7 @@ Rectangle {
|
|||
property string profileImage: realChatType === Constants.chatTypeOneToOne ? appMain.getProfileImage(chatId) || "" : ""
|
||||
|
||||
id: wrapper
|
||||
height: 24
|
||||
height: visible ? 24 : 0
|
||||
width: childrenRect.width + 12
|
||||
color: Style.current.transparent
|
||||
border.color: Style.current.borderSecondary
|
||||
|
|
|
@ -18,6 +18,7 @@ QtObject {
|
|||
readonly property int communityChatOnRequestAccess: 3
|
||||
|
||||
|
||||
readonly property int activityCenterNotificationTypeOneToOne: 1
|
||||
readonly property int activityCenterNotificationTypeGroupRequest: 2
|
||||
readonly property int activityCenterNotificationTypeMention: 3
|
||||
readonly property int activityCenterNotificationTypeReply: 4
|
||||
|
|
Loading…
Reference in New Issue