2024-11-28 14:15:34 +00:00
|
|
|
import QtQuick 2.15
|
2021-12-31 12:29:51 +00:00
|
|
|
|
2024-06-03 08:56:25 +00:00
|
|
|
import StatusQ 0.1
|
2024-11-28 14:15:34 +00:00
|
|
|
import utils 1.0
|
2024-06-03 08:56:25 +00:00
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
QtObject {
|
|
|
|
id: root
|
|
|
|
|
2024-11-28 14:15:34 +00:00
|
|
|
readonly property QtObject _d: QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
readonly property var contactsModuleInst: profileSectionModule.contactsModule
|
|
|
|
readonly property var mainModuleInst: mainModule
|
|
|
|
readonly property var globalUtilsInst: globalUtils
|
2021-12-31 12:29:51 +00:00
|
|
|
|
2024-11-28 14:15:34 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
mainModuleInst.resolvedENS.connect(root.resolvedENS)
|
|
|
|
}
|
|
|
|
}
|
2021-12-31 12:29:51 +00:00
|
|
|
|
2024-11-28 14:15:34 +00:00
|
|
|
readonly property string myPublicKey: userProfile.pubKey
|
2021-12-31 12:29:51 +00:00
|
|
|
|
2024-06-03 08:56:25 +00:00
|
|
|
// contactsModel holds all available contacts
|
2024-11-28 14:15:34 +00:00
|
|
|
readonly property var contactsModel: d.contactsModuleInst.contactsModel
|
2022-04-08 20:17:16 +00:00
|
|
|
|
2024-11-28 14:15:34 +00:00
|
|
|
readonly property var showcasePublicKey: d.contactsModuleInst.showcasePublicKey
|
2024-03-29 11:43:49 +00:00
|
|
|
|
|
|
|
// Showcase models for a contact with showcasePublicKey
|
2024-11-28 14:15:34 +00:00
|
|
|
readonly property var showcaseContactCommunitiesModel: d.contactsModuleInst.showcaseContactCommunitiesModel
|
|
|
|
readonly property var showcaseContactAccountsModel: d.contactsModuleInst.showcaseContactAccountsModel
|
|
|
|
readonly property var showcaseContactCollectiblesModel: d.contactsModuleInst.showcaseContactCollectiblesModel
|
|
|
|
readonly property var showcaseContactAssetsModel: d.contactsModuleInst.showcaseContactAssetsModel
|
|
|
|
readonly property var showcaseContactSocialLinksModel: d.contactsModuleInst.showcaseContactSocialLinksModel
|
2024-03-29 11:43:49 +00:00
|
|
|
|
2024-11-28 14:15:34 +00:00
|
|
|
readonly property bool isShowcaseForAContactLoading: d.contactsModuleInst.showcaseForAContactLoading
|
2024-04-07 22:00:16 +00:00
|
|
|
|
2024-03-29 11:43:49 +00:00
|
|
|
// Support models for showcase for a contact with showcasePublicKey
|
2024-11-28 14:15:34 +00:00
|
|
|
readonly property var showcaseCollectiblesModel: d.contactsModuleInst.showcaseCollectiblesModel
|
|
|
|
|
|
|
|
signal resolvedENS(string resolvedPubKey, string resolvedAddress, string uuid)
|
2024-03-29 11:43:49 +00:00
|
|
|
|
|
|
|
// Sets showcasePublicKey and updates showcase models with corresponding data
|
|
|
|
function requestProfileShowcase(publicKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.requestProfileShowcase(publicKey)
|
2024-03-29 11:43:49 +00:00
|
|
|
}
|
|
|
|
|
2022-04-08 20:17:16 +00:00
|
|
|
// Temporary commented until we provide appropriate flags on the `status-go` side to cover all sections.
|
|
|
|
// property var receivedButRejectedContactRequestsModel: contactsModule.receivedButRejectedContactRequestsModel
|
|
|
|
// property var sentButRejectedContactRequestsModel: contactsModule.sentButRejectedContactRequestsModel
|
2022-03-15 15:55:18 +00:00
|
|
|
|
2022-01-04 12:06:05 +00:00
|
|
|
function resolveENS(value) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.mainModuleInst.resolveENS(value, "")
|
2021-12-31 12:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function generateAlias(pubKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
return d.globalUtilsInst.generateAlias(pubKey)
|
2022-06-20 14:48:38 +00:00
|
|
|
}
|
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
function joinPrivateChat(pubKey) {
|
|
|
|
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.switchToOrCreateOneToOneChat(pubKey)
|
2021-12-31 12:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function unblockContact(pubKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.unblockContact(pubKey)
|
2021-12-31 12:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function blockContact(pubKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.blockContact(pubKey)
|
2021-12-31 12:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function removeContact(pubKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.removeContact(pubKey)
|
2021-12-31 12:29:51 +00:00
|
|
|
}
|
|
|
|
|
2024-02-14 12:52:54 +00:00
|
|
|
function changeContactNickname(pubKey, nickname, displayName, isEdit) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.changeContactNickname(pubKey, nickname)
|
2024-02-14 12:52:54 +00:00
|
|
|
|
|
|
|
let message = ""
|
|
|
|
if (nickname === "") { // removed nickname
|
|
|
|
message = qsTr("Nickname for %1 removed").arg(displayName)
|
|
|
|
} else {
|
|
|
|
if (isEdit)
|
|
|
|
message = qsTr("Nickname for %1 changed").arg(displayName) // changed nickname
|
|
|
|
else
|
|
|
|
message = qsTr("Nickname for %1 added").arg(displayName) // added a new nickname
|
|
|
|
}
|
|
|
|
if (!!message) {
|
|
|
|
Global.displaySuccessToastMessage(message)
|
|
|
|
}
|
2021-12-31 12:29:51 +00:00
|
|
|
}
|
2022-05-27 08:57:18 +00:00
|
|
|
|
|
|
|
function sendContactRequest(pubKey, message) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.sendContactRequest(pubKey, message)
|
2024-02-16 11:56:29 +00:00
|
|
|
Global.displaySuccessToastMessage(qsTr("Contact request sent"))
|
2022-05-27 08:57:18 +00:00
|
|
|
}
|
|
|
|
|
2023-04-03 16:27:56 +00:00
|
|
|
function acceptContactRequest(pubKey, contactRequestId) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.acceptContactRequest(pubKey, contactRequestId)
|
2022-03-15 15:55:18 +00:00
|
|
|
}
|
|
|
|
|
2023-04-03 16:27:56 +00:00
|
|
|
function dismissContactRequest(pubKey, contactRequestId) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.dismissContactRequest(pubKey, contactRequestId)
|
2022-03-15 15:55:18 +00:00
|
|
|
}
|
|
|
|
|
2024-02-29 09:49:37 +00:00
|
|
|
function getLatestContactRequestForContactAsJson(pubKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
let resp = d.contactsModuleInst.getLatestContactRequestForContactAsJson(pubKey)
|
2024-02-29 09:49:37 +00:00
|
|
|
return JSON.parse(resp)
|
|
|
|
}
|
|
|
|
|
2024-02-28 13:50:40 +00:00
|
|
|
function markAsTrusted(pubKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.markAsTrusted(pubKey)
|
2024-02-28 13:50:40 +00:00
|
|
|
}
|
|
|
|
|
2022-06-28 18:11:18 +00:00
|
|
|
function markUntrustworthy(pubKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.markUntrustworthy(pubKey)
|
2022-06-28 18:11:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function removeTrustStatus(pubKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.removeTrustStatus(pubKey)
|
2022-06-28 18:11:18 +00:00
|
|
|
}
|
|
|
|
|
2023-04-06 07:56:50 +00:00
|
|
|
function requestContactInfo(publicKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
d.contactsModuleInst.requestContactInfo(publicKey)
|
2023-04-06 07:56:50 +00:00
|
|
|
}
|
2023-05-22 10:16:39 +00:00
|
|
|
|
|
|
|
function getContactPublicKeyByAddress(address) {
|
|
|
|
return "" // TODO retrive contact public key from address
|
|
|
|
}
|
2023-07-06 11:26:30 +00:00
|
|
|
|
|
|
|
function getLinkToProfile(publicKey) {
|
2024-11-28 14:15:34 +00:00
|
|
|
return d.contactsModuleInst.shareUserUrlWithData(publicKey)
|
2023-07-06 11:26:30 +00:00
|
|
|
}
|
2021-12-31 12:29:51 +00:00
|
|
|
}
|