perf(chatScroll): Avoid calling the backend on delegate creation/binding
Provide the needed data from the nim model directly to the delegate. This way whenever a delegate needs to display the data it doesn't need to reach the backend. perf(chatScroll): Fix comments on Avoid calling the backend on delegate creation/binding perf(chatScroll): Avoid calling the backend on delegate creation/binding - add TODO comment on senderColorHash default perf(chatScroll): merge quotedMessageAuthor details perf(chatScroll): Fix nim tests perf(chatScroll): Fix merge error - messages_model.nim
This commit is contained in:
parent
15fe97c90c
commit
bf1d59c0ad
|
@ -75,6 +75,13 @@ proc createMessageItemFromDto(self: Module, message: MessageDto, chatDetails: Ch
|
||||||
let contactDetails = self.controller.getContactDetails(message.`from`)
|
let contactDetails = self.controller.getContactDetails(message.`from`)
|
||||||
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
|
||||||
|
var quotedMessageAuthorDetails = ContactDetails()
|
||||||
|
if message.quotedMessage.`from` != "":
|
||||||
|
if(message.`from` == message.quotedMessage.`from`):
|
||||||
|
quotedMessageAuthorDetails = contactDetails
|
||||||
|
else:
|
||||||
|
quotedMessageAuthorDetails = self.controller.getContactDetails(message.quotedMessage.`from`)
|
||||||
|
|
||||||
return msg_item_qobj.newMessageItem(msg_item.initItem(
|
return msg_item_qobj.newMessageItem(msg_item.initItem(
|
||||||
message.id,
|
message.id,
|
||||||
chatDetails.communityId, # we don't received community id via `activityCenterNotifications` api call
|
chatDetails.communityId, # we don't received community id via `activityCenterNotifications` api call
|
||||||
|
@ -83,6 +90,7 @@ proc createMessageItemFromDto(self: Module, message: MessageDto, chatDetails: Ch
|
||||||
contactDetails.defaultDisplayName,
|
contactDetails.defaultDisplayName,
|
||||||
contactDetails.optionalName,
|
contactDetails.optionalName,
|
||||||
contactDetails.icon,
|
contactDetails.icon,
|
||||||
|
contactDetails.colorHash,
|
||||||
contactDetails.isCurrentUser,
|
contactDetails.isCurrentUser,
|
||||||
contactDetails.details.added,
|
contactDetails.details.added,
|
||||||
message.outgoingStatus,
|
message.outgoingStatus,
|
||||||
|
@ -112,6 +120,7 @@ proc createMessageItemFromDto(self: Module, message: MessageDto, chatDetails: Ch
|
||||||
message.quotedMessage.contentType,
|
message.quotedMessage.contentType,
|
||||||
message.quotedMessage.deleted,
|
message.quotedMessage.deleted,
|
||||||
message.quotedMessage.discordMessage,
|
message.quotedMessage.discordMessage,
|
||||||
|
quotedMessageAuthorDetails
|
||||||
))
|
))
|
||||||
|
|
||||||
method convertToItems*(
|
method convertToItems*(
|
||||||
|
|
|
@ -86,6 +86,7 @@ proc createFetchMoreMessagesItem(self: Module): Item =
|
||||||
senderDisplayName = "",
|
senderDisplayName = "",
|
||||||
senderOptionalName = "",
|
senderOptionalName = "",
|
||||||
senderIcon = "",
|
senderIcon = "",
|
||||||
|
senderColorHash = "",
|
||||||
amISender = false,
|
amISender = false,
|
||||||
senderIsAdded = false,
|
senderIsAdded = false,
|
||||||
outgoingStatus = "",
|
outgoingStatus = "",
|
||||||
|
@ -115,6 +116,7 @@ proc createFetchMoreMessagesItem(self: Module): Item =
|
||||||
quotedMessageContentType = -1,
|
quotedMessageContentType = -1,
|
||||||
quotedMessageDeleted = false,
|
quotedMessageDeleted = false,
|
||||||
quotedMessageDiscordMessage = DiscordMessage(),
|
quotedMessageDiscordMessage = DiscordMessage(),
|
||||||
|
quotedMessageAuthorDetails = ContactDetails()
|
||||||
)
|
)
|
||||||
|
|
||||||
proc createChatIdentifierItem(self: Module): Item =
|
proc createChatIdentifierItem(self: Module): Item =
|
||||||
|
@ -122,11 +124,13 @@ proc createChatIdentifierItem(self: Module): Item =
|
||||||
var chatName = chatDto.name
|
var chatName = chatDto.name
|
||||||
var smallImage = ""
|
var smallImage = ""
|
||||||
var chatIcon = ""
|
var chatIcon = ""
|
||||||
|
var senderColorHash = ""
|
||||||
var senderIsAdded = false
|
var senderIsAdded = false
|
||||||
if(chatDto.chatType == ChatType.OneToOne):
|
if(chatDto.chatType == ChatType.OneToOne):
|
||||||
let sender = self.controller.getContactDetails(chatDto.id)
|
let sender = self.controller.getContactDetails(chatDto.id)
|
||||||
senderIsAdded = sender.details.added
|
senderIsAdded = sender.details.added
|
||||||
(chatName, smallImage, chatIcon) = self.controller.getOneToOneChatNameAndImage()
|
(chatName, smallImage, chatIcon) = self.controller.getOneToOneChatNameAndImage()
|
||||||
|
senderColorHash = sender.colorHash
|
||||||
|
|
||||||
result = initItem(
|
result = initItem(
|
||||||
CHAT_IDENTIFIER_MESSAGE_ID,
|
CHAT_IDENTIFIER_MESSAGE_ID,
|
||||||
|
@ -136,6 +140,7 @@ proc createChatIdentifierItem(self: Module): Item =
|
||||||
senderDisplayName = chatName,
|
senderDisplayName = chatName,
|
||||||
senderOptionalName = "",
|
senderOptionalName = "",
|
||||||
senderIcon = chatIcon,
|
senderIcon = chatIcon,
|
||||||
|
senderColorHash = senderColorHash,
|
||||||
amISender = false,
|
amISender = false,
|
||||||
senderIsAdded,
|
senderIsAdded,
|
||||||
outgoingStatus = "",
|
outgoingStatus = "",
|
||||||
|
@ -165,6 +170,7 @@ proc createChatIdentifierItem(self: Module): Item =
|
||||||
quotedMessageContentType = -1,
|
quotedMessageContentType = -1,
|
||||||
quotedMessageDeleted = false,
|
quotedMessageDeleted = false,
|
||||||
quotedMessageDiscordMessage = DiscordMessage(),
|
quotedMessageDiscordMessage = DiscordMessage(),
|
||||||
|
quotedMessageAuthorDetails = ContactDetails()
|
||||||
)
|
)
|
||||||
|
|
||||||
proc checkIfMessageLoadedAndScrollToItIfItIs(self: Module) =
|
proc checkIfMessageLoadedAndScrollToItIfItIs(self: Module) =
|
||||||
|
@ -199,11 +205,17 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
|
||||||
# Now we just skip deleted messages
|
# Now we just skip deleted messages
|
||||||
if message.deleted or message.deletedForMe:
|
if message.deleted or message.deletedForMe:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
let sender = self.controller.getContactDetails(message.`from`)
|
|
||||||
let chatDetails = self.controller.getChatDetails()
|
let chatDetails = self.controller.getChatDetails()
|
||||||
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
|
||||||
|
let sender = self.controller.getContactDetails(message.`from`)
|
||||||
|
var quotedMessageAuthorDetails = ContactDetails()
|
||||||
|
if message.quotedMessage.`from` != "":
|
||||||
|
if(message.`from` == message.quotedMessage.`from`):
|
||||||
|
quotedMessageAuthorDetails = sender
|
||||||
|
else:
|
||||||
|
quotedMessageAuthorDetails = self.controller.getContactDetails(message.quotedMessage.`from`)
|
||||||
|
|
||||||
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
||||||
var transactionContract = message.transactionParameters.contract
|
var transactionContract = message.transactionParameters.contract
|
||||||
var transactionValue = message.transactionParameters.value
|
var transactionValue = message.transactionParameters.value
|
||||||
|
@ -220,6 +232,7 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
|
||||||
sender.defaultDisplayName,
|
sender.defaultDisplayName,
|
||||||
sender.optionalName,
|
sender.optionalName,
|
||||||
sender.icon,
|
sender.icon,
|
||||||
|
sender.colorHash,
|
||||||
(isCurrentUser and message.contentType.ContentType != ContentType.DiscordMessage),
|
(isCurrentUser and message.contentType.ContentType != ContentType.DiscordMessage),
|
||||||
sender.details.added,
|
sender.details.added,
|
||||||
message.outgoingStatus,
|
message.outgoingStatus,
|
||||||
|
@ -256,6 +269,7 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
|
||||||
message.quotedMessage.contentType,
|
message.quotedMessage.contentType,
|
||||||
message.quotedMessage.deleted,
|
message.quotedMessage.deleted,
|
||||||
message.quotedMessage.discordMessage,
|
message.quotedMessage.discordMessage,
|
||||||
|
quotedMessageAuthorDetails
|
||||||
)
|
)
|
||||||
|
|
||||||
for r in reactions:
|
for r in reactions:
|
||||||
|
@ -305,6 +319,12 @@ method messagesAdded*(self: Module, messages: seq[MessageDto]) =
|
||||||
let sender = self.controller.getContactDetails(message.`from`)
|
let sender = self.controller.getContactDetails(message.`from`)
|
||||||
let chatDetails = self.controller.getChatDetails()
|
let chatDetails = self.controller.getChatDetails()
|
||||||
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
var quotedMessageAuthorDetails = ContactDetails()
|
||||||
|
if message.quotedMessage.`from` != "":
|
||||||
|
if(message.`from` == message.quotedMessage.`from`):
|
||||||
|
quotedMessageAuthorDetails = sender
|
||||||
|
else:
|
||||||
|
quotedMessageAuthorDetails = self.controller.getContactDetails(message.quotedMessage.`from`)
|
||||||
|
|
||||||
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
||||||
|
|
||||||
|
@ -333,6 +353,7 @@ method messagesAdded*(self: Module, messages: seq[MessageDto]) =
|
||||||
sender.defaultDisplayName,
|
sender.defaultDisplayName,
|
||||||
sender.optionalName,
|
sender.optionalName,
|
||||||
sender.icon,
|
sender.icon,
|
||||||
|
sender.colorHash,
|
||||||
(isCurrentUser and message.contentType.ContentType != ContentType.DiscordMessage),
|
(isCurrentUser and message.contentType.ContentType != ContentType.DiscordMessage),
|
||||||
sender.details.added,
|
sender.details.added,
|
||||||
message.outgoingStatus,
|
message.outgoingStatus,
|
||||||
|
@ -369,6 +390,7 @@ method messagesAdded*(self: Module, messages: seq[MessageDto]) =
|
||||||
message.quotedMessage.contentType,
|
message.quotedMessage.contentType,
|
||||||
message.quotedMessage.deleted,
|
message.quotedMessage.deleted,
|
||||||
message.quotedMessage.discordMessage,
|
message.quotedMessage.discordMessage,
|
||||||
|
quotedMessageAuthorDetails,
|
||||||
)
|
)
|
||||||
items.add(item)
|
items.add(item)
|
||||||
|
|
||||||
|
@ -499,9 +521,12 @@ method updateContactDetails*(self: Module, contactId: string) =
|
||||||
item.senderDisplayName = updatedContact.defaultDisplayName
|
item.senderDisplayName = updatedContact.defaultDisplayName
|
||||||
item.senderOptionalName = updatedContact.optionalName
|
item.senderOptionalName = updatedContact.optionalName
|
||||||
item.senderIcon = updatedContact.icon
|
item.senderIcon = updatedContact.icon
|
||||||
|
item.senderColorHash = updatedContact.colorHash
|
||||||
item.senderIsAdded = updatedContact.details.added
|
item.senderIsAdded = updatedContact.details.added
|
||||||
item.senderTrustStatus = updatedContact.details.trustStatus
|
item.senderTrustStatus = updatedContact.details.trustStatus
|
||||||
item.senderEnsVerified = updatedContact.details.ensVerified
|
item.senderEnsVerified = updatedContact.details.ensVerified
|
||||||
|
if(item.quotedMessageAuthorDetails.details.id == contactId):
|
||||||
|
item.quotedMessageAuthorDetails = updatedContact
|
||||||
if(item.messageContainsMentions):
|
if(item.messageContainsMentions):
|
||||||
let (message, _, err) = self.controller.getMessageDetails(item.id)
|
let (message, _, err) = self.controller.getMessageDetails(item.id)
|
||||||
if(err.len == 0):
|
if(err.len == 0):
|
||||||
|
@ -615,6 +640,13 @@ method getMessageById*(self: Module, messageId: string): message_item.Item =
|
||||||
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
|
||||||
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
||||||
|
var quotedMessageAuthorDetails = ContactDetails()
|
||||||
|
if message.quotedMessage.`from` != "":
|
||||||
|
if(message.`from` == message.quotedMessage.`from`):
|
||||||
|
quotedMessageAuthorDetails = sender
|
||||||
|
else:
|
||||||
|
quotedMessageAuthorDetails = self.controller.getContactDetails(message.quotedMessage.`from`)
|
||||||
|
|
||||||
var transactionContract = message.transactionParameters.contract
|
var transactionContract = message.transactionParameters.contract
|
||||||
var transactionValue = message.transactionParameters.value
|
var transactionValue = message.transactionParameters.value
|
||||||
var isCurrentUser = sender.isCurrentUser
|
var isCurrentUser = sender.isCurrentUser
|
||||||
|
@ -630,6 +662,7 @@ method getMessageById*(self: Module, messageId: string): message_item.Item =
|
||||||
sender.defaultDisplayName,
|
sender.defaultDisplayName,
|
||||||
sender.optionalName,
|
sender.optionalName,
|
||||||
sender.icon,
|
sender.icon,
|
||||||
|
sender.colorHash,
|
||||||
(isCurrentUser and message.contentType.ContentType != ContentType.DiscordMessage),
|
(isCurrentUser and message.contentType.ContentType != ContentType.DiscordMessage),
|
||||||
sender.details.added,
|
sender.details.added,
|
||||||
message.outgoingStatus,
|
message.outgoingStatus,
|
||||||
|
@ -665,7 +698,8 @@ method getMessageById*(self: Module, messageId: string): message_item.Item =
|
||||||
self.controller.getRenderedText(message.quotedMessage.parsedText, communityChats),
|
self.controller.getRenderedText(message.quotedMessage.parsedText, communityChats),
|
||||||
message.quotedMessage.contentType,
|
message.quotedMessage.contentType,
|
||||||
message.quotedMessage.deleted,
|
message.quotedMessage.deleted,
|
||||||
message.quotedMessage.discordMessage
|
message.quotedMessage.discordMessage,
|
||||||
|
quotedMessageAuthorDetails,
|
||||||
)
|
)
|
||||||
return item
|
return item
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -157,6 +157,12 @@ proc buildPinnedMessageItem(self: Module, messageId: string, actionInitiatedBy:
|
||||||
let contactDetails = self.controller.getContactDetails(message.`from`)
|
let contactDetails = self.controller.getContactDetails(message.`from`)
|
||||||
let chatDetails = self.controller.getChatDetails()
|
let chatDetails = self.controller.getChatDetails()
|
||||||
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
var quotedMessageAuthorDetails = ContactDetails()
|
||||||
|
if message.quotedMessage.`from` != "":
|
||||||
|
if(message.`from` == message.quotedMessage.`from`):
|
||||||
|
quotedMessageAuthorDetails = contactDetails
|
||||||
|
else:
|
||||||
|
quotedMessageAuthorDetails = self.controller.getContactDetails(message.quotedMessage.`from`)
|
||||||
|
|
||||||
var transactionContract = message.transactionParameters.contract
|
var transactionContract = message.transactionParameters.contract
|
||||||
var transactionValue = message.transactionParameters.value
|
var transactionValue = message.transactionParameters.value
|
||||||
|
@ -173,6 +179,7 @@ proc buildPinnedMessageItem(self: Module, messageId: string, actionInitiatedBy:
|
||||||
contactDetails.defaultDisplayName,
|
contactDetails.defaultDisplayName,
|
||||||
contactDetails.optionalName,
|
contactDetails.optionalName,
|
||||||
contactDetails.icon,
|
contactDetails.icon,
|
||||||
|
contactDetails.colorHash,
|
||||||
isCurrentUser,
|
isCurrentUser,
|
||||||
contactDetails.details.added,
|
contactDetails.details.added,
|
||||||
message.outgoingStatus,
|
message.outgoingStatus,
|
||||||
|
@ -209,6 +216,7 @@ proc buildPinnedMessageItem(self: Module, messageId: string, actionInitiatedBy:
|
||||||
message.quotedMessage.contentType,
|
message.quotedMessage.contentType,
|
||||||
message.quotedMessage.deleted,
|
message.quotedMessage.deleted,
|
||||||
message.quotedMessage.discordMessage,
|
message.quotedMessage.discordMessage,
|
||||||
|
quotedMessageAuthorDetails
|
||||||
)
|
)
|
||||||
item.pinned = true
|
item.pinned = true
|
||||||
item.pinnedBy = actionInitiatedBy
|
item.pinnedBy = actionInitiatedBy
|
||||||
|
|
|
@ -81,6 +81,7 @@ method onNewMessagesLoaded*(self: Module, messages: seq[MessageDto]) =
|
||||||
alias = contactDetails.details.alias,
|
alias = contactDetails.details.alias,
|
||||||
icon = contactDetails.icon,
|
icon = contactDetails.icon,
|
||||||
colorId = contactDetails.colorId,
|
colorId = contactDetails.colorId,
|
||||||
|
colorHash = contactDetails.colorHash,
|
||||||
onlineStatus = status,
|
onlineStatus = status,
|
||||||
isContact = contactDetails.details.isContact,
|
isContact = contactDetails.details.isContact,
|
||||||
isVerified = contactDetails.details.isContactVerified(),
|
isVerified = contactDetails.details.isContactVerified(),
|
||||||
|
@ -153,6 +154,7 @@ method addChatMember*(self: Module, member: ChatMember) =
|
||||||
alias = contactDetails.details.alias,
|
alias = contactDetails.details.alias,
|
||||||
icon = contactDetails.icon,
|
icon = contactDetails.icon,
|
||||||
colorId = contactDetails.colorId,
|
colorId = contactDetails.colorId,
|
||||||
|
colorHash = contactDetails.colorHash,
|
||||||
onlineStatus = status,
|
onlineStatus = status,
|
||||||
isContact = contactDetails.details.isContact,
|
isContact = contactDetails.details.isContact,
|
||||||
isVerified = contactDetails.details.isContactVerified(),
|
isVerified = contactDetails.details.isContactVerified(),
|
||||||
|
|
|
@ -93,6 +93,7 @@ proc createMemberItem(self: Module, memberId, requestId: string): MemberItem =
|
||||||
alias = contactDetails.details.alias,
|
alias = contactDetails.details.alias,
|
||||||
icon = contactDetails.icon,
|
icon = contactDetails.icon,
|
||||||
colorId = contactDetails.colorId,
|
colorId = contactDetails.colorId,
|
||||||
|
colorHash = contactDetails.colorHash,
|
||||||
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(memberId).statusType),
|
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(memberId).statusType),
|
||||||
isContact = contactDetails.details.isContact,
|
isContact = contactDetails.details.isContact,
|
||||||
isVerified = contactDetails.details.isContactVerified(),
|
isVerified = contactDetails.details.isContactVerified(),
|
||||||
|
|
|
@ -267,6 +267,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
|
||||||
alias = contactDetails.details.alias,
|
alias = contactDetails.details.alias,
|
||||||
icon = contactDetails.icon,
|
icon = contactDetails.icon,
|
||||||
colorId = contactDetails.colorId,
|
colorId = contactDetails.colorId,
|
||||||
|
colorHash = contactDetails.colorHash,
|
||||||
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(member.id).statusType),
|
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(member.id).statusType),
|
||||||
isContact = contactDetails.details.isContact,
|
isContact = contactDetails.details.isContact,
|
||||||
isVerified = contactDetails.details.isContactVerified(),
|
isVerified = contactDetails.details.isContactVerified(),
|
||||||
|
@ -292,6 +293,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
|
||||||
alias = contactDetails.details.alias,
|
alias = contactDetails.details.alias,
|
||||||
icon = contactDetails.icon,
|
icon = contactDetails.icon,
|
||||||
colorId = contactDetails.colorId,
|
colorId = contactDetails.colorId,
|
||||||
|
colorHash = contactDetails.colorHash,
|
||||||
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(bannedMemberId).statusType),
|
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(bannedMemberId).statusType),
|
||||||
isContact = contactDetails.details.isContact,
|
isContact = contactDetails.details.isContact,
|
||||||
isVerified = contactDetails.details.isContactVerified()
|
isVerified = contactDetails.details.isContactVerified()
|
||||||
|
@ -307,6 +309,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
|
||||||
alias = contactDetails.details.alias,
|
alias = contactDetails.details.alias,
|
||||||
icon = contactDetails.icon,
|
icon = contactDetails.icon,
|
||||||
colorId = contactDetails.colorId,
|
colorId = contactDetails.colorId,
|
||||||
|
colorHash = contactDetails.colorHash,
|
||||||
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(requestDto.publicKey).statusType),
|
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(requestDto.publicKey).statusType),
|
||||||
isContact = contactDetails.details.isContact,
|
isContact = contactDetails.details.isContact,
|
||||||
isVerified = contactDetails.details.isContactVerified(),
|
isVerified = contactDetails.details.isContactVerified(),
|
||||||
|
@ -323,6 +326,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
|
||||||
alias = contactDetails.details.alias,
|
alias = contactDetails.details.alias,
|
||||||
icon = contactDetails.icon,
|
icon = contactDetails.icon,
|
||||||
colorId = contactDetails.colorId,
|
colorId = contactDetails.colorId,
|
||||||
|
colorHash = contactDetails.colorHash,
|
||||||
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(requestDto.publicKey).statusType),
|
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(requestDto.publicKey).statusType),
|
||||||
isContact = contactDetails.details.isContact,
|
isContact = contactDetails.details.isContact,
|
||||||
isVerified = contactDetails.details.isContactVerified(),
|
isVerified = contactDetails.details.isContactVerified(),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import json, strformat, strutils
|
import json, strformat, strutils
|
||||||
import ../../../app_service/common/types
|
import ../../../app_service/common/types
|
||||||
import ../../../app_service/service/contacts/dto/contacts
|
import ../../../app_service/service/contacts/dto/contact_details
|
||||||
import ../../../app_service/service/message/dto/message
|
import ../../../app_service/service/message/dto/message
|
||||||
|
|
||||||
export types.ContentType
|
export types.ContentType
|
||||||
|
@ -17,6 +17,7 @@ type
|
||||||
amISender: bool
|
amISender: bool
|
||||||
senderIsAdded: bool
|
senderIsAdded: bool
|
||||||
senderIcon: string
|
senderIcon: string
|
||||||
|
senderColorHash: string
|
||||||
seen: bool
|
seen: bool
|
||||||
outgoingStatus: string
|
outgoingStatus: string
|
||||||
messageText: string
|
messageText: string
|
||||||
|
@ -52,8 +53,7 @@ type
|
||||||
quotedMessageDeleted: bool
|
quotedMessageDeleted: bool
|
||||||
quotedMessageAuthorDisplayName: string
|
quotedMessageAuthorDisplayName: string
|
||||||
quotedMessageAuthorAvatar: string
|
quotedMessageAuthorAvatar: string
|
||||||
# This is only used to update the author's details when author's details change
|
quotedMessageAuthorDetails: ContactDetails
|
||||||
quotedMessageFromIterator: int
|
|
||||||
|
|
||||||
proc initItem*(
|
proc initItem*(
|
||||||
id,
|
id,
|
||||||
|
@ -63,6 +63,7 @@ proc initItem*(
|
||||||
senderDisplayName,
|
senderDisplayName,
|
||||||
senderOptionalName,
|
senderOptionalName,
|
||||||
senderIcon: string,
|
senderIcon: string,
|
||||||
|
senderColorHash: string,
|
||||||
amISender: bool,
|
amISender: bool,
|
||||||
senderIsAdded: bool,
|
senderIsAdded: bool,
|
||||||
outgoingStatus,
|
outgoingStatus,
|
||||||
|
@ -92,6 +93,7 @@ proc initItem*(
|
||||||
quotedMessageContentType: int,
|
quotedMessageContentType: int,
|
||||||
quotedMessageDeleted: bool,
|
quotedMessageDeleted: bool,
|
||||||
quotedMessageDiscordMessage: DiscordMessage,
|
quotedMessageDiscordMessage: DiscordMessage,
|
||||||
|
quotedMessageAuthorDetails: ContactDetails,
|
||||||
): Item =
|
): Item =
|
||||||
result = Item()
|
result = Item()
|
||||||
result.id = id
|
result.id = id
|
||||||
|
@ -103,6 +105,7 @@ proc initItem*(
|
||||||
result.amISender = amISender
|
result.amISender = amISender
|
||||||
result.senderIsAdded = senderIsAdded
|
result.senderIsAdded = senderIsAdded
|
||||||
result.senderIcon = senderIcon
|
result.senderIcon = senderIcon
|
||||||
|
result.senderColorHash = senderColorHash
|
||||||
result.seen = seen
|
result.seen = seen
|
||||||
result.outgoingStatus = outgoingStatus
|
result.outgoingStatus = outgoingStatus
|
||||||
result.messageText = if contentType == ContentType.Image : "" else: text
|
result.messageText = if contentType == ContentType.Image : "" else: text
|
||||||
|
@ -135,13 +138,16 @@ proc initItem*(
|
||||||
result.quotedMessageParsedText = quotedMessageParsedText
|
result.quotedMessageParsedText = quotedMessageParsedText
|
||||||
result.quotedMessageContentType = quotedMessageContentType
|
result.quotedMessageContentType = quotedMessageContentType
|
||||||
result.quotedMessageDeleted = quotedMessageDeleted
|
result.quotedMessageDeleted = quotedMessageDeleted
|
||||||
result.quotedMessageFromIterator = 0
|
result.quotedMessageAuthorDetails = quotedMessageAuthorDetails
|
||||||
|
|
||||||
if quotedMessageContentType == ContentType.DiscordMessage.int:
|
if quotedMessageContentType == ContentType.DiscordMessage.int:
|
||||||
result.quotedMessageAuthorDisplayName = quotedMessageDiscordMessage.author.name
|
result.quotedMessageAuthorDisplayName = quotedMessageDiscordMessage.author.name
|
||||||
result.quotedMessageAuthorAvatar = quotedMessageDiscordMessage.author.localUrl
|
result.quotedMessageAuthorAvatar = quotedMessageDiscordMessage.author.localUrl
|
||||||
if result.quotedMessageAuthorAvatar == "":
|
if result.quotedMessageAuthorAvatar == "":
|
||||||
result.quotedMessageAuthorAvatar = quotedMessageDiscordMessage.author.avatarUrl
|
result.quotedMessageAuthorAvatar = quotedMessageDiscordMessage.author.avatarUrl
|
||||||
|
else:
|
||||||
|
result.quotedMessageAuthorDisplayName = quotedMessageAuthorDetails.details.displayName
|
||||||
|
result.quotedMessageAuthorAvatar = quotedMessageAuthorDetails.details.image.thumbnail
|
||||||
|
|
||||||
if contentType == ContentType.DiscordMessage:
|
if contentType == ContentType.DiscordMessage:
|
||||||
|
|
||||||
|
@ -172,6 +178,7 @@ proc initNewMessagesMarkerItem*(clock, timestamp: int64): Item =
|
||||||
senderDisplayName = "",
|
senderDisplayName = "",
|
||||||
senderOptionalName = "",
|
senderOptionalName = "",
|
||||||
senderIcon = "",
|
senderIcon = "",
|
||||||
|
senderColorHash = "",
|
||||||
amISender = false,
|
amISender = false,
|
||||||
senderIsAdded = false,
|
senderIsAdded = false,
|
||||||
outgoingStatus = "",
|
outgoingStatus = "",
|
||||||
|
@ -201,6 +208,7 @@ proc initNewMessagesMarkerItem*(clock, timestamp: int64): Item =
|
||||||
quotedMessageContentType = -1,
|
quotedMessageContentType = -1,
|
||||||
quotedMessageDeleted = false,
|
quotedMessageDeleted = false,
|
||||||
quotedMessageDiscordMessage = DiscordMessage(),
|
quotedMessageDiscordMessage = DiscordMessage(),
|
||||||
|
quotedMessageAuthorDetails = ContactDetails(),
|
||||||
)
|
)
|
||||||
|
|
||||||
proc `$`*(self: Item): string =
|
proc `$`*(self: Item): string =
|
||||||
|
@ -265,6 +273,12 @@ proc senderIcon*(self: Item): string {.inline.} =
|
||||||
proc `senderIcon=`*(self: Item, value: string) {.inline.} =
|
proc `senderIcon=`*(self: Item, value: string) {.inline.} =
|
||||||
self.senderIcon = value
|
self.senderIcon = value
|
||||||
|
|
||||||
|
proc senderColorHash*(self: Item): string {.inline.} =
|
||||||
|
self.senderColorHash
|
||||||
|
|
||||||
|
proc `senderColorHash=`*(self: Item, value: string) {.inline.} =
|
||||||
|
self.senderColorHash = value
|
||||||
|
|
||||||
proc amISender*(self: Item): bool {.inline.} =
|
proc amISender*(self: Item): bool {.inline.} =
|
||||||
self.amISender
|
self.amISender
|
||||||
|
|
||||||
|
@ -403,6 +417,7 @@ proc toJsonNode*(self: Item): JsonNode =
|
||||||
"amISender": self.amISender,
|
"amISender": self.amISender,
|
||||||
"senderIsAdded": self.senderIsAdded,
|
"senderIsAdded": self.senderIsAdded,
|
||||||
"senderIcon": self.senderIcon,
|
"senderIcon": self.senderIcon,
|
||||||
|
"senderColorHash": self.senderColorHash,
|
||||||
"seen": self.seen,
|
"seen": self.seen,
|
||||||
"outgoingStatus": self.outgoingStatus,
|
"outgoingStatus": self.outgoingStatus,
|
||||||
"messageText": self.messageText,
|
"messageText": self.messageText,
|
||||||
|
@ -491,11 +506,6 @@ proc quotedMessageDeleted*(self: Item): bool {.inline.} =
|
||||||
proc `quotedMessageDeleted=`*(self: Item, value: bool) {.inline.} =
|
proc `quotedMessageDeleted=`*(self: Item, value: bool) {.inline.} =
|
||||||
self.quotedMessageDeleted = value
|
self.quotedMessageDeleted = value
|
||||||
|
|
||||||
proc quotedMessageFromIterator*(self: Item): int {.inline.} =
|
|
||||||
self.quotedMessageFromIterator
|
|
||||||
proc `quotedMessageFromIterator=`*(self: Item, value: int) {.inline.} =
|
|
||||||
self.quotedMessageFromIterator = value
|
|
||||||
|
|
||||||
proc quotedMessageAuthorDisplayName*(self: Item): string {.inline.} =
|
proc quotedMessageAuthorDisplayName*(self: Item): string {.inline.} =
|
||||||
self.quotedMessageAuthorDisplayName
|
self.quotedMessageAuthorDisplayName
|
||||||
|
|
||||||
|
@ -507,3 +517,8 @@ proc quotedMessageAuthorAvatar*(self: Item): string {.inline.} =
|
||||||
|
|
||||||
proc `quotedMessageAuthorAvatar=`*(self: Item, value: string) {.inline.} =
|
proc `quotedMessageAuthorAvatar=`*(self: Item, value: string) {.inline.} =
|
||||||
self.quotedMessageAuthorAvatar = value
|
self.quotedMessageAuthorAvatar = value
|
||||||
|
|
||||||
|
proc quotedMessageAuthorDetails*(self: Item): ContactDetails {.inline.} =
|
||||||
|
self.quotedMessageAuthorDetails
|
||||||
|
proc `quotedMessageAuthorDetails=`*(self: Item, value: ContactDetails) {.inline.} =
|
||||||
|
self.quotedMessageAuthorDetails = value
|
||||||
|
|
|
@ -93,6 +93,10 @@ QtObject:
|
||||||
QtProperty[string] senderIcon:
|
QtProperty[string] senderIcon:
|
||||||
read = senderIcon
|
read = senderIcon
|
||||||
|
|
||||||
|
proc senderColorHash*(self: MessageItem): string {.slot.} = result = ?.self.messageItem.senderColorHash
|
||||||
|
QtProperty[string] senderColorHash:
|
||||||
|
read = senderColorHash
|
||||||
|
|
||||||
proc seen*(self: MessageItem): bool {.slot.} = result = ?.self.messageItem.seen
|
proc seen*(self: MessageItem): bool {.slot.} = result = ?.self.messageItem.seen
|
||||||
QtProperty[bool] seen:
|
QtProperty[bool] seen:
|
||||||
read = seen
|
read = seen
|
||||||
|
|
|
@ -3,19 +3,24 @@ import NimQml, Tables, json, sets, algorithm, sequtils, strutils, strformat, sug
|
||||||
import message_item, message_reaction_item, message_transaction_parameters_item
|
import message_item, message_reaction_item, message_transaction_parameters_item
|
||||||
|
|
||||||
import ../../../app_service/service/message/dto/message# as message_dto
|
import ../../../app_service/service/message/dto/message# as message_dto
|
||||||
|
import ../../../app_service/service/contacts/dto/contact_details
|
||||||
|
|
||||||
type
|
type
|
||||||
ModelRole {.pure.} = enum
|
ModelRole {.pure.} = enum
|
||||||
Id = UserRole + 1
|
Id = UserRole + 1
|
||||||
PrevMsgTimestamp
|
PrevMsgTimestamp
|
||||||
PrevMsgIndex
|
PrevMsgIndex
|
||||||
|
PrevMsgSenderId
|
||||||
|
PrevMsgContentType
|
||||||
NextMsgIndex
|
NextMsgIndex
|
||||||
|
NextMsgTimestamp
|
||||||
CommunityId
|
CommunityId
|
||||||
ResponseToMessageWithId
|
ResponseToMessageWithId
|
||||||
SenderId
|
SenderId
|
||||||
SenderDisplayName
|
SenderDisplayName
|
||||||
SenderOptionalName
|
SenderOptionalName
|
||||||
SenderIcon
|
SenderIcon
|
||||||
|
SenderColorHash
|
||||||
AmISender
|
AmISender
|
||||||
SenderIsAdded
|
SenderIsAdded
|
||||||
Seen
|
Seen
|
||||||
|
@ -50,9 +55,12 @@ type
|
||||||
QuotedMessageParsedText
|
QuotedMessageParsedText
|
||||||
QuotedMessageContentType
|
QuotedMessageContentType
|
||||||
QuotedMessageDeleted
|
QuotedMessageDeleted
|
||||||
QuotedMessageFromIterator
|
QuotedMessageAuthorName
|
||||||
QuotedMessageAuthorDisplayName
|
QuotedMessageAuthorDisplayName
|
||||||
QuotedMessageAuthorAvatar
|
QuotedMessageAuthorThumbnailImage
|
||||||
|
QuotedMessageAuthorEnsVerified
|
||||||
|
QuotedMessageAuthorIsContact
|
||||||
|
QuotedMessageAuthorColorHash
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type
|
type
|
||||||
|
@ -103,13 +111,17 @@ QtObject:
|
||||||
ModelRole.Id.int:"id",
|
ModelRole.Id.int:"id",
|
||||||
ModelRole.PrevMsgTimestamp.int: "prevMsgTimestamp",
|
ModelRole.PrevMsgTimestamp.int: "prevMsgTimestamp",
|
||||||
ModelRole.PrevMsgIndex.int:"prevMsgIndex",
|
ModelRole.PrevMsgIndex.int:"prevMsgIndex",
|
||||||
|
ModelRole.PrevMsgSenderId.int:"prevMsgSenderId",
|
||||||
|
ModelRole.PrevMsgContentType.int:"prevMsgContentType",
|
||||||
ModelRole.NextMsgIndex.int:"nextMsgIndex",
|
ModelRole.NextMsgIndex.int:"nextMsgIndex",
|
||||||
|
ModelRole.NextMsgTimestamp.int:"nextMsgTimestamp",
|
||||||
ModelRole.CommunityId.int:"communityId",
|
ModelRole.CommunityId.int:"communityId",
|
||||||
ModelRole.ResponseToMessageWithId.int:"responseToMessageWithId",
|
ModelRole.ResponseToMessageWithId.int:"responseToMessageWithId",
|
||||||
ModelRole.SenderId.int:"senderId",
|
ModelRole.SenderId.int:"senderId",
|
||||||
ModelRole.SenderDisplayName.int:"senderDisplayName",
|
ModelRole.SenderDisplayName.int:"senderDisplayName",
|
||||||
ModelRole.SenderOptionalName.int:"senderOptionalName",
|
ModelRole.SenderOptionalName.int:"senderOptionalName",
|
||||||
ModelRole.SenderIcon.int:"senderIcon",
|
ModelRole.SenderIcon.int:"senderIcon",
|
||||||
|
ModelRole.SenderColorHash.int:"senderColorHash",
|
||||||
ModelRole.AmISender.int:"amISender",
|
ModelRole.AmISender.int:"amISender",
|
||||||
ModelRole.SenderIsAdded.int:"senderIsAdded",
|
ModelRole.SenderIsAdded.int:"senderIsAdded",
|
||||||
ModelRole.Seen.int:"seen",
|
ModelRole.Seen.int:"seen",
|
||||||
|
@ -139,13 +151,16 @@ QtObject:
|
||||||
ModelRole.SenderEnsVerified.int: "senderEnsVerified",
|
ModelRole.SenderEnsVerified.int: "senderEnsVerified",
|
||||||
ModelRole.MessageAttachments.int: "messageAttachments",
|
ModelRole.MessageAttachments.int: "messageAttachments",
|
||||||
ModelRole.QuotedMessageFrom.int: "quotedMessageFrom",
|
ModelRole.QuotedMessageFrom.int: "quotedMessageFrom",
|
||||||
ModelRole.QuotedMessageFromIterator.int: "quotedMessageFromIterator",
|
|
||||||
ModelRole.QuotedMessageText.int: "quotedMessageText",
|
ModelRole.QuotedMessageText.int: "quotedMessageText",
|
||||||
ModelRole.QuotedMessageParsedText.int: "quotedMessageParsedText",
|
ModelRole.QuotedMessageParsedText.int: "quotedMessageParsedText",
|
||||||
ModelRole.QuotedMessageContentType.int: "quotedMessageContentType",
|
ModelRole.QuotedMessageContentType.int: "quotedMessageContentType",
|
||||||
ModelRole.QuotedMessageDeleted.int: "quotedMessageDeleted",
|
ModelRole.QuotedMessageDeleted.int: "quotedMessageDeleted",
|
||||||
|
ModelRole.QuotedMessageAuthorName.int: "quotedMessageAuthorName",
|
||||||
ModelRole.QuotedMessageAuthorDisplayName.int: "quotedMessageAuthorDisplayName",
|
ModelRole.QuotedMessageAuthorDisplayName.int: "quotedMessageAuthorDisplayName",
|
||||||
ModelRole.QuotedMessageAuthorAvatar.int: "quotedMessageAuthorAvatar",
|
ModelRole.QuotedMessageAuthorThumbnailImage.int: "quotedMessageAuthorThumbnailImage",
|
||||||
|
ModelRole.QuotedMessageAuthorEnsVerified.int: "quotedMessageAuthorEnsVerified",
|
||||||
|
ModelRole.QuotedMessageAuthorIsContact.int: "quotedMessageAuthorIsContact",
|
||||||
|
ModelRole.QuotedMessageAuthorColorHash.int: "quotedMessageAuthorColorHash",
|
||||||
}.toTable
|
}.toTable
|
||||||
|
|
||||||
method data(self: Model, index: QModelIndex, role: int): QVariant =
|
method data(self: Model, index: QModelIndex, role: int): QVariant =
|
||||||
|
@ -161,16 +176,34 @@ QtObject:
|
||||||
case enumRole:
|
case enumRole:
|
||||||
of ModelRole.Id:
|
of ModelRole.Id:
|
||||||
result = newQVariant(item.id)
|
result = newQVariant(item.id)
|
||||||
of PrevMsgTimestamp:
|
of ModelRole.PrevMsgTimestamp:
|
||||||
if (index.row + 1 < self.items.len):
|
if (index.row + 1 < self.items.len):
|
||||||
let prevItem = self.items[index.row + 1]
|
let prevItem = self.items[index.row + 1]
|
||||||
result = newQVariant(prevItem.timestamp)
|
result = newQVariant(prevItem.timestamp)
|
||||||
else:
|
else:
|
||||||
result = newQVariant(0)
|
result = newQVariant(0)
|
||||||
|
of ModelRole.PrevMsgSenderId:
|
||||||
|
if (index.row + 1 < self.items.len):
|
||||||
|
let prevItem = self.items[index.row + 1]
|
||||||
|
result = newQVariant(prevItem.senderId)
|
||||||
|
else:
|
||||||
|
result = newQVariant("")
|
||||||
|
of ModelRole.PrevMsgContentType:
|
||||||
|
if (index.row + 1 < self.items.len):
|
||||||
|
let prevItem = self.items[index.row + 1]
|
||||||
|
result = newQVariant(prevItem.contentType.int)
|
||||||
|
else:
|
||||||
|
result = newQVariant(ContentType.Unknown.int)
|
||||||
of ModelRole.PrevMsgIndex:
|
of ModelRole.PrevMsgIndex:
|
||||||
result = newQVariant(index.row + 1)
|
result = newQVariant(index.row + 1)
|
||||||
of ModelRole.NextMsgIndex:
|
of ModelRole.NextMsgIndex:
|
||||||
result = newQVariant(index.row - 1)
|
result = newQVariant(index.row - 1)
|
||||||
|
of ModelRole.NextMsgTimestamp:
|
||||||
|
if (index.row - 1 >= 0 and index.row - 1 < self.items.len):
|
||||||
|
let nextItem = self.items[index.row - 1]
|
||||||
|
result = newQVariant(nextItem.timestamp)
|
||||||
|
else:
|
||||||
|
result = newQVariant(0)
|
||||||
of ModelRole.CommunityId:
|
of ModelRole.CommunityId:
|
||||||
result = newQVariant(item.communityId)
|
result = newQVariant(item.communityId)
|
||||||
of ModelRole.ResponseToMessageWithId:
|
of ModelRole.ResponseToMessageWithId:
|
||||||
|
@ -185,6 +218,8 @@ QtObject:
|
||||||
result = newQVariant(item.senderOptionalName)
|
result = newQVariant(item.senderOptionalName)
|
||||||
of ModelRole.SenderIcon:
|
of ModelRole.SenderIcon:
|
||||||
result = newQVariant(item.senderIcon)
|
result = newQVariant(item.senderIcon)
|
||||||
|
of ModelRole.SenderColorHash:
|
||||||
|
result = newQVariant(item.senderColorHash)
|
||||||
of ModelRole.AmISender:
|
of ModelRole.AmISender:
|
||||||
result = newQVariant(item.amISender)
|
result = newQVariant(item.amISender)
|
||||||
of ModelRole.SenderIsAdded:
|
of ModelRole.SenderIsAdded:
|
||||||
|
@ -199,8 +234,6 @@ QtObject:
|
||||||
result = newQVariant(item.mentioned)
|
result = newQVariant(item.mentioned)
|
||||||
of ModelRole.QuotedMessageFrom:
|
of ModelRole.QuotedMessageFrom:
|
||||||
result = newQVariant(item.quotedMessageFrom)
|
result = newQVariant(item.quotedMessageFrom)
|
||||||
of ModelRole.QuotedMessageFromIterator:
|
|
||||||
result = newQVariant(item.quotedMessageFromIterator)
|
|
||||||
of ModelRole.QuotedMessageText:
|
of ModelRole.QuotedMessageText:
|
||||||
result = newQVariant(item.quotedMessageText)
|
result = newQVariant(item.quotedMessageText)
|
||||||
of ModelRole.QuotedMessageParsedText:
|
of ModelRole.QuotedMessageParsedText:
|
||||||
|
@ -209,10 +242,18 @@ QtObject:
|
||||||
result = newQVariant(item.quotedMessageContentType)
|
result = newQVariant(item.quotedMessageContentType)
|
||||||
of ModelRole.QuotedMessageDeleted:
|
of ModelRole.QuotedMessageDeleted:
|
||||||
result = newQVariant(item.quotedMessageDeleted)
|
result = newQVariant(item.quotedMessageDeleted)
|
||||||
|
of ModelRole.QuotedMessageAuthorName:
|
||||||
|
result = newQVariant(item.quotedMessageAuthorDetails.details.name)
|
||||||
of ModelRole.QuotedMessageAuthorDisplayName:
|
of ModelRole.QuotedMessageAuthorDisplayName:
|
||||||
result = newQVariant(item.quotedMessageAuthorDisplayName)
|
result = newQVariant(item.quotedMessageAuthorDisplayName)
|
||||||
of ModelRole.QuotedMessageAuthorAvatar:
|
of ModelRole.QuotedMessageAuthorThumbnailImage:
|
||||||
result = newQVariant(item.quotedMessageAuthorAvatar)
|
result = newQVariant(item.quotedMessageAuthorAvatar)
|
||||||
|
of ModelRole.QuotedMessageAuthorEnsVerified:
|
||||||
|
result = newQVariant(item.quotedMessageAuthorDetails.details.ensVerified)
|
||||||
|
of ModelRole.QuotedMessageAuthorIsContact:
|
||||||
|
result = newQVariant(item.quotedMessageAuthorDetails.details.isContact())
|
||||||
|
of ModelRole.QuotedMessageAuthorColorHash:
|
||||||
|
result = newQVariant(item.quotedMessageAuthorDetails.colorHash)
|
||||||
of ModelRole.MessageText:
|
of ModelRole.MessageText:
|
||||||
result = newQVariant(item.messageText)
|
result = newQVariant(item.messageText)
|
||||||
of ModelRole.UnparsedText:
|
of ModelRole.UnparsedText:
|
||||||
|
@ -310,7 +351,7 @@ QtObject:
|
||||||
self.dataChanged(index, index, @[
|
self.dataChanged(index, index, @[
|
||||||
ModelRole.QuotedMessageFrom.int,
|
ModelRole.QuotedMessageFrom.int,
|
||||||
ModelRole.QuotedMessageAuthorDisplayName.int,
|
ModelRole.QuotedMessageAuthorDisplayName.int,
|
||||||
ModelRole.QuotedMessageAuthorAvatar.int,
|
ModelRole.QuotedMessageAuthorThumbnailImage.int,
|
||||||
ModelRole.QuotedMessageText.int,
|
ModelRole.QuotedMessageText.int,
|
||||||
ModelRole.QuotedMessageParsedText.int,
|
ModelRole.QuotedMessageParsedText.int,
|
||||||
ModelRole.QuotedMessageContentType.int,
|
ModelRole.QuotedMessageContentType.int,
|
||||||
|
@ -372,11 +413,18 @@ QtObject:
|
||||||
item.quotedMessageParsedText = ""
|
item.quotedMessageParsedText = ""
|
||||||
item.quotedMessageFrom = ""
|
item.quotedMessageFrom = ""
|
||||||
item.quotedMessageDeleted = true
|
item.quotedMessageDeleted = true
|
||||||
|
item.quotedMessageAuthorDetails = ContactDetails()
|
||||||
self.dataChanged(ind, ind, @[
|
self.dataChanged(ind, ind, @[
|
||||||
ModelRole.QuotedMessageFrom.int,
|
ModelRole.QuotedMessageFrom.int,
|
||||||
ModelRole.QuotedMessageParsedText.int,
|
ModelRole.QuotedMessageParsedText.int,
|
||||||
ModelRole.QuotedMessageContentType.int,
|
ModelRole.QuotedMessageContentType.int,
|
||||||
ModelRole.QuotedMessageDeleted.int,
|
ModelRole.QuotedMessageDeleted.int,
|
||||||
|
ModelRole.QuotedMessageAuthorName.int,
|
||||||
|
ModelRole.QuotedMessageAuthorDisplayName.int,
|
||||||
|
ModelRole.QuotedMessageAuthorThumbnailImage.int,
|
||||||
|
ModelRole.QuotedMessageAuthorEnsVerified.int,
|
||||||
|
ModelRole.QuotedMessageAuthorIsContact.int,
|
||||||
|
ModelRole.QuotedMessageAuthorColorHash.int
|
||||||
])
|
])
|
||||||
|
|
||||||
proc removeItem*(self: Model, messageId: string) =
|
proc removeItem*(self: Model, messageId: string) =
|
||||||
|
@ -494,6 +542,7 @@ QtObject:
|
||||||
roles = @[ModelRole.SenderDisplayName.int,
|
roles = @[ModelRole.SenderDisplayName.int,
|
||||||
ModelRole.SenderOptionalName.int,
|
ModelRole.SenderOptionalName.int,
|
||||||
ModelRole.SenderIcon.int,
|
ModelRole.SenderIcon.int,
|
||||||
|
ModelRole.SenderColorHash.int,
|
||||||
ModelRole.SenderIsAdded.int,
|
ModelRole.SenderIsAdded.int,
|
||||||
ModelRole.SenderTrustStatus.int,
|
ModelRole.SenderTrustStatus.int,
|
||||||
ModelRole.SenderEnsVerified.int]
|
ModelRole.SenderEnsVerified.int]
|
||||||
|
@ -503,10 +552,12 @@ QtObject:
|
||||||
roles.add(@[ModelRole.MessageText.int, ModelRole.UnparsedText.int, ModelRole.MessageContainsMentions.int])
|
roles.add(@[ModelRole.MessageText.int, ModelRole.UnparsedText.int, ModelRole.MessageContainsMentions.int])
|
||||||
|
|
||||||
if (self.items[i].quotedMessageFrom == contactId):
|
if (self.items[i].quotedMessageFrom == contactId):
|
||||||
# If there is a quoted message whom the author changed, increase the iterator to force
|
roles.add(@[ModelRole.QuotedMessageAuthorName.int,
|
||||||
# the view to re-fetch the author's details
|
ModelRole.QuotedMessageAuthorDisplayName.int,
|
||||||
self.items[i].quotedMessageFromIterator = self.items[i].quotedMessageFromIterator + 1
|
ModelRole.QuotedMessageAuthorThumbnailImage.int,
|
||||||
roles.add(ModelRole.QuotedMessageFromIterator.int)
|
ModelRole.QuotedMessageAuthorEnsVerified.int,
|
||||||
|
ModelRole.QuotedMessageAuthorIsContact.int,
|
||||||
|
ModelRole.QuotedMessageAuthorColorHash.int])
|
||||||
|
|
||||||
if(roles.len > 0):
|
if(roles.len > 0):
|
||||||
let index = self.createIndex(i, 0, nil)
|
let index = self.createIndex(i, 0, nil)
|
||||||
|
|
|
@ -11,4 +11,5 @@ type
|
||||||
icon*: string
|
icon*: string
|
||||||
isCurrentUser*: bool
|
isCurrentUser*: bool
|
||||||
colorId*: int
|
colorId*: int
|
||||||
|
colorHash*: string
|
||||||
details*: ContactsDto
|
details*: ContactsDto
|
||||||
|
|
|
@ -565,6 +565,8 @@ QtObject:
|
||||||
result.colorId = procs_from_visual_identity_service.colorIdOf(pubKey)
|
result.colorId = procs_from_visual_identity_service.colorIdOf(pubKey)
|
||||||
result.isCurrentUser = pubKey == singletonInstance.userProfile.getPubKey()
|
result.isCurrentUser = pubKey == singletonInstance.userProfile.getPubKey()
|
||||||
result.details = contactDto
|
result.details = contactDto
|
||||||
|
if not contactDto.ensVerified:
|
||||||
|
result.colorHash = procs_from_visual_identity_service.getColorHashAsJson(pubKey)
|
||||||
|
|
||||||
proc markUntrustworthy*(self: Service, publicKey: string) =
|
proc markUntrustworthy*(self: Service, publicKey: string) =
|
||||||
let response = status_contacts.markUntrustworthy(publicKey)
|
let response = status_contacts.markUntrustworthy(publicKey)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import ../../../src/app_service/common/types
|
import ../../../src/app_service/common/types
|
||||||
import ../../../src/app_service/service/contacts/dto/contacts
|
import ../../../src/app_service/service/contacts/dto/contact_details
|
||||||
import ../../../src/app_service/service/message/dto/message
|
import ../../../src/app_service/service/message/dto/message
|
||||||
|
|
||||||
import ../../../src/app/modules/shared_models/message_model
|
import ../../../src/app/modules/shared_models/message_model
|
||||||
|
@ -17,6 +17,7 @@ proc createTestMessageItem(id: string, clock: int64): Item =
|
||||||
senderDisplayName = "",
|
senderDisplayName = "",
|
||||||
senderOptionalName = "",
|
senderOptionalName = "",
|
||||||
senderIcon = "",
|
senderIcon = "",
|
||||||
|
senderColorHash = "",
|
||||||
amISender = false,
|
amISender = false,
|
||||||
senderIsAdded = false,
|
senderIsAdded = false,
|
||||||
outgoingStatus = "",
|
outgoingStatus = "",
|
||||||
|
@ -46,6 +47,7 @@ proc createTestMessageItem(id: string, clock: int64): Item =
|
||||||
quotedMessageContentType = -1,
|
quotedMessageContentType = -1,
|
||||||
quotedMessageDeleted = false,
|
quotedMessageDeleted = false,
|
||||||
quotedMessageDiscordMessage = DiscordMessage(),
|
quotedMessageDiscordMessage = DiscordMessage(),
|
||||||
|
quotedMessageAuthorDetails = ContactDetails(),
|
||||||
)
|
)
|
||||||
|
|
||||||
let message0_chatIdentifier = createTestMessageItem("chat-identifier", -2)
|
let message0_chatIdentifier = createTestMessageItem("chat-identifier", -2)
|
||||||
|
|
|
@ -62,7 +62,7 @@ Item {
|
||||||
ringPxSize: 1.5
|
ringPxSize: 1.5
|
||||||
}
|
}
|
||||||
|
|
||||||
visible: settings && settings.ringSpecModel !== undefined
|
visible: settings && typeof settings.normalizedRingSpecModel !== "undefined"
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -79,23 +79,23 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSegmentsCount() {
|
function getSegmentsCount() {
|
||||||
if (typeof settings.ringSpecModel.rowCount !== "undefined") {
|
if (typeof settings.normalizedRingSpecModel.rowCount !== "undefined") {
|
||||||
return settings.ringSpecModel.rowCount()
|
return settings.normalizedRingSpecModel.rowCount()
|
||||||
}
|
}
|
||||||
if (typeof settings.ringSpecModel.count !== "undefined") {
|
if (typeof settings.normalizedRingSpecModel.count !== "undefined") {
|
||||||
return settings.ringSpecModel.count
|
return settings.normalizedRingSpecModel.count
|
||||||
}
|
}
|
||||||
return settings.ringSpecModel.length
|
return settings.normalizedRingSpecModel.length
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSegment(i) {
|
function getSegment(i) {
|
||||||
if (typeof settings.ringSpecModel.rowCount !== "undefined") {
|
if (typeof settings.normalizedRingSpecModel.rowCount !== "undefined") {
|
||||||
return abstactItemModelWrapper.itemAt(i)
|
return abstactItemModelWrapper.itemAt(i)
|
||||||
}
|
}
|
||||||
if (typeof settings.ringSpecModel.count !== "undefined") {
|
if (typeof settings.normalizedRingSpecModel.count !== "undefined") {
|
||||||
return settings.ringSpecModel.get(i)
|
return settings.normalizedRingSpecModel.get(i)
|
||||||
}
|
}
|
||||||
return settings.ringSpecModel[i]
|
return settings.normalizedRingSpecModel[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
function totalRingUnits() {
|
function totalRingUnits() {
|
||||||
|
@ -109,7 +109,7 @@ Item {
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: abstactItemModelWrapper
|
id: abstactItemModelWrapper
|
||||||
model: typeof settings.ringSpecModel.rowCount !== "undefined" ? settings.ringSpecModel : null
|
model: typeof settings.normalizedRingSpecModel.rowCount !== "undefined" ? settings.normalizedRingSpecModel : null
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
readonly property int segmentLength: model.segmentLength
|
readonly property int segmentLength: model.segmentLength
|
||||||
readonly property int colorId: model.colorId
|
readonly property int colorId: model.colorId
|
||||||
|
@ -126,7 +126,7 @@ Item {
|
||||||
let arcPos = settings.initalAngleRad
|
let arcPos = settings.initalAngleRad
|
||||||
context.reset()
|
context.reset()
|
||||||
|
|
||||||
if(settings.ringSpecModel) {
|
if(settings.normalizedRingSpecModel) {
|
||||||
for (let i=0; i < segmentsCount; i++) {
|
for (let i=0; i < segmentsCount; i++) {
|
||||||
const segment = getSegment(i)
|
const segment = getSegment(i)
|
||||||
printArcSegment(context,
|
printArcSegment(context,
|
||||||
|
@ -144,7 +144,7 @@ Item {
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: root.settings
|
target: root.settings
|
||||||
function onRingSpecModelChanged() {
|
function onNormalizedRingSpecModelChanged() {
|
||||||
requestPaint()
|
requestPaint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,4 +64,21 @@ QtObject {
|
||||||
This property provides the pixels size of the ring line.
|
This property provides the pixels size of the ring line.
|
||||||
*/
|
*/
|
||||||
property real ringPxSize
|
property real ringPxSize
|
||||||
|
|
||||||
|
readonly property var normalizedRingSpecModel: {
|
||||||
|
if (typeof ringSpecModel !== "string") {
|
||||||
|
return ringSpecModel
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ringSpecModel) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return JSON.parse(ringSpecModel)
|
||||||
|
} catch (e) {
|
||||||
|
console.log("StatusIdenticonRingSettings: ringSpecModel is not a valid JSON string")
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ Item {
|
||||||
asset.isLetterIdenticon: (asset.name === "")
|
asset.isLetterIdenticon: (asset.name === "")
|
||||||
asset.color: Utils.colorForColorId(model.colorId)
|
asset.color: Utils.colorForColorId(model.colorId)
|
||||||
status: model.onlineStatus
|
status: model.onlineStatus
|
||||||
ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey, ensVerified) // FIXME: use model.colorHash
|
ringSettings.ringSpecModel: model.colorHash
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (mouse.button === Qt.RightButton) {
|
if (mouse.button === Qt.RightButton) {
|
||||||
// Set parent, X & Y positions for the messageContextMenu
|
// Set parent, X & Y positions for the messageContextMenu
|
||||||
|
|
|
@ -138,7 +138,7 @@ Item {
|
||||||
asset.isLetterIdenticon: !model.icon
|
asset.isLetterIdenticon: !model.icon
|
||||||
asset.width: 40
|
asset.width: 40
|
||||||
asset.height: 40
|
asset.height: 40
|
||||||
ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey, !!model.ensName)
|
ringSettings.ringSpecModel: model.colorHash
|
||||||
statusListItemIcon.badge.visible: (root.panelType === CommunityMembersTabPanel.TabType.AllMembers)
|
statusListItemIcon.badge.visible: (root.panelType === CommunityMembersTabPanel.TabType.AllMembers)
|
||||||
|
|
||||||
onClicked: root.userProfileClicked(model.pubKey)
|
onClicked: root.userProfileClicked(model.pubKey)
|
||||||
|
|
|
@ -73,6 +73,7 @@ StatusDialog {
|
||||||
senderIsEnsVerified: model.senderEnsVerified
|
senderIsEnsVerified: model.senderEnsVerified
|
||||||
senderIsAdded: model.senderIsAdded
|
senderIsAdded: model.senderIsAdded
|
||||||
senderIcon: model.senderIcon
|
senderIcon: model.senderIcon
|
||||||
|
senderColorHash: model.senderColorHash
|
||||||
senderTrustStatus: model.senderTrustStatus
|
senderTrustStatus: model.senderTrustStatus
|
||||||
amISender: model.amISender
|
amISender: model.amISender
|
||||||
messageText: model.messageText
|
messageText: model.messageText
|
||||||
|
@ -84,6 +85,16 @@ StatusDialog {
|
||||||
messagePinnedBy: model.pinnedBy
|
messagePinnedBy: model.pinnedBy
|
||||||
linkUrls: model.links
|
linkUrls: model.links
|
||||||
transactionParams: model.transactionParameters
|
transactionParams: model.transactionParameters
|
||||||
|
quotedMessageText: model.quotedMessageParsedText
|
||||||
|
quotedMessageFrom: model.quotedMessageFrom
|
||||||
|
quotedMessageContentType: model.quotedMessageContentType
|
||||||
|
quotedMessageDeleted: model.quotedMessageDeleted
|
||||||
|
quotedMessageAuthorDetailsName: model.quotedMessageAuthorName
|
||||||
|
quotedMessageAuthorDetailsDisplayName: model.quotedMessageAuthorDisplayName
|
||||||
|
quotedMessageAuthorDetailsThumbnailImage: model.quotedMessageAuthorThumbnailImage
|
||||||
|
quotedMessageAuthorDetailsEnsVerified: model.quotedMessageAuthorEnsVerified
|
||||||
|
quotedMessageAuthorDetailsIsContact: model.quotedMessageAuthorIsContact
|
||||||
|
quotedMessageAuthorDetailsColorHash: model.quotedMessageAuthorColorHash
|
||||||
|
|
||||||
// This is possible since we have all data loaded before we load qml.
|
// This is possible since we have all data loaded before we load qml.
|
||||||
// When we fetch messages to fulfill a gap we have to set them at once.
|
// When we fetch messages to fulfill a gap we have to set them at once.
|
||||||
|
|
|
@ -262,6 +262,7 @@ Item {
|
||||||
senderOptionalName: model.senderOptionalName
|
senderOptionalName: model.senderOptionalName
|
||||||
senderIsEnsVerified: model.senderEnsVerified
|
senderIsEnsVerified: model.senderEnsVerified
|
||||||
senderIcon: model.senderIcon
|
senderIcon: model.senderIcon
|
||||||
|
senderColorHash: model.senderColorHash
|
||||||
senderIsAdded: model.senderIsAdded
|
senderIsAdded: model.senderIsAdded
|
||||||
senderTrustStatus: model.senderTrustStatus
|
senderTrustStatus: model.senderTrustStatus
|
||||||
amISender: model.amISender
|
amISender: model.amISender
|
||||||
|
@ -287,22 +288,28 @@ Item {
|
||||||
quotedMessageText: model.quotedMessageParsedText
|
quotedMessageText: model.quotedMessageParsedText
|
||||||
quotedMessageFrom: model.quotedMessageFrom
|
quotedMessageFrom: model.quotedMessageFrom
|
||||||
quotedMessageContentType: model.quotedMessageContentType
|
quotedMessageContentType: model.quotedMessageContentType
|
||||||
quotedMessageFromIterator: model.quotedMessageFromIterator
|
|
||||||
quotedMessageDeleted: model.quotedMessageDeleted
|
quotedMessageDeleted: model.quotedMessageDeleted
|
||||||
|
quotedMessageAuthorDetailsName: model.quotedMessageAuthorName
|
||||||
|
quotedMessageAuthorDetailsDisplayName: model.quotedMessageAuthorDisplayName
|
||||||
|
quotedMessageAuthorDetailsThumbnailImage: model.quotedMessageAuthorThumbnailImage
|
||||||
|
quotedMessageAuthorDetailsEnsVerified: model.quotedMessageAuthorEnsVerified
|
||||||
|
quotedMessageAuthorDetailsIsContact: model.quotedMessageAuthorIsContact
|
||||||
|
quotedMessageAuthorDetailsColorHash: model.quotedMessageAuthorColorHash
|
||||||
|
|
||||||
gapFrom: model.gapFrom
|
gapFrom: model.gapFrom
|
||||||
gapTo: model.gapTo
|
gapTo: model.gapTo
|
||||||
|
|
||||||
// This is possible since we have all data loaded before we load qml.
|
// This is possible since we have all data loaded before we load qml.
|
||||||
// When we fetch messages to fulfill a gap we have to set them at once.
|
// When we fetch messages to fulfill a gap we have to set them at once.
|
||||||
// Also one important thing here is that messages are set in descending order
|
// Also one important thing here is that messages are set in descending order
|
||||||
// in terms of `timestamp` of a message, that means a message with the most
|
// in terms of `timestamp` of a message, that means a message with the most
|
||||||
// recent time is added at index 0.
|
// recent time is added at index 0.
|
||||||
prevMessageIndex: model.prevMsgIndex
|
prevMessageIndex: prevMsgIndex
|
||||||
prevMessageAsJsonObj: messageStore.getMessageByIndexAsJson(model.prevMsgIndex)
|
prevMessageTimestamp: prevMsgTimestamp
|
||||||
prevMsgTimestamp: model.prevMsgTimestamp
|
prevMessageSenderId: prevMsgSenderId
|
||||||
nextMessageIndex: model.nextMsgIndex
|
prevMessageContentType: prevMsgContentType
|
||||||
nextMessageAsJsonObj: messageStore.getMessageByIndexAsJson(model.nextMsgIndex)
|
nextMessageIndex: nextMsgIndex
|
||||||
|
nextMessageTimestamp: nextMsgTimestamp
|
||||||
|
|
||||||
onOpenStickerPackPopup: {
|
onOpenStickerPackPopup: {
|
||||||
root.openStickerPackPopup(stickerPackId);
|
root.openStickerPackPopup(stickerPackId);
|
||||||
|
|
|
@ -42,6 +42,8 @@ Loader {
|
||||||
property string senderOptionalName: ""
|
property string senderOptionalName: ""
|
||||||
property bool senderIsEnsVerified: false
|
property bool senderIsEnsVerified: false
|
||||||
property string senderIcon: ""
|
property string senderIcon: ""
|
||||||
|
//TODO: provide the sender color hash from nim model in case of ContactVerificationRequest, OngoingContactVerificationRequest or PinnedMessagesPopupremove
|
||||||
|
property var senderColorHash: senderId != "" ? Utils.getColorHashAsJson(senderId, senderIsEnsVerified) : ""
|
||||||
property bool amISender: false
|
property bool amISender: false
|
||||||
property bool amIChatAdmin: messageStore && messageStore.amIChatAdmin
|
property bool amIChatAdmin: messageStore && messageStore.amIChatAdmin
|
||||||
property bool senderIsAdded: false
|
property bool senderIsAdded: false
|
||||||
|
@ -66,7 +68,12 @@ Loader {
|
||||||
property int quotedMessageContentType: Constants.messageContentType.messageType
|
property int quotedMessageContentType: Constants.messageContentType.messageType
|
||||||
property int quotedMessageFromIterator: -1
|
property int quotedMessageFromIterator: -1
|
||||||
property bool quotedMessageDeleted: false
|
property bool quotedMessageDeleted: false
|
||||||
property var quotedMessageAuthorDetails: quotedMessageFromIterator >= 0 && Utils.getContactDetailsAsJson(quotedMessageFrom, false)
|
property string quotedMessageAuthorDetailsName: ""
|
||||||
|
property string quotedMessageAuthorDetailsDisplayName: ""
|
||||||
|
property string quotedMessageAuthorDetailsThumbnailImage: ""
|
||||||
|
property bool quotedMessageAuthorDetailsEnsVerified: false
|
||||||
|
property bool quotedMessageAuthorDetailsIsContact: false
|
||||||
|
property var quotedMessageAuthorDetailsColorHash
|
||||||
|
|
||||||
// External behavior changers
|
// External behavior changers
|
||||||
property bool isInPinnedPopup: false // The pinned popup limits the number of buttons shown
|
property bool isInPinnedPopup: false // The pinned popup limits the number of buttons shown
|
||||||
|
@ -77,26 +84,18 @@ Loader {
|
||||||
property int gapTo: 0
|
property int gapTo: 0
|
||||||
|
|
||||||
property int prevMessageIndex: -1
|
property int prevMessageIndex: -1
|
||||||
|
property int prevMessageContentType: prevMessageAsJsonObj ? prevMessageAsJsonObj.contentType : Constants.messageContentType.unknownContentType
|
||||||
|
property double prevMessageTimestamp: prevMessageAsJsonObj ? prevMessageAsJsonObj.timestamp : 0
|
||||||
|
property string prevMessageSenderId: prevMessageAsJsonObj ? prevMessageAsJsonObj.senderId : ""
|
||||||
property var prevMessageAsJsonObj
|
property var prevMessageAsJsonObj
|
||||||
property int nextMessageIndex: -1
|
property int nextMessageIndex: -1
|
||||||
|
property int nextMessageTimestamp: nextMessageAsJsonObj ? nextMessageAsJsonObj.timestamp : 0
|
||||||
property var nextMessageAsJsonObj
|
property var nextMessageAsJsonObj
|
||||||
|
|
||||||
property bool editModeOn: false
|
property bool editModeOn: false
|
||||||
property bool isEdited: false
|
property bool isEdited: false
|
||||||
|
|
||||||
property string authorPrevMsg: {
|
property bool shouldRepeatHeader: d.getShouldRepeatHeader(messageTimestamp, prevMessageTimestamp, messageOutgoingStatus)
|
||||||
if(!prevMessageAsJsonObj ||
|
|
||||||
// The system message for private groups appear as created by the group host, but it shouldn't
|
|
||||||
prevMessageAsJsonObj.contentType === Constants.messageContentType.systemMessagePrivateGroupType) {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return prevMessageAsJsonObj.senderId
|
|
||||||
}
|
|
||||||
property double prevMsgTimestamp: prevMessageAsJsonObj ? prevMessageAsJsonObj.timestamp : 0
|
|
||||||
property double nextMsgTimestamp: nextMessageAsJsonObj ? nextMessageAsJsonObj.timestamp : 0
|
|
||||||
|
|
||||||
property bool shouldRepeatHeader: d.getShouldRepeatHeader(messageTimestamp, prevMsgTimestamp, messageOutgoingStatus)
|
|
||||||
|
|
||||||
property bool hasMention: false
|
property bool hasMention: false
|
||||||
|
|
||||||
|
@ -166,8 +165,8 @@ Loader {
|
||||||
}
|
}
|
||||||
messageContextMenu.messageSenderId = quotedMessageFrom
|
messageContextMenu.messageSenderId = quotedMessageFrom
|
||||||
messageContextMenu.selectedUserPublicKey = quotedMessageFrom
|
messageContextMenu.selectedUserPublicKey = quotedMessageFrom
|
||||||
messageContextMenu.selectedUserDisplayName = quotedMessageAuthorDetails.displayName
|
messageContextMenu.selectedUserDisplayName = quotedMessageAuthorDetailsDisplayName
|
||||||
messageContextMenu.selectedUserIcon = quotedMessageAuthorDetails.thumbnailImage
|
messageContextMenu.selectedUserIcon = quotedMessageAuthorDetailsThumbnailImage
|
||||||
}
|
}
|
||||||
|
|
||||||
messageContextMenu.parent = sender;
|
messageContextMenu.parent = sender;
|
||||||
|
@ -283,7 +282,7 @@ Loader {
|
||||||
id: fetchMoreMessagesButtonComponent
|
id: fetchMoreMessagesButtonComponent
|
||||||
FetchMoreMessagesButton {
|
FetchMoreMessagesButton {
|
||||||
nextMessageIndex: root.nextMessageIndex
|
nextMessageIndex: root.nextMessageIndex
|
||||||
nextMsgTimestamp: root.nextMsgTimestamp
|
nextMsgTimestamp: root.nextMessageTimestamp
|
||||||
onTimerTriggered: {
|
onTimerTriggered: {
|
||||||
messageStore.requestMoreMessages();
|
messageStore.requestMoreMessages();
|
||||||
}
|
}
|
||||||
|
@ -357,7 +356,7 @@ Loader {
|
||||||
Layout.topMargin: 16
|
Layout.topMargin: 16
|
||||||
Layout.bottomMargin: 16
|
Layout.bottomMargin: 16
|
||||||
messageTimestamp: root.messageTimestamp
|
messageTimestamp: root.messageTimestamp
|
||||||
previousMessageTimestamp: root.prevMessageIndex === -1 ? 0 : root.prevMsgTimestamp
|
previousMessageTimestamp: root.prevMessageIndex === -1 ? 0 : root.prevMessageTimestamp
|
||||||
visible: text !== ""
|
visible: text !== ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,8 +455,8 @@ Loader {
|
||||||
resendError: root.resendError
|
resendError: root.resendError
|
||||||
reactionsModel: root.reactionsModel
|
reactionsModel: root.reactionsModel
|
||||||
|
|
||||||
showHeader: root.senderId !== root.authorPrevMsg ||
|
showHeader: root.shouldRepeatHeader || dateGroupLabel.visible || isAReply ||
|
||||||
root.shouldRepeatHeader || dateGroupLabel.visible || isAReply
|
(root.prevMessageContentType !== Constants.messageContentType.systemMessagePrivateGroupType && root.senderId !== root.prevMessageSenderId)
|
||||||
isActiveMessage: d.isMessageActive
|
isActiveMessage: d.isMessageActive
|
||||||
topPadding: showHeader ? Style.current.halfPadding : 2
|
topPadding: showHeader ? Style.current.halfPadding : 2
|
||||||
bottomPadding: showHeader && nextMessageHasHeader() ? Style.current.halfPadding : 2
|
bottomPadding: showHeader && nextMessageHasHeader() ? Style.current.halfPadding : 2
|
||||||
|
@ -605,7 +604,7 @@ Loader {
|
||||||
assetSettings.isImage: root.isDiscordMessage || root.senderIcon.startsWith("data")
|
assetSettings.isImage: root.isDiscordMessage || root.senderIcon.startsWith("data")
|
||||||
pubkey: root.senderId
|
pubkey: root.senderId
|
||||||
colorId: Utils.colorIdForPubkey(root.senderId)
|
colorId: Utils.colorIdForPubkey(root.senderId)
|
||||||
colorHash: Utils.getColorHashAsJson(root.senderId, root.senderIsEnsVerified)
|
colorHash: root.senderColorHash
|
||||||
showRing: !root.isDiscordMessage && !root.senderIsEnsVerified
|
showRing: !root.isDiscordMessage && !root.senderIsEnsVerified
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -637,19 +636,19 @@ Loader {
|
||||||
|
|
||||||
amISender: root.quotedMessageFrom === userProfile.pubKey
|
amISender: root.quotedMessageFrom === userProfile.pubKey
|
||||||
sender.id: root.quotedMessageFrom
|
sender.id: root.quotedMessageFrom
|
||||||
sender.isContact: quotedMessageAuthorDetails.isContact
|
sender.isContact: quotedMessageAuthorDetailsIsContact
|
||||||
sender.displayName: root.quotedMessageContentType === Constants.messageContentType.discordMessageType ? quotedMessageAuthorDisplayName : quotedMessageAuthorDetails.displayName
|
sender.displayName: quotedMessageAuthorDetailsDisplayName
|
||||||
sender.isEnsVerified: quotedMessageAuthorDetails.ensVerified
|
sender.isEnsVerified: quotedMessageAuthorDetailsEnsVerified
|
||||||
sender.secondaryName: quotedMessageAuthorDetails.name || ""
|
sender.secondaryName: quotedMessageAuthorDetailsName || ""
|
||||||
sender.profileImage {
|
sender.profileImage {
|
||||||
width: 20
|
width: 20
|
||||||
height: 20
|
height: 20
|
||||||
name: root.quotedMessageContentType === Constants.messageContentType.discordMessageType ? quotedMessageAuthorAvatar : quotedMessageAuthorDetails.thumbnailImage
|
name: quotedMessageAuthorDetailsThumbnailImage
|
||||||
assetSettings.isImage: quotedMessageAuthorDetails.thumbnailImage !== "" || quotedMessageAuthorAvatar != ""
|
assetSettings.isImage: quotedMessageAuthorDetailsThumbnailImage
|
||||||
showRing: (root.quotedMessageContentType !== Constants.messageContentType.discordMessageType) && !sender.isEnsVerified
|
showRing: (root.quotedMessageContentType !== Constants.messageContentType.discordMessageType) && !sender.isEnsVerified
|
||||||
pubkey: sender.id
|
pubkey: sender.id
|
||||||
colorId: Utils.colorIdForPubkey(sender.id)
|
colorId: Utils.colorIdForPubkey(sender.id)
|
||||||
colorHash: Utils.getColorHashAsJson(sender.id, sender.isEnsVerified)
|
colorHash: quotedMessageAuthorDetailsColorHash
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue