diff --git a/src/app/modules/main/activity_center/controller.nim b/src/app/modules/main/activity_center/controller.nim index 9f3c6ab30b..4d3e635c7c 100644 --- a/src/app/modules/main/activity_center/controller.nim +++ b/src/app/modules/main/activity_center/controller.nim @@ -115,7 +115,8 @@ proc getChatDetails*(self: Controller, chatId: string): ChatDto = proc getChannelGroups*(self: Controller): seq[ChannelGroupDto] = return self.chatService.getChannelGroups() -proc getOneToOneChatNameAndImage*(self: Controller, chatId: string): tuple[name: string, image: string] = +proc getOneToOneChatNameAndImage*(self: Controller, chatId: string): + tuple[name: string, image: string, largeImage: string] = return self.chatService.getOneToOneChatNameAndImage(chatId) proc getMessageById*(self: Controller, chatId, messageId: string): MessageDto = diff --git a/src/app/modules/main/app_search/controller.nim b/src/app/modules/main/app_search/controller.nim index 323068c379..178e1a2b57 100644 --- a/src/app/modules/main/app_search/controller.nim +++ b/src/app/modules/main/app_search/controller.nim @@ -130,11 +130,11 @@ proc searchMessages*(self: Controller, searchTerm: string) = self.messageService.asyncSearchMessages(communities, chats, self.searchTerm, false) proc getOneToOneChatNameAndImage*(self: Controller, chatId: string): - tuple[name: string, image: string] = + tuple[name: string, image: string, largeImage: string] = return self.chatService.getOneToOneChatNameAndImage(chatId) proc getContactNameAndImage*(self: Controller, contactId: string): - tuple[name: string, image: string] = + tuple[name: string, image: string, largeImage: string] = return self.contactsService.getContactNameAndImage(contactId) proc addResultItemDetails*(self: Controller, itemId: string, sectionId = "", channelId = "", messageId = "") = diff --git a/src/app/modules/main/app_search/module.nim b/src/app/modules/main/app_search/module.nim index 7171744a0b..3f1a238db8 100644 --- a/src/app/modules/main/app_search/module.nim +++ b/src/app/modules/main/app_search/module.nim @@ -231,7 +231,7 @@ method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) = continue let chatDto = self.controller.getChatDetails("", m.chatId) - var (senderName, senderImage) = self.controller.getContactNameAndImage(m.`from`) + var (senderName, senderImage, _) = self.controller.getContactNameAndImage(m.`from`) if(m.`from` == singletonInstance.userProfile.getPubKey()): senderName = "You" diff --git a/src/app/modules/main/chat_section/chat_content/controller.nim b/src/app/modules/main/chat_section/chat_content/controller.nim index 2ad143ea79..98a89bed90 100644 --- a/src/app/modules/main/chat_section/chat_content/controller.nim +++ b/src/app/modules/main/chat_section/chat_content/controller.nim @@ -139,7 +139,7 @@ proc getChatDetails*(self: Controller): ChatDto = proc getCommunityDetails*(self: Controller): CommunityDto = return self.communityService.getCommunityById(self.sectionId) -proc getOneToOneChatNameAndImage*(self: Controller): tuple[name: string, image: string] = +proc getOneToOneChatNameAndImage*(self: Controller): tuple[name: string, image: string, largeImage: string] = return self.chatService.getOneToOneChatNameAndImage(self.chatId) proc belongsToCommunity*(self: Controller): bool = diff --git a/src/app/modules/main/chat_section/chat_content/messages/controller.nim b/src/app/modules/main/chat_section/chat_content/messages/controller.nim index 482b5d6212..a633bb5eb1 100644 --- a/src/app/modules/main/chat_section/chat_content/messages/controller.nim +++ b/src/app/modules/main/chat_section/chat_content/messages/controller.nim @@ -176,7 +176,8 @@ proc getChatDetails*(self: Controller): ChatDto = proc getCommunityDetails*(self: Controller): CommunityDto = return self.communityService.getCommunityById(self.sectionId) -proc getOneToOneChatNameAndImage*(self: Controller): tuple[name: string, image: string] = +proc getOneToOneChatNameAndImage*(self: Controller): + tuple[name: string, image: string, largeImage: string] = return self.chatService.getOneToOneChatNameAndImage(self.chatId) proc belongsToCommunity*(self: Controller): bool = diff --git a/src/app/modules/main/chat_section/chat_content/messages/module.nim b/src/app/modules/main/chat_section/chat_content/messages/module.nim index 1d84c6d2dc..3911c10e1c 100644 --- a/src/app/modules/main/chat_section/chat_content/messages/module.nim +++ b/src/app/modules/main/chat_section/chat_content/messages/module.nim @@ -98,12 +98,13 @@ proc createFetchMoreMessagesItem(self: Module): Item = proc createChatIdentifierItem(self: Module): Item = let chatDto = self.controller.getChatDetails() var chatName = chatDto.name + var smallImage = "" var chatIcon = "" var senderIsAdded = false if(chatDto.chatType == ChatType.OneToOne): let sender = self.controller.getContactDetails(chatDto.id) senderIsAdded = sender.details.added - (chatName, chatIcon) = self.controller.getOneToOneChatNameAndImage() + (chatName, smallImage, chatIcon) = self.controller.getOneToOneChatNameAndImage() result = initItem( CHAT_IDENTIFIER_MESSAGE_ID, diff --git a/src/app/modules/main/chat_section/chat_content/users/controller.nim b/src/app/modules/main/chat_section/chat_content/users/controller.nim index a51dc70a03..cceed6361e 100644 --- a/src/app/modules/main/chat_section/chat_content/users/controller.nim +++ b/src/app/modules/main/chat_section/chat_content/users/controller.nim @@ -161,7 +161,7 @@ proc getMembersPublicKeys*(self: Controller): seq[string] = return chatDto.members.map(x => x.id) proc getContactNameAndImage*(self: Controller, contactId: string): - tuple[name: string, image: string] = + tuple[name: string, image: string, largeImage: string] = return self.contactService.getContactNameAndImage(contactId) proc getContactDetails*(self: Controller, contactId: string): ContactDetails = diff --git a/src/app/modules/main/chat_section/controller.nim b/src/app/modules/main/chat_section/controller.nim index a48247d574..98c6ceaad6 100644 --- a/src/app/modules/main/chat_section/controller.nim +++ b/src/app/modules/main/chat_section/controller.nim @@ -240,7 +240,7 @@ proc removeCommunityChat*(self: Controller, itemId: string) = self.communityService.deleteCommunityChat(self.getMySectionId(), itemId) proc getOneToOneChatNameAndImage*(self: Controller, chatId: string): - tuple[name: string, image: string] = + tuple[name: string, image: string, largeImage: string] = return self.chatService.getOneToOneChatNameAndImage(chatId) proc createPublicChat*(self: Controller, chatId: string) = diff --git a/src/app/modules/main/communities/controller.nim b/src/app/modules/main/communities/controller.nim index b58ba2baef..16f7e7a665 100644 --- a/src/app/modules/main/communities/controller.nim +++ b/src/app/modules/main/communities/controller.nim @@ -132,7 +132,7 @@ proc setCommunityMuted*(self: Controller, communityId: string, muted: bool) = self.communityService.setCommunityMuted(communityId, muted) proc getContactNameAndImage*(self: Controller, contactId: string): - tuple[name: string, image: string] = + tuple[name: string, image: string, largeImage: string] = return self.contactsService.getContactNameAndImage(contactId) proc getContactDetails*(self: Controller, contactId: string): ContactDetails = diff --git a/src/app/modules/main/controller.nim b/src/app/modules/main/controller.nim index 7db47fd224..3afe274112 100644 --- a/src/app/modules/main/controller.nim +++ b/src/app/modules/main/controller.nim @@ -285,7 +285,7 @@ proc getContacts*(self: Controller, group: ContactsGroup): seq[ContactsDto] = return self.contactsService.getContactsByGroup(group) proc getContactNameAndImage*(self: Controller, contactId: string): - tuple[name: string, image: string] = + tuple[name: string, image: string, largeImage: string] = return self.contactsService.getContactNameAndImage(contactId) proc getContactDetails*(self: Controller, contactId: string): ContactDetails = diff --git a/src/app/modules/main/module.nim b/src/app/modules/main/module.nim index 746069a2c4..f8560cee4a 100644 --- a/src/app/modules/main/module.nim +++ b/src/app/modules/main/module.nim @@ -679,10 +679,10 @@ method communityEdited*[T]( method getContactDetailsAsJson*[T](self: Module[T], publicKey: string): string = let contact = self.controller.getContact(publicKey) - let (name, image) = self.controller.getContactNameAndImage(contact.id) + let (name, _, _) = self.controller.getContactNameAndImage(contact.id) let jsonObj = %* { "displayName": name, - "displayIcon": image, + "displayIcon": contact.image.thumbnail, "publicKey": contact.id, "name": contact.name, "ensVerified": contact.ensVerified, @@ -690,8 +690,8 @@ method getContactDetailsAsJson*[T](self: Module[T], publicKey: string): string = "lastUpdated": contact.lastUpdated, "lastUpdatedLocally": contact.lastUpdatedLocally, "localNickname": contact.localNickname, - "thumbnailImage": contact.image.large, - "largeImage": contact.image.thumbnail, + "thumbnailImage": contact.image.thumbnail, + "largeImage": contact.image.large, "isContact":contact.added, "isBlocked":contact.blocked, "requestReceived":contact.hasAddedUs, @@ -764,7 +764,7 @@ method osNotificationClicked*[T](self: Module[T], details: NotificationDetails) echo "There is no particular action clicking on a notification informing you about rejection to join community" method newCommunityMembershipRequestReceived*[T](self: Module[T], membershipRequest: CommunityMembershipRequestDto) = - let (contactName, _) = self.controller.getContactNameAndImage(membershipRequest.publicKey) + let (contactName, _, _) = self.controller.getContactNameAndImage(membershipRequest.publicKey) let community = self.controller.getCommunityById(membershipRequest.communityId) singletonInstance.globalEvents.newCommunityMembershipRequestNotification("New membership request", fmt "{contactName} asks to join {community.name}", community.id) diff --git a/src/app/modules/main/profile_section/contacts/controller.nim b/src/app/modules/main/profile_section/contacts/controller.nim index f0491a3a9d..9c68d9ea4e 100644 --- a/src/app/modules/main/profile_section/contacts/controller.nim +++ b/src/app/modules/main/profile_section/contacts/controller.nim @@ -60,7 +60,7 @@ proc getContact*(self: Controller, id: string): ContactsDto = return self.contactsService.getContactById(id) proc getContactNameAndImage*(self: Controller, contactId: string): - tuple[name: string, image: string] = + tuple[name: string, image: string, largeImage: string] = return self.contactsService.getContactNameAndImage(contactId) proc unblockContact*(self: Controller, publicKey: string) = diff --git a/src/app/modules/main/profile_section/contacts/module.nim b/src/app/modules/main/profile_section/contacts/module.nim index a9d86f6f72..6f4e9ad1a7 100644 --- a/src/app/modules/main/profile_section/contacts/module.nim +++ b/src/app/modules/main/profile_section/contacts/module.nim @@ -40,7 +40,7 @@ method delete*(self: Module) = proc createItemFromPublicKey(self: Module, publicKey: string): UserItem = let contact = self.controller.getContact(publicKey) - let (name, image) = self.controller.getContactNameAndImage(contact.id) + let (name, image, _) = self.controller.getContactNameAndImage(contact.id) return initUserItem( pubKey = contact.id, @@ -164,7 +164,7 @@ method contactUpdated*(self: Module, publicKey: string) = self.removeIfExistsAndAddToAppropriateModel(publicKey) method contactNicknameChanged*(self: Module, publicKey: string) = - let (name, _) = self.controller.getContactNameAndImage(publicKey) + let (name, _, _) = self.controller.getContactNameAndImage(publicKey) self.view.myMutualContactsModel().updateName(publicKey, name) self.view.receivedContactRequestsModel().updateName(publicKey, name) self.view.sentContactRequestsModel().updateName(publicKey, name) diff --git a/src/app_service/service/chat/service.nim b/src/app_service/service/chat/service.nim index 01bf156b93..ad85b42c6e 100644 --- a/src/app_service/service/chat/service.nim +++ b/src/app_service/service/chat/service.nim @@ -247,7 +247,7 @@ QtObject: return self.chats[chatId] proc getOneToOneChatNameAndImage*(self: Service, chatId: string): - tuple[name: string, image: string] = + tuple[name: string, image: string, largeImage: string] = return self.contactService.getContactNameAndImage(chatId) proc createChatFromResponse(self: Service, response: RpcResponse[JsonNode]): tuple[chatDto: ChatDto, success: bool] = diff --git a/src/app_service/service/contacts/service.nim b/src/app_service/service/contacts/service.nim index f96870f26d..e8586b5c2d 100644 --- a/src/app_service/service/contacts/service.nim +++ b/src/app_service/service/contacts/service.nim @@ -276,13 +276,16 @@ QtObject: return self.contactsStatus[publicKey] - proc getContactNameAndImage*(self: Service, publicKey: string): tuple[name: string, image: string] = + proc getContactNameAndImage*(self: Service, publicKey: string): + tuple[name: string, image: string, largeImage: string] = ## This proc should be used accross the app in order to have for the same contact ## same image and name displayed everywhere in the app. let contactDto = self.getContactById(publicKey) result.name = contactDto.userNameOrAlias() if(contactDto.image.thumbnail.len > 0): result.image = contactDto.image.thumbnail + if(contactDto.image.large.len > 0): + result.largeImage = contactDto.image.large proc saveContact(self: Service, contact: ContactsDto) = # we must keep local contacts updated @@ -461,7 +464,7 @@ QtObject: proc getContactDetails*(self: Service, pubKey: string): ContactDetails = result = ContactDetails() - let (name, icon) = self.getContactNameAndImage(pubKey) + let (name, icon, _) = self.getContactNameAndImage(pubKey) result.displayName = name result.icon = icon result.isCurrentUser = pubKey == singletonInstance.userProfile.getPubKey() diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 45cd13494f..b24c6ed098 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -192,7 +192,7 @@ Column { messageContextMenu.messageSenderId = obj.senderId messageContextMenu.selectedUserPublicKey = obj.senderId messageContextMenu.selectedUserDisplayName = obj.senderDisplayName - messageContextMenu.selectedUserIcon = obj.senderIcon + messageContextMenu.selectedUserIcon = obj.senderIconToShow } @@ -289,7 +289,7 @@ Column { chatColor: root.messageStore.getChatColor() chatEmoji: root.channelEmoji amIChatAdmin: root.messageStore.amIChatAdmin() - chatIcon: root.senderIcon + chatIcon: root.senderIconToShow } }