2021-12-31 12:29:51 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property var contactsModule
|
|
|
|
|
|
|
|
property var globalUtilsInst: globalUtils
|
2023-02-14 09:20:53 +00:00
|
|
|
property var mainModuleInst: Global.appIsReady? mainModule : null
|
2021-12-31 12:29:51 +00:00
|
|
|
|
2023-02-14 09:20:53 +00:00
|
|
|
property string myPublicKey: !!Global.userProfile? Global.userProfile.pubKey : ""
|
2021-12-31 12:29:51 +00:00
|
|
|
|
2022-03-24 20:55:22 +00:00
|
|
|
property var myContactsModel: contactsModule.myMutualContactsModel
|
|
|
|
property var blockedContactsModel: contactsModule.blockedContactsModel
|
|
|
|
property var receivedContactRequestsModel: contactsModule.receivedContactRequestsModel
|
|
|
|
property var sentContactRequestsModel: contactsModule.sentContactRequestsModel
|
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) {
|
|
|
|
root.mainModuleInst.resolveENS(value, "")
|
2021-12-31 12:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function generateAlias(pubKey) {
|
|
|
|
return root.globalUtilsInst.generateAlias(pubKey)
|
|
|
|
}
|
|
|
|
|
2022-03-28 14:42:26 +00:00
|
|
|
function getFromClipboard() {
|
|
|
|
return root.globalUtilsInst.getFromClipboard()
|
|
|
|
}
|
|
|
|
|
2022-03-25 11:33:30 +00:00
|
|
|
function isMyMutualContact(pubKey) {
|
|
|
|
return root.contactsModule.isMyMutualContact(pubKey)
|
|
|
|
}
|
|
|
|
|
2022-06-20 14:48:38 +00:00
|
|
|
function isBlockedContact(pubKey) {
|
|
|
|
return root.contactsModule.isBlockedContact(pubKey)
|
|
|
|
}
|
|
|
|
|
|
|
|
function hasPendingContactRequest(pubKey) {
|
|
|
|
return root.contactsModule.hasPendingContactRequest(pubKey)
|
|
|
|
}
|
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
function joinPrivateChat(pubKey) {
|
|
|
|
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
2022-05-17 08:06:21 +00:00
|
|
|
root.contactsModule.switchToOrCreateOneToOneChat(pubKey)
|
2021-12-31 12:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function unblockContact(pubKey) {
|
|
|
|
root.contactsModule.unblockContact(pubKey)
|
|
|
|
}
|
|
|
|
|
|
|
|
function blockContact(pubKey) {
|
|
|
|
root.contactsModule.blockContact(pubKey)
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeContact(pubKey) {
|
|
|
|
root.contactsModule.removeContact(pubKey)
|
|
|
|
}
|
|
|
|
|
2024-02-14 12:52:54 +00:00
|
|
|
function changeContactNickname(pubKey, nickname, displayName, isEdit) {
|
2021-12-31 12:29:51 +00:00
|
|
|
root.contactsModule.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) {
|
|
|
|
root.contactsModule.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) {
|
|
|
|
root.contactsModule.acceptContactRequest(pubKey, contactRequestId)
|
2022-03-15 15:55:18 +00:00
|
|
|
}
|
|
|
|
|
2023-04-03 16:27:56 +00:00
|
|
|
function dismissContactRequest(pubKey, contactRequestId) {
|
|
|
|
root.contactsModule.dismissContactRequest(pubKey, contactRequestId)
|
2022-03-15 15:55:18 +00:00
|
|
|
}
|
|
|
|
|
2022-06-28 18:11:18 +00:00
|
|
|
function markUntrustworthy(pubKey) {
|
|
|
|
root.contactsModule.markUntrustworthy(pubKey)
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeTrustStatus(pubKey) {
|
|
|
|
root.contactsModule.removeTrustStatus(pubKey)
|
|
|
|
}
|
|
|
|
|
|
|
|
function sendVerificationRequest(pubKey, challenge) {
|
|
|
|
root.contactsModule.sendVerificationRequest(pubKey, challenge);
|
2024-02-16 11:56:29 +00:00
|
|
|
Global.displaySuccessToastMessage(qsTr("ID verification request sent"))
|
2022-06-28 18:11:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function cancelVerificationRequest(pubKey) {
|
|
|
|
root.contactsModule.cancelVerificationRequest(pubKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
function declineVerificationRequest(pubKey) {
|
|
|
|
root.contactsModule.declineVerificationRequest(pubKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
function acceptVerificationRequest(pubKey, response) {
|
|
|
|
root.contactsModule.acceptVerificationRequest(pubKey, response);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getVerificationDetailsFromAsJson(pubKey) {
|
|
|
|
let resp = root.contactsModule.getVerificationDetailsFromAsJson(pubKey);
|
|
|
|
return JSON.parse(resp);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getSentVerificationDetailsAsJson(pubKey) {
|
|
|
|
let resp = root.contactsModule.getSentVerificationDetailsAsJson(pubKey);
|
|
|
|
return JSON.parse(resp);
|
|
|
|
}
|
|
|
|
|
|
|
|
function verifiedTrusted(pubKey) {
|
|
|
|
root.contactsModule.verifiedTrusted(pubKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
function verifiedUntrustworthy(pubKey) {
|
|
|
|
root.contactsModule.verifiedUntrustworthy(pubKey);
|
|
|
|
}
|
2023-04-06 07:56:50 +00:00
|
|
|
|
|
|
|
function requestContactInfo(publicKey) {
|
|
|
|
root.contactsModule.requestContactInfo(publicKey)
|
|
|
|
}
|
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) {
|
|
|
|
return root.contactsModule.shareUserUrlWithData(publicKey)
|
|
|
|
}
|
2021-12-31 12:29:51 +00:00
|
|
|
}
|