2023-11-01 16:54:22 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQml 2.15
|
|
|
|
|
2021-12-29 15:09:29 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property var profileModule
|
|
|
|
|
2024-06-03 08:57:02 +00:00
|
|
|
property string pubkey: userProfile.pubKey
|
|
|
|
property string name: userProfile.name
|
|
|
|
property string username: userProfile.username
|
|
|
|
property string displayName: userProfile.displayName
|
|
|
|
property string preferredName: userProfile.preferredName
|
|
|
|
property string profileLargeImage: userProfile.largeImage
|
|
|
|
property string icon: userProfile.icon
|
2023-02-14 09:20:53 +00:00
|
|
|
property bool userDeclinedBackupBanner: Global.appIsReady? localAccountSensitiveSettings.userDeclinedBackupBanner : false
|
2022-07-04 10:37:06 +00:00
|
|
|
property var privacyStore: profileSectionModule.privacyModule
|
2024-06-03 08:57:02 +00:00
|
|
|
readonly property string keyUid: userProfile.keyUid
|
|
|
|
readonly property bool isKeycardUser: userProfile.isKeycardUser
|
|
|
|
readonly property int currentUserStatus: userProfile.currentUserStatus
|
|
|
|
readonly property var thumbnailImage: userProfile.thumbnailImage
|
|
|
|
readonly property var largeImage: userProfile.largeImage
|
2024-06-03 08:56:25 +00:00
|
|
|
readonly property int colorId: Utils.colorIdForPubkey(root.pubkey)
|
|
|
|
readonly property var colorHash: Utils.getColorHashAsJson(root.pubkey, name != "")
|
2024-06-03 08:57:02 +00:00
|
|
|
readonly property string defaultDisplayName: ProfileUtils.displayName("", name, displayName, username)
|
2022-07-04 10:37:06 +00:00
|
|
|
|
2022-08-10 08:34:56 +00:00
|
|
|
readonly property string bio: profileModule.bio
|
|
|
|
readonly property string socialLinksJson: profileModule.socialLinksJson
|
|
|
|
readonly property var socialLinksModel: profileModule.socialLinksModel
|
|
|
|
readonly property var temporarySocialLinksModel: profileModule.temporarySocialLinksModel // for editing purposes
|
2023-03-08 01:56:41 +00:00
|
|
|
readonly property var temporarySocialLinksJson: profileModule.temporarySocialLinksJson
|
2022-08-10 08:34:56 +00:00
|
|
|
readonly property bool socialLinksDirty: profileModule.socialLinksDirty
|
|
|
|
|
2023-03-17 11:39:50 +00:00
|
|
|
readonly property bool isWalletEnabled: Global.appIsReady? mainModule.sectionsModel.getItemEnabledBySectionType(Constants.appSection.wallet) : true
|
2023-03-15 13:35:03 +00:00
|
|
|
|
2024-03-08 20:11:48 +00:00
|
|
|
readonly property var showcasePreferencesCommunitiesModel: profileModule.showcasePreferencesCommunitiesModel
|
|
|
|
readonly property var showcasePreferencesAccountsModel: profileModule.showcasePreferencesAccountsModel
|
|
|
|
readonly property var showcasePreferencesCollectiblesModel: profileModule.showcasePreferencesCollectiblesModel
|
|
|
|
readonly property var showcasePreferencesAssetsModel: profileModule.showcasePreferencesAssetsModel
|
|
|
|
readonly property var showcasePreferencesSocialLinksModel: profileModule.showcasePreferencesSocialLinksModel
|
|
|
|
|
2024-02-23 09:22:50 +00:00
|
|
|
readonly property bool isFirstShowcaseInteraction: localAccountSettings.isFirstShowcaseInteraction
|
2023-11-01 16:54:22 +00:00
|
|
|
|
2024-03-14 16:38:30 +00:00
|
|
|
property var details: Utils.getContactDetailsAsJson(pubkey)
|
|
|
|
|
|
|
|
// The following signals wrap the settings / preferences save request responses in one unique result (identity + preferences result)
|
|
|
|
signal profileSettingsSaveSucceeded()
|
|
|
|
signal profileSettingsSaveFailed()
|
|
|
|
|
|
|
|
// The following signals describe separate save request responses between identity and preferences
|
|
|
|
signal profileIdentitySaveSucceeded()
|
|
|
|
signal profileIdentitySaveFailed()
|
|
|
|
signal profileShowcasePreferencesSaveSucceeded()
|
|
|
|
signal profileShowcasePreferencesSaveFailed()
|
|
|
|
|
|
|
|
readonly property Connections profileModuleConnections: Connections {
|
|
|
|
target: root.profileModule
|
|
|
|
|
|
|
|
function onProfileIdentitySaveSucceeded() {
|
|
|
|
root.profileIdentitySaveSucceeded()
|
2022-06-03 10:48:03 +00:00
|
|
|
}
|
2021-12-29 15:09:29 +00:00
|
|
|
|
2024-03-14 16:38:30 +00:00
|
|
|
function onProfileIdentitySaveFailed() {
|
|
|
|
root.profileIdentitySaveFailed()
|
|
|
|
}
|
|
|
|
|
|
|
|
function onProfileShowcasePreferencesSaveSucceeded() {
|
|
|
|
root.profileShowcasePreferencesSaveSucceeded()
|
|
|
|
}
|
|
|
|
|
|
|
|
function onProfileShowcasePreferencesSaveFailed() {
|
|
|
|
root.profileShowcasePreferencesSaveFailed()
|
|
|
|
}
|
|
|
|
}
|
2022-06-22 12:16:21 +00:00
|
|
|
|
2024-03-08 20:11:48 +00:00
|
|
|
function getQrCodeSource(text) {
|
|
|
|
return globalUtils.qrCode(text)
|
|
|
|
}
|
|
|
|
|
|
|
|
function copyToClipboard(value) {
|
|
|
|
globalUtils.copyToClipboard(value)
|
|
|
|
}
|
|
|
|
|
2024-05-02 15:14:55 +00:00
|
|
|
function saveProfileIdentityChanges(displayName, bio, imageInfo) {
|
|
|
|
const changes = Object.assign({},
|
|
|
|
displayName !== undefined && { displayName },
|
|
|
|
bio !== undefined && { bio },
|
|
|
|
imageInfo !== undefined && { image: imageInfo })
|
|
|
|
|
|
|
|
const json = JSON.stringify(changes)
|
|
|
|
root.profileModule.saveProfileIdentityChanges(json)
|
2021-12-29 15:09:29 +00:00
|
|
|
}
|
|
|
|
|
2024-03-08 20:11:48 +00:00
|
|
|
function getProfileShowcaseEntriesLimit() {
|
|
|
|
return root.profileModule.getProfileShowcaseEntriesLimit()
|
2021-12-29 15:09:29 +00:00
|
|
|
}
|
2022-03-02 00:14:20 +00:00
|
|
|
|
2024-03-08 20:11:48 +00:00
|
|
|
function getProfileShowcaseSocialLinksLimit() {
|
|
|
|
return root.profileModule.getProfileShowcaseSocialLinksLimit()
|
|
|
|
}
|
|
|
|
|
|
|
|
function saveProfileShowcasePreferences(json) {
|
|
|
|
root.profileModule.saveProfileShowcasePreferences(json)
|
|
|
|
}
|
|
|
|
|
|
|
|
function requestProfileShowcasePreferences() {
|
|
|
|
root.profileModule.requestProfileShowcasePreferences()
|
|
|
|
}
|
|
|
|
|
|
|
|
function setIsFirstShowcaseInteraction() {
|
|
|
|
root.profileModule.setIsFirstShowcaseInteraction()
|
|
|
|
}
|
|
|
|
|
2024-03-14 16:38:30 +00:00
|
|
|
onUserDeclinedBackupBannerChanged: {
|
|
|
|
if (userDeclinedBackupBanner !== localAccountSensitiveSettings.userDeclinedBackupBanner) {
|
|
|
|
localAccountSensitiveSettings.userDeclinedBackupBanner = userDeclinedBackupBanner
|
|
|
|
}
|
|
|
|
}
|
2021-12-29 15:09:29 +00:00
|
|
|
}
|