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
|
|
|
|
|
2023-02-14 09:20:53 +00:00
|
|
|
property string pubkey: !!Global.userProfile? Global.userProfile.pubKey : ""
|
|
|
|
property string name: !!Global.userProfile? Global.userProfile.name : ""
|
|
|
|
property string username: !!Global.userProfile? Global.userProfile.username : ""
|
|
|
|
property string displayName: !!Global.userProfile? Global.userProfile.displayName : ""
|
|
|
|
property string preferredName: !!Global.userProfile? Global.userProfile.preferredName : ""
|
|
|
|
property string profileLargeImage: !!Global.userProfile? Global.userProfile.largeImage : ""
|
|
|
|
property string icon: !!Global.userProfile? Global.userProfile.icon : ""
|
|
|
|
property bool userDeclinedBackupBanner: Global.appIsReady? localAccountSensitiveSettings.userDeclinedBackupBanner : false
|
2022-07-04 10:37:06 +00:00
|
|
|
property var privacyStore: profileSectionModule.privacyModule
|
2023-05-02 13:37:31 +00:00
|
|
|
readonly property string keyUid: !!Global.userProfile ? Global.userProfile.keyUid : ""
|
|
|
|
readonly property bool isKeycardUser: !!Global.userProfile ? Global.userProfile.isKeycardUser : false
|
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-01-25 17:43:36 +00:00
|
|
|
readonly property var collectiblesModel: profileModule.collectiblesModel
|
|
|
|
|
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
|
|
|
|
|
|
|
|
// TODO: remove old models
|
2023-11-01 16:54:22 +00:00
|
|
|
readonly property var profileShowcaseCommunitiesModel: profileModule.profileShowcaseCommunitiesModel
|
|
|
|
readonly property var profileShowcaseAccountsModel: profileModule.profileShowcaseAccountsModel
|
|
|
|
readonly property var profileShowcaseCollectiblesModel: profileModule.profileShowcaseCollectiblesModel
|
|
|
|
readonly property var profileShowcaseAssetsModel: profileModule.profileShowcaseAssetsModel
|
2024-03-08 20:11:48 +00:00
|
|
|
|
2024-02-23 09:22:50 +00:00
|
|
|
readonly property bool isFirstShowcaseInteraction: localAccountSettings.isFirstShowcaseInteraction
|
2023-11-01 16:54:22 +00:00
|
|
|
|
2022-06-03 10:48:03 +00:00
|
|
|
onUserDeclinedBackupBannerChanged: {
|
|
|
|
if (userDeclinedBackupBanner !== localAccountSensitiveSettings.userDeclinedBackupBanner) {
|
|
|
|
localAccountSensitiveSettings.userDeclinedBackupBanner = userDeclinedBackupBanner
|
|
|
|
}
|
|
|
|
}
|
2021-12-29 15:09:29 +00:00
|
|
|
|
2022-06-22 12:16:21 +00:00
|
|
|
property var details: Utils.getContactDetailsAsJson(pubkey)
|
|
|
|
|
2024-03-08 20:11:48 +00:00
|
|
|
function getQrCodeSource(text) {
|
|
|
|
return globalUtils.qrCode(text)
|
|
|
|
}
|
|
|
|
|
|
|
|
function copyToClipboard(value) {
|
|
|
|
globalUtils.copyToClipboard(value)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Identity related:
|
2024-03-14 15:56:38 +00:00
|
|
|
function saveProfileIdentity(displayName, bio, source, aX, aY, bX, bY) {
|
2024-03-13 09:46:40 +00:00
|
|
|
var identityInfo = {
|
|
|
|
"displayName": displayName,
|
|
|
|
"bio": bio,
|
|
|
|
"image": source ? {
|
|
|
|
"source": source,
|
|
|
|
"aX": aX,
|
|
|
|
"aY": aY,
|
|
|
|
"bX": bX,
|
|
|
|
"bY": bY
|
|
|
|
} : null
|
|
|
|
}
|
|
|
|
let json = JSON.stringify(identityInfo)
|
2024-03-14 15:56:38 +00:00
|
|
|
root.profileModule.saveProfileIdentity(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 requestProfileShowcase(publicKey) {
|
|
|
|
root.profileModule.requestProfileShowcase(publicKey)
|
2022-03-02 00:14:20 +00:00
|
|
|
}
|
2022-08-10 08:34:56 +00:00
|
|
|
|
2024-03-08 20:11:48 +00:00
|
|
|
function setIsFirstShowcaseInteraction() {
|
|
|
|
root.profileModule.setIsFirstShowcaseInteraction()
|
|
|
|
}
|
|
|
|
|
2024-03-14 15:56:38 +00:00
|
|
|
signal profileIdentitySaveSucceeded()
|
|
|
|
signal profileIdentitySaveFailed()
|
2024-03-14 11:42:48 +00:00
|
|
|
signal profileShowcasePreferencesSaveSucceeded()
|
|
|
|
signal profileShowcasePreferencesSaveFailed()
|
|
|
|
|
|
|
|
readonly property Connections profileModuleConnections: Connections {
|
|
|
|
target: root.profileModule
|
|
|
|
|
2024-03-14 15:56:38 +00:00
|
|
|
function onProfileIdentitySaveSucceeded() {
|
|
|
|
root.profileIdentitySaveSucceeded()
|
|
|
|
}
|
|
|
|
function onProfileIdentitySaveFailed() {
|
|
|
|
root.profileIdentitySaveFailed()
|
|
|
|
}
|
2024-03-14 11:42:48 +00:00
|
|
|
function onProfileShowcasePreferencesSaveSucceeded() {
|
|
|
|
root.profileShowcasePreferencesSaveSucceeded()
|
|
|
|
}
|
|
|
|
function onProfileShowcasePreferencesSaveFailed() {
|
|
|
|
root.profileShowcasePreferencesSaveFailed()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-08 20:11:48 +00:00
|
|
|
// Social links related: All to be removed: Deprecated --> Issue #13688
|
2023-06-06 11:59:50 +00:00
|
|
|
function containsSocialLink(text, url) {
|
|
|
|
return root.profileModule.containsSocialLink(text, url)
|
|
|
|
}
|
|
|
|
|
2023-03-08 01:56:41 +00:00
|
|
|
function createLink(text, url, linkType, icon) {
|
|
|
|
root.profileModule.createLink(text, url, linkType, icon)
|
2022-08-10 08:34:56 +00:00
|
|
|
}
|
|
|
|
|
2023-03-08 01:56:41 +00:00
|
|
|
function removeLink(uuid) {
|
|
|
|
root.profileModule.removeLink(uuid)
|
2022-08-10 08:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateLink(uuid, text, url) {
|
|
|
|
root.profileModule.updateLink(uuid, text, url)
|
|
|
|
}
|
|
|
|
|
2023-03-08 01:56:41 +00:00
|
|
|
function moveLink(fromRow, toRow, count) {
|
|
|
|
root.profileModule.moveLink(fromRow, toRow)
|
|
|
|
}
|
|
|
|
|
2022-08-10 08:34:56 +00:00
|
|
|
function resetSocialLinks() {
|
|
|
|
root.profileModule.resetSocialLinks()
|
|
|
|
}
|
|
|
|
|
2023-03-08 01:56:41 +00:00
|
|
|
function saveSocialLinks(silent = false) {
|
|
|
|
root.profileModule.saveSocialLinks(silent)
|
2022-08-10 08:34:56 +00:00
|
|
|
}
|
2024-03-08 20:11:48 +00:00
|
|
|
// End of social links to be removed
|
2021-12-29 15:09:29 +00:00
|
|
|
}
|