parent
2cc819af46
commit
aa87a3f7fe
|
@ -420,3 +420,5 @@ proc toActivityCenterNotification*(jsonNotification: JsonNode): ActivityCenterNo
|
||||||
|
|
||||||
if jsonNotification.contains("message") and jsonNotification{"message"}.kind != JNull:
|
if jsonNotification.contains("message") and jsonNotification{"message"}.kind != JNull:
|
||||||
result.message = jsonNotification{"message"}.toMessage()
|
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
|
width: parent.width
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
switch (model.notificationType) {
|
switch (model.notificationType) {
|
||||||
case Constants.activityCenterNotificationTypeMention:return messageNotificationComponent
|
case Constants.activityCenterNotificationTypeOneToOne:
|
||||||
|
case Constants.activityCenterNotificationTypeMention:
|
||||||
case Constants.activityCenterNotificationTypeReply: return messageNotificationComponent
|
case Constants.activityCenterNotificationTypeReply: return messageNotificationComponent
|
||||||
case Constants.activityCenterNotificationTypeGroupRequest: return groupRequestNotificationComponent
|
case Constants.activityCenterNotificationTypeGroupRequest: return groupRequestNotificationComponent
|
||||||
default: return null
|
default: return null
|
||||||
|
|
|
@ -2,10 +2,13 @@ import QtQuick 2.13
|
||||||
import "../../../../../imports"
|
import "../../../../../imports"
|
||||||
import "../../../../../shared"
|
import "../../../../../shared"
|
||||||
import "../../../../../shared/status"
|
import "../../../../../shared/status"
|
||||||
|
import "../../components"
|
||||||
import ".."
|
import ".."
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
visible: {
|
visible: {
|
||||||
if (hideReadNotifications && model.read) {
|
if (hideReadNotifications && model.read) {
|
||||||
return false
|
return false
|
||||||
|
@ -13,11 +16,20 @@ Item {
|
||||||
|
|
||||||
return activityCenter.currentFilter === ActivityCenter.Filter.All ||
|
return activityCenter.currentFilter === ActivityCenter.Filter.All ||
|
||||||
(model.notificationType === Constants.activityCenterNotificationTypeMention && activityCenter.currentFilter === ActivityCenter.Filter.Mentions) ||
|
(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)
|
(model.notificationType === Constants.activityCenterNotificationTypeReply && activityCenter.currentFilter === ActivityCenter.Filter.Replies)
|
||||||
}
|
}
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: visible ? messageNotificationContent.height : 0
|
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 {
|
StatusIconButton {
|
||||||
id: markReadBtn
|
id: markReadBtn
|
||||||
icon.name: "double-check"
|
icon.name: "double-check"
|
||||||
|
@ -27,20 +39,45 @@ Item {
|
||||||
width: 32
|
width: 32
|
||||||
height: 32
|
height: 32
|
||||||
onClicked: chatsModel.activityNotificationList.markActivityCenterNotificationRead(model.id)
|
onClicked: chatsModel.activityNotificationList.markActivityCenterNotificationRead(model.id)
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: 12
|
|
||||||
anchors.verticalCenter: messageNotificationContent.verticalCenter
|
|
||||||
z: 52
|
|
||||||
|
|
||||||
StatusToolTip {
|
StatusToolTip {
|
||||||
visible: markReadBtn.hovered
|
visible: markReadBtn.hovered
|
||||||
//% "Mark as Read"
|
text: qsTr("Mark as Read")
|
||||||
text: qsTrId("mark-as-read")
|
|
||||||
orientation: "left"
|
orientation: "left"
|
||||||
x: - width - Style.current.padding
|
x: - width - Style.current.padding
|
||||||
y: markReadBtn.height / 2 - height / 2 + 4
|
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 {
|
Item {
|
||||||
id: messageNotificationContent
|
id: messageNotificationContent
|
||||||
|
@ -96,16 +133,34 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
id: bottomBackdrop
|
||||||
|
visible: badge.visible
|
||||||
anchors.top: notificationMessage.bottom
|
anchors.top: notificationMessage.bottom
|
||||||
anchors.bottom: badge.bottom
|
anchors.bottom: badge.bottom
|
||||||
anchors.bottomMargin: -Style.current.smallPadding
|
anchors.bottomMargin: visible ? -Style.current.smallPadding : 0
|
||||||
width: parent.width
|
width: parent.width
|
||||||
color: model.read ? Style.current.transparent : Utils.setColorAlpha(Style.current.blue, 0.1)
|
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 {
|
ActivityChannelBadge {
|
||||||
id: badge
|
id: badge
|
||||||
|
visible: model.notificationType !== Constants.activityCenterNotificationTypeOneToOne
|
||||||
name: model.name
|
name: model.name
|
||||||
chatId: model.chatId
|
chatId: model.chatId
|
||||||
notificationType: model.notificationType
|
notificationType: model.notificationType
|
||||||
|
|
|
@ -25,7 +25,7 @@ Rectangle {
|
||||||
property string profileImage: realChatType === Constants.chatTypeOneToOne ? appMain.getProfileImage(chatId) || "" : ""
|
property string profileImage: realChatType === Constants.chatTypeOneToOne ? appMain.getProfileImage(chatId) || "" : ""
|
||||||
|
|
||||||
id: wrapper
|
id: wrapper
|
||||||
height: 24
|
height: visible ? 24 : 0
|
||||||
width: childrenRect.width + 12
|
width: childrenRect.width + 12
|
||||||
color: Style.current.transparent
|
color: Style.current.transparent
|
||||||
border.color: Style.current.borderSecondary
|
border.color: Style.current.borderSecondary
|
||||||
|
|
|
@ -18,6 +18,7 @@ QtObject {
|
||||||
readonly property int communityChatOnRequestAccess: 3
|
readonly property int communityChatOnRequestAccess: 3
|
||||||
|
|
||||||
|
|
||||||
|
readonly property int activityCenterNotificationTypeOneToOne: 1
|
||||||
readonly property int activityCenterNotificationTypeGroupRequest: 2
|
readonly property int activityCenterNotificationTypeGroupRequest: 2
|
||||||
readonly property int activityCenterNotificationTypeMention: 3
|
readonly property int activityCenterNotificationTypeMention: 3
|
||||||
readonly property int activityCenterNotificationTypeReply: 4
|
readonly property int activityCenterNotificationTypeReply: 4
|
||||||
|
|
Loading…
Reference in New Issue