refactor(@desktop/settings-profile): profile section updated
This commit is contained in:
parent
5bafb2bb5a
commit
9a82370df0
|
@ -1,7 +1,5 @@
|
|||
import NimQml
|
||||
|
||||
import ../../app_service/common/utils
|
||||
|
||||
import ../../app_service/service/os_notification/service as os_notification_service
|
||||
import ../../app_service/service/eth/service as eth_service
|
||||
import ../../app_service/service/keychain/service as keychain_service
|
||||
|
@ -305,6 +303,9 @@ proc buildAndRegisterLocalAccountSensitiveSettings(self: AppController) =
|
|||
|
||||
proc buildAndRegisterUserProfile(self: AppController) =
|
||||
let pubKey = self.settingsService.getPublicKey()
|
||||
let preferredName = self.settingsService.getPreferredName()
|
||||
let ensUsernames = self.settingsService.getEnsUsernames()
|
||||
let firstEnsName = if (ensUsernames.len > 0): ensUsernames[0] else: ""
|
||||
let sendUserStatus = self.settingsService.getSendStatusUpdates()
|
||||
## This is still not in use. Read a comment in UserProfile.
|
||||
## let currentUserStatus = self.settingsService.getCurrentUserStatus()
|
||||
|
@ -318,13 +319,12 @@ proc buildAndRegisterUserProfile(self: AppController) =
|
|||
thumbnail = img.uri
|
||||
|
||||
let meAsContact = self.contactsService.getContactById(pubKey)
|
||||
var ensName: string
|
||||
if(meAsContact.ensVerified):
|
||||
ensName = utils.prettyEnsName(meAsContact.name)
|
||||
|
||||
singletonInstance.userProfile.setFixedData(loggedInAccount.name, loggedInAccount.keyUid, loggedInAccount.identicon,
|
||||
pubKey)
|
||||
singletonInstance.userProfile.setEnsName(ensName)
|
||||
singletonInstance.userProfile.setPreferredName(preferredName)
|
||||
singletonInstance.userProfile.setEnsName(meAsContact.name)
|
||||
singletonInstance.userProfile.setFirstEnsName(firstEnsName)
|
||||
singletonInstance.userProfile.setThumbnailImage(thumbnail)
|
||||
singletonInstance.userProfile.setLargeImage(large)
|
||||
singletonInstance.userProfile.setUserStatus(sendUserStatus)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import NimQml
|
||||
|
||||
import ../../app_service/common/utils
|
||||
|
||||
QtObject:
|
||||
type UserProfile* = ref object of QObject
|
||||
# fields which cannot change
|
||||
|
@ -10,6 +12,8 @@ QtObject:
|
|||
# fields which may change during runtime
|
||||
isIdenticon: bool
|
||||
ensName: string
|
||||
firstEnsName: string
|
||||
preferredName: string
|
||||
thumbnailImage: string
|
||||
largeImage: string
|
||||
userStatus: bool
|
||||
|
@ -55,23 +59,73 @@ QtObject:
|
|||
read = getUsername
|
||||
notify = nameChanged
|
||||
|
||||
proc getEnsName*(self: UserProfile): string {.slot.} =
|
||||
self.ensName
|
||||
|
||||
# this is not a slot
|
||||
proc setEnsName*(self: UserProfile, name: string) =
|
||||
if(self.ensName == name):
|
||||
return
|
||||
self.ensName = name
|
||||
self.nameChanged()
|
||||
|
||||
|
||||
proc getEnsName*(self: UserProfile): string {.slot.} =
|
||||
self.ensName
|
||||
QtProperty[string] ensName:
|
||||
read = getEnsName
|
||||
notify = nameChanged
|
||||
|
||||
proc getPrettyEnsName*(self: UserProfile): string {.slot.} =
|
||||
utils.prettyEnsName(self.ensName)
|
||||
QtProperty[string] prettyEnsName:
|
||||
read = getPrettyEnsName
|
||||
notify = nameChanged
|
||||
|
||||
|
||||
# this is not a slot
|
||||
proc setFirstEnsName*(self: UserProfile, name: string) =
|
||||
if(self.firstEnsName == name):
|
||||
return
|
||||
self.firstEnsName = name
|
||||
self.nameChanged()
|
||||
|
||||
proc getFirstEnsName*(self: UserProfile): string {.slot.} =
|
||||
self.firstEnsName
|
||||
QtProperty[string] firstEnsName:
|
||||
read = getFirstEnsName
|
||||
notify = nameChanged
|
||||
|
||||
proc getPrettyFirstEnsName*(self: UserProfile): string {.slot.} =
|
||||
utils.prettyEnsName(self.firstEnsName)
|
||||
QtProperty[string] prettyFirstEnsName:
|
||||
read = getPrettyFirstEnsName
|
||||
notify = nameChanged
|
||||
|
||||
|
||||
# this is not a slot
|
||||
proc setPreferredName*(self: UserProfile, name: string) =
|
||||
if(self.preferredName == name):
|
||||
return
|
||||
self.preferredName = name
|
||||
self.nameChanged()
|
||||
|
||||
proc getPreferredName*(self: UserProfile): string {.slot.} =
|
||||
self.preferredName
|
||||
QtProperty[string] preferredName:
|
||||
read = getPreferredName
|
||||
notify = nameChanged
|
||||
|
||||
proc getPrettyPreferredName*(self: UserProfile): string {.slot.} =
|
||||
utils.prettyEnsName(self.preferredName)
|
||||
QtProperty[string] prettyPreferredName:
|
||||
read = getPrettyPreferredName
|
||||
notify = nameChanged
|
||||
|
||||
|
||||
proc getName*(self: UserProfile): string {.slot.} =
|
||||
if(self.ensName.len > 0):
|
||||
return self.ensName
|
||||
if(self.preferredName.len > 0):
|
||||
return self.getPrettyPreferredName()
|
||||
elif(self.firstEnsName.len > 0):
|
||||
return self.getPrettyFirstEnsName()
|
||||
elif(self.ensName.len > 0):
|
||||
return self.getPrettyEnsName()
|
||||
return self.username
|
||||
|
||||
QtProperty[string] name:
|
||||
|
|
|
@ -96,5 +96,5 @@ method contactUpdated*(self: Module, contact: ContactsDto) =
|
|||
self.view.model().updateItem(contact.id, contact.userNameOrAlias(), icon, isIdenticon)
|
||||
|
||||
method loggedInUserImageChanged*(self: Module) =
|
||||
self.view.model().setIcon(singletonInstance.userProfile.getPubKey(), singletonInstance.userProfile.getThumbnailImage(),
|
||||
self.view.model().setIcon(singletonInstance.userProfile.getPubKey(), singletonInstance.userProfile.getIcon(),
|
||||
singletonInstance.userProfile.getIsIdenticon())
|
|
@ -23,6 +23,9 @@ method viewDidLoad*(self: AccessInterface) {.base.} =
|
|||
method profileModuleDidLoad*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getProfileModule*(self: AccessInterface): QVariant {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method contactsModuleDidLoad*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ proc newModule*[T](delegate: T,
|
|||
result.controller = controller.newController[Module[T]](result)
|
||||
result.moduleLoaded = false
|
||||
|
||||
result.profileModule = profile_module.newModule(result, accountsService, settingsService, profileService)
|
||||
result.profileModule = profile_module.newModule(result, profileService)
|
||||
result.contactsModule = contacts_module.newModule(result, events, contactsService, accountsService)
|
||||
result.languageModule = language_module.newModule(result, languageService)
|
||||
result.mnemonicModule = mnemonic_module.newModule(result, mnemonicService)
|
||||
|
@ -156,6 +156,9 @@ method viewDidLoad*[T](self: Module[T]) =
|
|||
method profileModuleDidLoad*[T](self: Module[T]) =
|
||||
self.checkIfModuleDidLoad()
|
||||
|
||||
method getProfileModule*[T](self: Module[T]): QVariant =
|
||||
self.profileModule.getModuleAsVariant()
|
||||
|
||||
method contactsModuleDidLoad*[T](self: Module[T]) =
|
||||
self.checkIfModuleDidLoad()
|
||||
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
import ./controller_interface
|
||||
import io_interface
|
||||
import ../../../../global/global_singleton
|
||||
import ../../../../../app_service/service/profile/service as profile_service
|
||||
import ../../../../../app_service/service/accounts/service as accounts_service
|
||||
import ../../../../../app_service/service/settings/service_interface as settings_service
|
||||
|
||||
import ./item as item
|
||||
import status/types/identity_image
|
||||
import ../../../../../app_service/service/profile/service_interface as profile_service
|
||||
|
||||
export controller_interface
|
||||
|
||||
|
@ -14,16 +9,12 @@ type
|
|||
Controller* = ref object of controller_interface.AccessInterface
|
||||
delegate: io_interface.AccessInterface
|
||||
profileService: profile_service.ServiceInterface
|
||||
settingsService: settings_service.ServiceInterface
|
||||
accountsService: accounts_service.ServiceInterface
|
||||
|
||||
proc newController*(delegate: io_interface.AccessInterface, accountsService: accounts_service.ServiceInterface,
|
||||
settingsService: settings_service.ServiceInterface, profileService: profile_service.ServiceInterface): Controller =
|
||||
proc newController*(delegate: io_interface.AccessInterface,
|
||||
profileService: profile_service.ServiceInterface): Controller =
|
||||
result = Controller()
|
||||
result.delegate = delegate
|
||||
result.profileService = profileService
|
||||
result.settingsService = settingsService
|
||||
result.accountsService = accountsService
|
||||
|
||||
method delete*(self: Controller) =
|
||||
discard
|
||||
|
@ -31,41 +22,8 @@ method delete*(self: Controller) =
|
|||
method init*(self: Controller) =
|
||||
discard
|
||||
|
||||
method getProfile*(self: Controller): item.Item =
|
||||
|
||||
var appearance = self.settingsService.getAppearance()
|
||||
var messagesFromContactsOnly = self.settingsService.getMessagesFromContactsOnly()
|
||||
method storeIdentityImage*(self: Controller, address: string, image: string, aX: int, aY: int, bX: int, bY: int): seq[Image] =
|
||||
return self.profileService.storeIdentityImage(address, image, aX, aY, bX, bY)
|
||||
|
||||
var identityImage = item.IdentityImage(thumbnail: singletonInstance.userProfile.getThumbnailImage(),
|
||||
large: singletonInstance.userProfile.getLargeImage())
|
||||
|
||||
var item = item.Item(
|
||||
id: singletonInstance.userProfile.getPubKey(),
|
||||
alias: "",
|
||||
username: singletonInstance.userProfile.getUsername(),
|
||||
identicon: singletonInstance.userProfile.getIdenticon(),
|
||||
address: singletonInstance.userProfile.getAddress(),
|
||||
ensName: singletonInstance.userProfile.getEnsName(),
|
||||
ensVerified: false,
|
||||
localNickname: "",
|
||||
messagesFromContactsOnly: messagesFromContactsOnly,
|
||||
sendUserStatus: singletonInstance.userProfile.getUserStatus(),
|
||||
currentUserStatus: 1, # This is still not in use. Read a comment in UserProfile.
|
||||
identityImage: identityImage,
|
||||
appearance: appearance,
|
||||
added: false,
|
||||
blocked: false,
|
||||
hasAddedUs: false
|
||||
)
|
||||
|
||||
return item
|
||||
|
||||
method storeIdentityImage*(self: Controller, address: string, image: string, aX: int, aY: int, bX: int, bY: int): identity_image.IdentityImage =
|
||||
result = self.profileService.storeIdentityImage(address, image, aX, aY, bX, bY)
|
||||
singletonInstance.userProfile.setThumbnailImage(result.thumbnail)
|
||||
singletonInstance.userProfile.setLargeImage(result.large)
|
||||
|
||||
method deleteIdentityImage*(self: Controller, address: string): string =
|
||||
result = self.profileService.deleteIdentityImage(address)
|
||||
singletonInstance.userProfile.setThumbnailImage("")
|
||||
singletonInstance.userProfile.setLargeImage("")
|
||||
method deleteIdentityImage*(self: Controller, address: string) =
|
||||
self.profileService.deleteIdentityImage(address)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import ../../../../../app_service/service/profile/service as profile_service
|
||||
import ./item
|
||||
import status/types/identity_image
|
||||
import ../../../../../app_service/service/profile/dto/profile as profile_dto
|
||||
|
||||
type
|
||||
AccessInterface* {.pure inheritable.} = ref object of RootObj
|
||||
|
@ -12,16 +10,9 @@ method delete*(self: AccessInterface) {.base.} =
|
|||
method init*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getProfile*(self: AccessInterface): Item {.base.} =
|
||||
method storeIdentityImage*(self: AccessInterface, address: string, image: string, aX: int, aY: int, bX: int, bY: int):
|
||||
seq[Image] {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method storeIdentityImage*(self: AccessInterface, address: string, image: string, aX: int, aY: int, bX: int, bY: int): identity_image.IdentityImage {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method deleteIdentityImage*(self: AccessInterface, address: string): string {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
type
|
||||
## Abstract class (concept) which must be implemented by object/s used in this
|
||||
## module.
|
||||
DelegateInterface* = concept c
|
||||
method deleteIdentityImage*(self: AccessInterface, address: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
|
@ -1,4 +1,4 @@
|
|||
import status/types/identity_image
|
||||
import NimQml
|
||||
|
||||
type
|
||||
AccessInterface* {.pure inheritable.} = ref object of RootObj
|
||||
|
@ -13,11 +13,13 @@ method load*(self: AccessInterface) {.base.} =
|
|||
method isLoaded*(self: AccessInterface): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method storeIdentityImage*(self: AccessInterface, address: string, image: string, aX: int, aY: int, bX: int, bY: int):
|
||||
identity_image.IdentityImage {.base.} =
|
||||
method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method deleteIdentityImage*(self: AccessInterface, address: string): string {.base.} =
|
||||
method storeIdentityImage*(self: AccessInterface, imageUrl: string, aX: int, aY: int, bX: int, bY: int) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method deleteIdentityImage*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
# View Delegate Interface
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
import strformat
|
||||
|
||||
type
|
||||
IdentityImage* = ref object
|
||||
thumbnail*: string
|
||||
large*: string
|
||||
|
||||
type
|
||||
Item* = object
|
||||
id*, alias*, username*, identicon*, address*, ensName*, localNickname*: string
|
||||
ensVerified*: bool
|
||||
messagesFromContactsOnly*: bool
|
||||
sendUserStatus*: bool
|
||||
currentUserStatus*: int
|
||||
identityImage*: IdentityImage
|
||||
appearance*: int
|
||||
added*: bool
|
||||
blocked*: bool
|
||||
hasAddedUs*: bool
|
||||
|
||||
proc `$`*(self: Item): string =
|
||||
result = fmt"""ProfileDto(
|
||||
username: {self.username},
|
||||
identicon: {self.identicon},
|
||||
messagesFromContactsOnly: {self.messagesFromContactsOnly}
|
||||
)"""
|
|
@ -1,142 +0,0 @@
|
|||
import NimQml
|
||||
import chronicles
|
||||
import std/wrapnils
|
||||
|
||||
import status/types/profile
|
||||
|
||||
import ./item as item
|
||||
|
||||
QtObject:
|
||||
type Model* = ref object of QObject
|
||||
username*: string
|
||||
identicon*: string
|
||||
address*: string
|
||||
identityImage*: item.IdentityImage
|
||||
pubKey*: string
|
||||
appearance*: int
|
||||
ensVerified*: bool
|
||||
messagesFromContactsOnly*: bool
|
||||
sendUserStatus*: bool
|
||||
currentUserStatus*: int
|
||||
|
||||
proc setup(self: Model) =
|
||||
self.QObject.setup
|
||||
|
||||
proc delete*(self: Model) =
|
||||
self.QObject.delete
|
||||
|
||||
proc newModel*(): Model =
|
||||
new(result, delete)
|
||||
result = Model()
|
||||
result.pubKey = ""
|
||||
result.username = ""
|
||||
result.identicon = ""
|
||||
result.appearance = 0
|
||||
result.identityImage = item.IdentityImage(thumbnail: "", large: "")
|
||||
result.ensVerified = false
|
||||
result.messagesFromContactsOnly = false
|
||||
result.sendUserStatus = false
|
||||
result.currentUserStatus = 0
|
||||
result.setup
|
||||
|
||||
proc identityImageChanged*(self: Model) {.signal.}
|
||||
proc sendUserStatusChanged*(self: Model) {.signal.}
|
||||
proc currentUserStatusChanged*(self: Model) {.signal.}
|
||||
proc appearanceChanged*(self: Model) {.signal.}
|
||||
proc messagesFromContactsOnlyChanged*(self: Model) {.signal.}
|
||||
|
||||
proc setProfile*(self: Model, profile: item.Item) =
|
||||
self.username = profile.username
|
||||
self.identicon = profile.identicon
|
||||
self.messagesFromContactsOnly = profile.messagesFromContactsOnly
|
||||
self.appearance = profile.appearance
|
||||
self.pubKey = profile.id
|
||||
self.address = profile.address
|
||||
self.ensVerified = profile.ensVerified
|
||||
self.identityImage = item.IdentityImage(thumbnail: profile.identityImage.thumbnail, large: profile.identityImage.large)
|
||||
self.sendUserStatus = profile.sendUserStatus
|
||||
self.currentUserStatus = profile.currentUserStatus
|
||||
|
||||
proc username*(self: Model): string {.slot.} = result = self.username
|
||||
|
||||
QtProperty[string] username:
|
||||
read = username
|
||||
|
||||
proc identicon*(self: Model): string {.slot.} = result = self.identicon
|
||||
|
||||
QtProperty[string] identicon:
|
||||
read = identicon
|
||||
|
||||
proc pubKey*(self: Model): string {.slot.} = self.pubKey
|
||||
|
||||
QtProperty[string] pubKey:
|
||||
read = pubKey
|
||||
|
||||
proc address*(self: Model): string {.slot.} = self.address
|
||||
|
||||
QtProperty[string] address:
|
||||
read = address
|
||||
|
||||
proc ensVerified*(self: Model): bool {.slot.} = self.ensVerified
|
||||
|
||||
QtProperty[bool] ensVerified:
|
||||
read = ensVerified
|
||||
|
||||
proc appearance*(self: Model): int {.slot.} = result = self.appearance
|
||||
proc setAppearance*(self: Model, appearance: int) {.slot.} =
|
||||
if self.appearance == appearance:
|
||||
return
|
||||
self.appearance = appearance
|
||||
self.appearanceChanged()
|
||||
|
||||
QtProperty[int] appearance:
|
||||
read = appearance
|
||||
write = setAppearance
|
||||
notify = appearanceChanged
|
||||
|
||||
proc messagesFromContactsOnly*(self: Model): bool {.slot.} = result = self.messagesFromContactsOnly
|
||||
proc setMessagesFromContactsOnly*(self: Model, messagesFromContactsOnly: bool) {.slot.} =
|
||||
if self.messagesFromContactsOnly == messagesFromContactsOnly:
|
||||
return
|
||||
self.messagesFromContactsOnly = messagesFromContactsOnly
|
||||
self.messagesFromContactsOnlyChanged()
|
||||
|
||||
QtProperty[bool] messagesFromContactsOnly:
|
||||
read = messagesFromContactsOnly
|
||||
write = setMessagesFromContactsOnly
|
||||
notify = messagesFromContactsOnlyChanged
|
||||
|
||||
proc setIdentityImage*(self: Model, identityImage: item.IdentityImage) =
|
||||
self.identityImage = identityImage
|
||||
self.identityImageChanged()
|
||||
|
||||
proc removeIdentityImage*(self: Model) =
|
||||
self.identityImage = item.IdentityImage(thumbnail: "", large: "")
|
||||
self.identityImageChanged()
|
||||
|
||||
proc thumbnailImage*(self: Model): string {.slot.} =
|
||||
if (?.self.identityImage.thumbnail != ""):
|
||||
result = self.identityImage.thumbnail
|
||||
else:
|
||||
result = self.identicon
|
||||
|
||||
QtProperty[string] thumbnailImage:
|
||||
read = thumbnailImage
|
||||
notify = identityImageChanged
|
||||
|
||||
proc largeImage*(self: Model): string {.slot.} =
|
||||
if (?.self.identityImage.large != ""):
|
||||
result = self.identityImage.large
|
||||
else:
|
||||
result = self.identicon
|
||||
|
||||
QtProperty[string] largeImage:
|
||||
read = largeImage
|
||||
notify = identityImageChanged
|
||||
|
||||
proc hasIdentityImage*(self: Model): bool {.slot.} =
|
||||
result = (?.self.identityImage.thumbnail != "")
|
||||
|
||||
QtProperty[bool] hasIdentityImage:
|
||||
read = hasIdentityImage
|
||||
notify = identityImageChanged
|
|
@ -1,17 +1,16 @@
|
|||
import NimQml, Tables
|
||||
import NimQml, chronicles
|
||||
|
||||
import ./io_interface, ./view, ./controller, ./item
|
||||
import ./io_interface, ./view, ./controller
|
||||
import ../io_interface as delegate_interface
|
||||
import ../../../../global/global_singleton
|
||||
|
||||
import ../../../../../app_service/service/profile/service as profile_service
|
||||
import ../../../../../app_service/service/accounts/service as accounts_service
|
||||
import ../../../../../app_service/service/settings/service_interface as settings_service
|
||||
|
||||
import status/types/identity_image
|
||||
import ../../../../../app_service/service/profile/service_interface as profile_service
|
||||
|
||||
export io_interface
|
||||
|
||||
logScope:
|
||||
topics = "profile-section-profile-module"
|
||||
|
||||
type
|
||||
Module* = ref object of io_interface.AccessInterface
|
||||
delegate: delegate_interface.AccessInterface
|
||||
|
@ -20,19 +19,19 @@ type
|
|||
viewVariant: QVariant
|
||||
moduleLoaded: bool
|
||||
|
||||
proc newModule*(delegate: delegate_interface.AccessInterface, accountsService: accounts_service.ServiceInterface,
|
||||
settingsService: settings_service.ServiceInterface, profileService: profile_service.ServiceInterface): Module =
|
||||
proc newModule*(delegate: delegate_interface.AccessInterface,
|
||||
profileService: profile_service.ServiceInterface): Module =
|
||||
result = Module()
|
||||
result.delegate = delegate
|
||||
result.view = newView(result)
|
||||
result.view = view.newView(result)
|
||||
result.viewVariant = newQVariant(result.view)
|
||||
result.controller = controller.newController(result, accountsService, settingsService, profileService)
|
||||
result.controller = controller.newController(result, profileService)
|
||||
result.moduleLoaded = false
|
||||
|
||||
singletonInstance.engine.setRootContextProperty("profileModule", result.viewVariant)
|
||||
|
||||
method delete*(self: Module) =
|
||||
self.view.delete
|
||||
self.viewVariant.delete
|
||||
self.controller.delete
|
||||
|
||||
method load*(self: Module) =
|
||||
self.controller.init()
|
||||
|
@ -41,15 +40,29 @@ method load*(self: Module) =
|
|||
method isLoaded*(self: Module): bool =
|
||||
return self.moduleLoaded
|
||||
|
||||
method viewDidLoad*(self: Module) =
|
||||
let profile = self.controller.getProfile()
|
||||
self.view.setProfile(profile)
|
||||
|
||||
method getModuleAsVariant*(self: Module): QVariant =
|
||||
return self.viewVariant
|
||||
|
||||
method viewDidLoad*(self: Module) =
|
||||
self.moduleLoaded = true
|
||||
self.delegate.profileModuleDidLoad()
|
||||
|
||||
method storeIdentityImage*(self: Module, address: string, image: string, aX: int, aY: int, bX: int, bY: int): identity_image.IdentityImage =
|
||||
self.controller.storeIdentityImage(address, image, aX, aY, bX, bY)
|
||||
method storeIdentityImage*(self: Module, imageUrl: string, aX: int, aY: int, bX: int, bY: int) =
|
||||
let address = singletonInstance.userProfile.getAddress()
|
||||
let image = singletonInstance.utils.formatImagePath(imageUrl)
|
||||
let storedImages = self.controller.storeIdentityImage(address, image, aX, aY, bX, bY)
|
||||
if(storedImages.len == 0):
|
||||
error "error: array of stored images is empty"
|
||||
return
|
||||
|
||||
method deleteIdentityImage*(self: Module, address: string): string =
|
||||
for img in storedImages:
|
||||
if(img.imgType == "large"):
|
||||
singletonInstance.userProfile.setLargeImage(img.uri)
|
||||
elif(img.imgType == "thumbnail"):
|
||||
singletonInstance.userProfile.setThumbnailImage(img.uri)
|
||||
|
||||
method deleteIdentityImage*(self: Module) =
|
||||
let address = singletonInstance.userProfile.getAddress()
|
||||
self.controller.deleteIdentityImage(address)
|
||||
singletonInstance.userProfile.setLargeImage("")
|
||||
singletonInstance.userProfile.setThumbnailImage("")
|
||||
|
|
|
@ -1,71 +1,32 @@
|
|||
import NimQml
|
||||
|
||||
import ./item
|
||||
import ./model
|
||||
import ./io_interface
|
||||
import status/profile as status_profile
|
||||
import status/status
|
||||
import ../../../../global/global_singleton
|
||||
|
||||
import status/types/[identity_image, profile]
|
||||
|
||||
QtObject:
|
||||
type
|
||||
View* = ref object of QObject
|
||||
delegate: io_interface.AccessInterface
|
||||
model: Model
|
||||
modelVariant: QVariant
|
||||
|
||||
proc delete*(self: View) =
|
||||
self.model.delete
|
||||
self.modelVariant.delete
|
||||
self.QObject.delete
|
||||
|
||||
proc newView*(delegate: io_interface.AccessInterface): View =
|
||||
new(result, delete)
|
||||
result.QObject.setup
|
||||
result.delegate = delegate
|
||||
result.model = newModel()
|
||||
result.modelVariant = newQVariant(result.model)
|
||||
|
||||
proc load*(self: View) =
|
||||
self.delegate.viewDidLoad()
|
||||
|
||||
proc modelChanged*(self: View) {.signal.}
|
||||
|
||||
proc getModel*(self: View): QVariant {.slot.} =
|
||||
return self.modelVariant
|
||||
|
||||
QtProperty[QVariant] model:
|
||||
read = getModel
|
||||
notify = modelChanged
|
||||
|
||||
proc setProfile*(self: View, profile: Item) =
|
||||
self.model.setProfile(profile)
|
||||
self.modelChanged()
|
||||
|
||||
proc upload*(self: View, imageUrl: string, aX: int, aY: int, bX: int, bY: int): string {.slot.} =
|
||||
var image = singletonInstance.utils.formatImagePath(imageUrl)
|
||||
# var image = singletonInstance.utils.formatImagePath(imageUrl)
|
||||
# FIXME the function to get the file size is messed up
|
||||
# var size = image_getFileSize(image)
|
||||
# TODO find a way to i18n this (maybe send just a code and then QML sets the right string)
|
||||
# return "Max file size is 20MB"
|
||||
|
||||
try:
|
||||
# TODO add crop tool for the image
|
||||
let identityImage = self.delegate.storeIdentityImage(self.model.address, image, aX, aY, bX, bY)
|
||||
# TODO use only one type
|
||||
let identityImageConverted = item.IdentityImage(
|
||||
thumbnail: identityImage.thumbnail,
|
||||
large: identityImage.thumbnail
|
||||
)
|
||||
self.model.setIdentityImage(identityImageConverted)
|
||||
result = ""
|
||||
except Exception as e:
|
||||
echo "Error storing identity image", e.msg
|
||||
result = "Error storing identity image: " & e.msg
|
||||
self.delegate.storeIdentityImage(imageUrl, aX, aY, bX, bY)
|
||||
|
||||
|
||||
proc remove*(self: View): string {.slot.} =
|
||||
result = self.delegate.deleteIdentityImage(self.model.address)
|
||||
if (result == ""):
|
||||
self.model.removeIdentityImage()
|
||||
self.delegate.deleteIdentityImage()
|
|
@ -26,6 +26,11 @@ QtObject:
|
|||
QtProperty[QVariant] languageModule:
|
||||
read = getLanguageModule
|
||||
|
||||
proc getProfileModule(self: View): QVariant {.slot.} =
|
||||
return self.delegate.getProfileModule()
|
||||
QtProperty[QVariant] profileModule:
|
||||
read = getProfileModule
|
||||
|
||||
proc getAdvancedModule(self: View): QVariant {.slot.} =
|
||||
return self.delegate.getAdvancedModule()
|
||||
QtProperty[QVariant] advancedModule:
|
||||
|
|
|
@ -24,6 +24,7 @@ proc first*(jArray: JsonNode, fieldName, id: string): JsonNode =
|
|||
proc prettyEnsName*(ensName: string): string =
|
||||
if ensName.endsWith(".eth"):
|
||||
return "@" & ensName.split(".")[0]
|
||||
return ensName
|
||||
|
||||
const sep = when defined(windows): "\\" else: "/"
|
||||
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
{.used.}
|
||||
|
||||
import json, strformat
|
||||
|
||||
include ../../common/json_utils
|
||||
|
||||
type Dto* = ref object
|
||||
username*: string
|
||||
identicon*: string
|
||||
largeImage*: string
|
||||
thumbnailImage*: string
|
||||
hasIdentityImage*: bool
|
||||
messagesFromContactsOnly*: bool
|
||||
|
||||
proc `$`*(self: Dto): string =
|
||||
result = fmt"""ProfileDto(
|
||||
username: {self.username},
|
||||
identicon: {self.identicon},
|
||||
largeImage: {self.largeImage},
|
||||
thumbnailImage: {self.thumbnailImage},
|
||||
hasIdentityImage: {self.hasIdentityImage},
|
||||
messagesFromContactsOnly: {self.messagesFromContactsOnly}
|
||||
)"""
|
||||
|
||||
proc toDto*(jsonObj: JsonNode): Dto =
|
||||
result = Dto()
|
||||
|
||||
discard jsonObj.getProp("username", result.username)
|
||||
discard jsonObj.getProp("identicon", result.identicon)
|
||||
discard jsonObj.getProp("largeImage", result.largeImage)
|
||||
discard jsonObj.getProp("thumbnailImage", result.thumbnailImage)
|
||||
discard jsonObj.getProp("hasIdentityImage", result.hasIdentityImage)
|
||||
discard jsonObj.getProp("messagesFromContactsOnly", result.messagesFromContactsOnly)
|
|
@ -0,0 +1,36 @@
|
|||
{.used.}
|
||||
|
||||
import json
|
||||
|
||||
include ../../../common/json_utils
|
||||
|
||||
type
|
||||
Image* = object
|
||||
keyUid*: string
|
||||
imgType*: string
|
||||
uri*: string
|
||||
width: int
|
||||
height: int
|
||||
fileSize: int
|
||||
resizeTarget: int
|
||||
|
||||
type ProfileDto* = object
|
||||
images*: seq[Image]
|
||||
|
||||
proc toImage*(jsonObj: JsonNode): Image =
|
||||
result = Image()
|
||||
discard jsonObj.getProp("keyUid", result.keyUid)
|
||||
discard jsonObj.getProp("type", result.imgType)
|
||||
discard jsonObj.getProp("uri", result.uri)
|
||||
discard jsonObj.getProp("width", result.width)
|
||||
discard jsonObj.getProp("height", result.height)
|
||||
discard jsonObj.getProp("fileSize", result.fileSize)
|
||||
discard jsonObj.getProp("resizeTarget", result.resizeTarget)
|
||||
|
||||
proc toProfileDto*(jsonObj: JsonNode): ProfileDto =
|
||||
result = ProfileDto()
|
||||
|
||||
var imagesObj: JsonNode
|
||||
if(jsonObj.getProp("images", imagesObj) and imagesObj.kind == JArray):
|
||||
for imgObj in imagesObj:
|
||||
result.images.add(toImage(imgObj))
|
|
@ -1,7 +1,7 @@
|
|||
import json, sequtils, chronicles
|
||||
import status/statusgo_backend/accounts
|
||||
import json, chronicles
|
||||
|
||||
import ./service_interface, ./dto
|
||||
import ./service_interface
|
||||
import status/statusgo_backend_new/accounts as status_accounts
|
||||
|
||||
export service_interface
|
||||
|
||||
|
@ -10,7 +10,6 @@ logScope:
|
|||
|
||||
type
|
||||
Service* = ref object of ServiceInterface
|
||||
profile: Dto
|
||||
|
||||
method delete*(self: Service) =
|
||||
discard
|
||||
|
@ -19,26 +18,25 @@ proc newService*(): Service =
|
|||
result = Service()
|
||||
|
||||
method init*(self: Service) =
|
||||
discard
|
||||
|
||||
method storeIdentityImage*(self: Service, address: string, image: string, aX: int, aY: int, bX: int, bY: int): seq[Image] =
|
||||
try:
|
||||
self.profile = self.getProfile()
|
||||
let response = status_accounts.storeIdentityImage(address, image, aX, aY, bX, bY)
|
||||
|
||||
if(response.result.kind != JArray):
|
||||
error "error: ", methodName="storeIdentityImage", errDesription = "response is not an array"
|
||||
return
|
||||
|
||||
for img in response.result:
|
||||
result.add(toImage(img))
|
||||
|
||||
except Exception as e:
|
||||
let errDesription = e.msg
|
||||
error "error: ", errDesription
|
||||
return
|
||||
|
||||
method getProfile*(self: Service): Dto =
|
||||
return Dto(
|
||||
username: "test username",
|
||||
identicon: "",
|
||||
largeImage: "",
|
||||
thumbnailImage: "",
|
||||
hasIdentityImage: false,
|
||||
messagesFromContactsOnly: false
|
||||
)
|
||||
error "error: ", methodName="storeIdentityImage", errName = e.name, errDesription = e.msg
|
||||
|
||||
method storeIdentityImage*(self: Service, address: string, image: string, aX: int, aY: int, bX: int, bY: int): IdentityImage =
|
||||
storeIdentityImage(address, image, aX, aY, bX, bY)
|
||||
method deleteIdentityImage*(self: Service, address: string) =
|
||||
try:
|
||||
let response = status_accounts.deleteIdentityImage(address)
|
||||
|
||||
method deleteIdentityImage*(self: Service, address: string): string =
|
||||
deleteIdentityImage(address)
|
||||
except Exception as e:
|
||||
error "error: ", methodName="deleteIdentityImage", errName = e.name, errDesription = e.msg
|
|
@ -1,10 +1,6 @@
|
|||
import dto
|
||||
import ./dto/profile as profile_dto
|
||||
|
||||
export dto
|
||||
|
||||
import status/types/identity_image
|
||||
|
||||
export IdentityImage
|
||||
export profile_dto
|
||||
|
||||
type
|
||||
ServiceInterface* {.pure inheritable.} = ref object of RootObj
|
||||
|
@ -16,14 +12,9 @@ method delete*(self: ServiceInterface) {.base.} =
|
|||
method init*(self: ServiceInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getProfile*(self: ServiceInterface): Dto {.base.} =
|
||||
method storeIdentityImage*(self: ServiceInterface, address: string, image: string, aX: int, aY: int, bX: int, bY: int):
|
||||
seq[Image] {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method storeIdentityImage*(self: ServiceInterface, address: string, image: string, aX: int, aY: int, bX: int, bY: int): IdentityImage {.base.} =
|
||||
method deleteIdentityImage*(self: ServiceInterface, address: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method deleteIdentityImage*(self: ServiceInterface, address: string): string {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
# method getTokens*(self: ServiceInterface, chainId: int): seq[Dto] {.base.} =
|
||||
# raise newException(ValueError, "No implementation available")
|
|
@ -12,6 +12,7 @@ const KEY_DAPPS_ADDRESS* = "dapps-address"
|
|||
const KEY_EIP1581_ADDRESS* = "eip1581-address"
|
||||
const KEY_INSTALLATION_ID* = "installation-id"
|
||||
const KEY_PREFERRED_NAME* = "preferred-name"
|
||||
const KEY_ENS_USERNAMES* = "usernames"
|
||||
const KEY_KEY_UID* = "key-uid"
|
||||
const KEY_LATEST_DERIVED_PATH* = "latest-derived-path"
|
||||
const KEY_LINK_PREVIEW_REQUEST_ENABLED* = "link-preview-request-enabled"
|
||||
|
@ -82,6 +83,7 @@ type
|
|||
eip1581Address*: string
|
||||
installationId*: string
|
||||
preferredName*: string
|
||||
ensUsernames*: seq[string]
|
||||
keyUid*: string
|
||||
latestDerivedPath*: int
|
||||
linkPreviewRequestEnabled*: bool
|
||||
|
@ -222,6 +224,12 @@ proc toSettingsDto*(jsonObj: JsonNode): SettingsDto =
|
|||
discard jsonObj.getProp(KEY_NODE_CONFIG, result.nodeConfig)
|
||||
discard jsonObj.getProp(KEY_WAKU_BLOOM_FILTER_MODE, result.wakuBloomFilterMode)
|
||||
|
||||
var usernamesArr: JsonNode
|
||||
if(jsonObj.getProp(KEY_ENS_USERNAMES, usernamesArr)):
|
||||
if(usernamesArr.kind == JArray):
|
||||
for username in usernamesArr:
|
||||
result.ensUsernames.add(username.getStr)
|
||||
|
||||
proc configToJsonNode*(config: Config): JsonNode =
|
||||
let configAsString = $$config
|
||||
result = parseJson(configAsString)
|
||||
|
|
|
@ -108,6 +108,19 @@ method savePreferredName*(self: Service, value: string): bool =
|
|||
method getPreferredName*(self: Service): string =
|
||||
return self.settings.preferredName
|
||||
|
||||
method saveNewEnsUsername*(self: Service, username: string): bool =
|
||||
var newEnsUsernames = self.settings.ensUsernames
|
||||
newEnsUsernames.add(username)
|
||||
let newEnsUsernamesAsJson = %* newEnsUsernames
|
||||
|
||||
if(self.saveSetting(KEY_ENS_USERNAMES, newEnsUsernamesAsJson)):
|
||||
self.settings.ensUsernames = newEnsUsernames
|
||||
return true
|
||||
return false
|
||||
|
||||
method getEnsUsernames*(self: Service): seq[string] =
|
||||
return self.settings.ensUsernames
|
||||
|
||||
method saveKeyUid*(self: Service, value: string): bool =
|
||||
if(self.saveSetting(KEY_KEY_UID, value)):
|
||||
self.settings.keyUid = value
|
||||
|
|
|
@ -65,6 +65,12 @@ method savePreferredName*(self: ServiceInterface, value: string): bool {.base.}
|
|||
method getPreferredName*(self: ServiceInterface): string {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method saveNewEnsUsername*(self: ServiceInterface, username: string): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getEnsUsernames*(self: ServiceInterface): seq[string] {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method saveKeyUid*(self: ServiceInterface, value: string): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ QtObject {
|
|||
// property var walletModelInst: walletModel
|
||||
// Not Refactored Yet
|
||||
// property var profileModelInst: profileModel
|
||||
property var profileModuleInst: profileModule
|
||||
property var activityCenterModuleInst: activityCenterModule
|
||||
property var activityCenterList: activityCenterModuleInst.model
|
||||
|
||||
|
|
|
@ -169,7 +169,8 @@ Item {
|
|||
BlockContactConfirmationDialog {
|
||||
id: blockContactConfirmationDialog
|
||||
onBlockButtonClicked: {
|
||||
root.store.profileModuleInst.blockContact(blockContactConfirmationDialog.contactAddress)
|
||||
// Not Refactored Yet
|
||||
// root.store.profileModuleInst.blockContact(blockContactConfirmationDialog.contactAddress)
|
||||
root.store.activityCenterModuleInst.dismissActivityCenterNotification(model.id)
|
||||
blockContactConfirmationDialog.close()
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ StatusAppTwoPanelLayout {
|
|||
}
|
||||
|
||||
MyProfileView {
|
||||
store: profileView.store
|
||||
profileStore: profileView.store.profileStore
|
||||
profileContentWidth: _internal.profileContentWidth
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
import QtQuick 2.13
|
||||
import utils 1.0
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
property var profileModule
|
||||
|
||||
property string pubkey: userProfile.pubKey
|
||||
property string name: userProfile.name // in case of ens returns pretty ens form
|
||||
property string username: userProfile.username
|
||||
property string ensName: userProfile.preferredName || userProfile.firstEnsName || userProfile.ensName
|
||||
property string profileLargeImage: userProfile.largeImage
|
||||
property string icon: userProfile.icon
|
||||
property bool isIdenticon: userProfile.isIdenticon
|
||||
|
||||
|
||||
function uploadImage(source, aX, aY, bX, bY) {
|
||||
return root.profileModule.upload(source, aX, aY, bX, bY)
|
||||
}
|
||||
|
||||
function removeImage() {
|
||||
return root.profileModule.remove()
|
||||
}
|
||||
|
||||
function getQrCodeSource(publicKey) {
|
||||
return globalUtils.qrCode(publicKey)
|
||||
}
|
||||
|
||||
function copyToClipboard(value) {
|
||||
globalUtils.copyToClipboard(value)
|
||||
}
|
||||
}
|
|
@ -4,36 +4,39 @@ import utils 1.0
|
|||
QtObject {
|
||||
id: root
|
||||
|
||||
property var profile: profileModule.model
|
||||
property var contactsModuleInst: contactsModule
|
||||
property var aboutModuleInst: aboutModule
|
||||
property var mnemonicModuleInst: mnemonicModule
|
||||
|
||||
property var profileModuleInst: profileSectionModule
|
||||
property var profileSectionModuleInst: profileSectionModule
|
||||
|
||||
property AdvancedStore advancedStore: AdvancedStore {
|
||||
advancedModule: profileModuleInst.advancedModule
|
||||
advancedModule: profileSectionModuleInst.advancedModule
|
||||
}
|
||||
|
||||
property DevicesStore devicesStore: DevicesStore {
|
||||
devicesModule: profileModuleInst.devicesModule
|
||||
devicesModule: profileSectionModuleInst.devicesModule
|
||||
}
|
||||
|
||||
property SyncStore syncStore: SyncStore {
|
||||
syncModule: profileModuleInst.syncModule
|
||||
syncModule: profileSectionModuleInst.syncModule
|
||||
}
|
||||
|
||||
property NotificationsStore notificationsStore: NotificationsStore {
|
||||
notificationsModule: profileModuleInst.notificationsModule
|
||||
notificationsModule: profileSectionModuleInst.notificationsModule
|
||||
}
|
||||
|
||||
property LanguageStore languageStore: LanguageStore {
|
||||
languageModule: profileModuleInst.languageModule
|
||||
languageModule: profileSectionModuleInst.languageModule
|
||||
}
|
||||
|
||||
property AppearanceStore appearanceStore: AppearanceStore {
|
||||
}
|
||||
|
||||
property ProfileStore profileStore: ProfileStore {
|
||||
profileModule: profileSectionModuleInst.profileModule
|
||||
}
|
||||
|
||||
// Not Refactored Yet
|
||||
// property var chatsModelInst: chatsModel
|
||||
// Not Refactored Yet
|
||||
|
@ -58,18 +61,11 @@ QtObject {
|
|||
property string ensRegisterAddress: "" //utilsModelInst.ensRegisterAddress
|
||||
// Not Refactored Yet
|
||||
property string etherscanLink: "" //walletModelInst.utilsView.etherscanLink
|
||||
property string pubKey: profile.pubKey
|
||||
// Not Refactored Yet
|
||||
// property string preferredUsername: profileModelInst.ens.preferredUsername
|
||||
// property string firstEnsUsername: profileModelInst.ens.firstEnsUsername
|
||||
property string username: profile.username
|
||||
property string identicon: profile.identicon
|
||||
property string profileLargeImage: profile.largeImage
|
||||
property string profileThumbnailImage: profile.thumbnailImage
|
||||
|
||||
property bool profileHasIdentityImage: profile.hasIdentityImage
|
||||
// property string preferredUsername: userProfile.preferredName // was: profileModelInst.ens.preferredUsername
|
||||
// property string firstEnsUsername: userProfile.firstEnsName // was: profileModelInst.ens.firstEnsUsername
|
||||
property bool mnemonicBackedUp: mnemonicModuleInst.isBackedUp
|
||||
property bool messagesFromContactsOnly: profile.messagesFromContactsOnly
|
||||
property bool messagesFromContactsOnly: false //profile.messagesFromContactsOnly
|
||||
|
||||
property int profile_id: 0
|
||||
property int contacts_id: 1
|
||||
|
@ -191,24 +187,6 @@ QtObject {
|
|||
dappPermissionsModule.fetchDapps()
|
||||
}
|
||||
|
||||
function getQrCodeSource(publicKey) {
|
||||
// Not Refactored Yet
|
||||
// return profileModelInst.qrCode(publicKey)
|
||||
}
|
||||
|
||||
function copyToClipboard(value) {
|
||||
// Not Refactored Yet
|
||||
// chatsModelInst.copyToClipboard(value)
|
||||
}
|
||||
|
||||
function uploadImage(source, aX, aY, bX, bY) {
|
||||
return profileModule.upload(source, aX, aY, bX, bY)
|
||||
}
|
||||
|
||||
function removeImage() {
|
||||
return profileModule.remove()
|
||||
}
|
||||
|
||||
function lookupContact(value) {
|
||||
contactsModuleInst.lookupContact(value)
|
||||
}
|
||||
|
|
|
@ -17,12 +17,9 @@ import StatusQ.Controls 0.1
|
|||
Item {
|
||||
id: root
|
||||
|
||||
property var store
|
||||
property int profileContentWidth
|
||||
property var profileStore
|
||||
|
||||
property string ensName: store.preferredUsername || store.firstEnsUsername || ""
|
||||
property string username: store.username
|
||||
property string pubkey: store.pubKey
|
||||
property int profileContentWidth
|
||||
|
||||
clip: true
|
||||
height: parent.height
|
||||
|
@ -31,13 +28,13 @@ Item {
|
|||
Component {
|
||||
id: changeProfileModalComponent
|
||||
ChangeProfilePicModal {
|
||||
largeImage: store.profileLargeImage
|
||||
hasIdentityImage: store.profileHasIdentityImage
|
||||
largeImage: !root.profileStore.isIdenticon? root.profileStore.profileLargeImage : root.profileStore.icon
|
||||
hasIdentityImage: !root.profileStore.isIdenticon
|
||||
onCropFinished: {
|
||||
uploadError = store.uploadImage(selectedImage, aX, aY, bX, bY)
|
||||
uploadError = root.profileStore.uploadImage(selectedImage, aX, aY, bX, bY)
|
||||
}
|
||||
onRemoveImageButtonClicked: {
|
||||
uploadError = store.removeImage()
|
||||
uploadError = root.profileStore.removeImage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +60,7 @@ Item {
|
|||
height: 64
|
||||
border.width: 1
|
||||
border.color: Style.current.border
|
||||
source: root.store.profileThumbnailImage
|
||||
source: root.profileStore.icon
|
||||
smooth: false
|
||||
antialiasing: true
|
||||
}
|
||||
|
@ -92,7 +89,7 @@ Item {
|
|||
|
||||
StatusBaseText {
|
||||
id: profileName
|
||||
text: root.ensName !== "" ? root.ensName : root.username
|
||||
text: root.profileStore.name
|
||||
anchors.left: profileImgContainer.right
|
||||
anchors.leftMargin: Style.current.halfPadding
|
||||
anchors.top: profileImgContainer.top
|
||||
|
@ -104,7 +101,7 @@ Item {
|
|||
|
||||
Address {
|
||||
id: pubkeyText
|
||||
text: root.ensName !== "" ? root.username : root.pubkey
|
||||
text: root.profileStore.ensName !== "" ? root.profileStore.username : root.profileStore.pubkey
|
||||
anchors.bottom: profileImgContainer.bottom
|
||||
anchors.left: profileName.left
|
||||
anchors.bottomMargin: 4
|
||||
|
@ -137,7 +134,7 @@ Item {
|
|||
Image {
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: root.store.getQrCodeSource(pubkey)
|
||||
source: root.profileStore.getQrCodeSource(root.profileStore.pubkey)
|
||||
anchors.verticalCenterOffset: 20
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
@ -156,12 +153,12 @@ Item {
|
|||
|
||||
StatusDescriptionListItem {
|
||||
title: qsTr("ENS username")
|
||||
subTitle: root.ensName
|
||||
subTitle: root.profileStore.ensName
|
||||
tooltip.text: qsTr("Copy to clipboard")
|
||||
icon.name: "copy"
|
||||
visible: !!root.ensName
|
||||
visible: !!root.profileStore.ensName
|
||||
iconButton.onClicked: {
|
||||
root.store.copyToClipboard(root.ensName)
|
||||
root.profileStore.copyToClipboard(root.profileStore.ensName)
|
||||
tooltip.visible = !tooltip.visible
|
||||
}
|
||||
width: parent.width
|
||||
|
@ -169,14 +166,14 @@ Item {
|
|||
|
||||
StatusDescriptionListItem {
|
||||
title: qsTr("Chat key")
|
||||
subTitle: root.pubkey
|
||||
subTitle: root.profileStore.pubkey
|
||||
subTitleComponent.elide: Text.ElideMiddle
|
||||
subTitleComponent.width: 320
|
||||
subTitleComponent.font.family: Theme.palette.monoFont.name
|
||||
tooltip.text: qsTr("Copy to clipboard")
|
||||
icon.name: "copy"
|
||||
iconButton.onClicked: {
|
||||
root.store.copyToClipboard(root.pubkey)
|
||||
root.profileStore.copyToClipboard(root.profileStore.pubkey)
|
||||
tooltip.visible = !tooltip.visible
|
||||
}
|
||||
width: parent.width
|
||||
|
@ -184,11 +181,11 @@ Item {
|
|||
|
||||
StatusDescriptionListItem {
|
||||
title: qsTr("Share Profile URL")
|
||||
subTitle: `${Constants.userLinkPrefix}${root.ensName !== "" ? root.ensName : (root.pubkey.substring(0, 5) + "..." + root.pubkey.substring(root.pubkey.length - 5))}`
|
||||
subTitle: `${Constants.userLinkPrefix}${root.profileStore.ensName !== "" ? root.profileStore.ensName : (root.profileStore.pubkey.substring(0, 5) + "..." + root.profileStore.pubkey.substring(root.profileStore.pubkey.length - 5))}`
|
||||
tooltip.text: qsTr("Copy to clipboard")
|
||||
icon.name: "copy"
|
||||
iconButton.onClicked: {
|
||||
root.store.copyToClipboard(Constants.userLinkPrefix + (root.ensName !== "" ? root.ensName : root.pubkey))
|
||||
root.profileStore.copyToClipboard(Constants.userLinkPrefix + (root.profileStore.ensName !== "" ? root.profileStore.ensName : root.profileStore.pubkey))
|
||||
tooltip.visible = !tooltip.visible
|
||||
}
|
||||
width: parent.width
|
||||
|
|
|
@ -9,7 +9,6 @@ QtObject {
|
|||
readonly property ProfileStores.RootStore profileStore: ProfileStores.RootStore {}
|
||||
|
||||
property var mainModuleInst: mainModule
|
||||
property var profileModuleInst: profileModule
|
||||
property var aboutModuleInst: aboutModule
|
||||
|
||||
// Not Refactored Yet
|
||||
|
|
Loading…
Reference in New Issue