From 7ee7ba5ebeb55195943b9b0b29d13c6a5eca4246 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Tue, 16 Nov 2021 16:08:06 +0100 Subject: [PATCH] fix(@desktop/profile): Custom picture is not applied everywhere in the app without restart fixes #4099 --- src/app/core/user_profile.nim | 3 +++ .../main/profile_section/profile/controller.nim | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/core/user_profile.nim b/src/app/core/user_profile.nim index 937ad668a6..4b3d1e736b 100644 --- a/src/app/core/user_profile.nim +++ b/src/app/core/user_profile.nim @@ -29,6 +29,9 @@ QtObject: self.address = address self.identicon = identicon self.pubKey = pubKey + + proc getIdenticon*(self: UserProfile): string {.slot.} = + self.identicon proc getUsername*(self: UserProfile): string {.slot.} = self.username diff --git a/src/app/modules/main/profile_section/profile/controller.nim b/src/app/modules/main/profile_section/profile/controller.nim index 65d325be2a..92e1669ed6 100644 --- a/src/app/modules/main/profile_section/profile/controller.nim +++ b/src/app/modules/main/profile_section/profile/controller.nim @@ -43,7 +43,7 @@ method getProfile*[T](self: Controller[T]): item.Item = id: singletonInstance.userProfile.getPubKey(), alias: "", username: singletonInstance.userProfile.getUsername(), - identicon: singletonInstance.userProfile.getThumbnailImage(), + identicon: singletonInstance.userProfile.getIdenticon(), address: singletonInstance.userProfile.getAddress(), ensName: singletonInstance.userProfile.getEnsName(), ensVerified: false, @@ -61,7 +61,11 @@ method getProfile*[T](self: Controller[T]): item.Item = return item method storeIdentityImage*[T](self: Controller[T], address: string, image: string, aX: int, aY: int, bX: int, bY: int): identity_image.IdentityImage = - self.profileService.storeIdentityImage(address, image, aX, aY, bX, bY) + result = self.profileService.storeIdentityImage(address, image, aX, aY, bX, bY) + singletonInstance.userProfile.setThumbnailImage(result.thumbnail) + singletonInstance.userProfile.setLargeImage(result.large) method deleteIdentityImage*[T](self: Controller[T], address: string): string = - self.profileService.deleteIdentityImage(address) \ No newline at end of file + result = self.profileService.deleteIdentityImage(address) + singletonInstance.userProfile.setThumbnailImage("") + singletonInstance.userProfile.setLargeImage("")