fix: No toast on removal of untrusted mark
- listen to the NIM's signal `SIGNAL_REMOVED_TRUST_STATUS` - emit a signal for QML signal accordingly - emit a toast/notification as a result Fixes #16949
This commit is contained in:
parent
1735d7e75a
commit
8aebb81137
|
@ -64,6 +64,7 @@ proc init*(self: Controller) =
|
||||||
self.events.on(SIGNAL_REMOVED_TRUST_STATUS) do(e: Args):
|
self.events.on(SIGNAL_REMOVED_TRUST_STATUS) do(e: Args):
|
||||||
var args = TrustArgs(e)
|
var args = TrustArgs(e)
|
||||||
self.delegate.contactTrustStatusChanged(args.publicKey, args.trustStatus)
|
self.delegate.contactTrustStatusChanged(args.publicKey, args.trustStatus)
|
||||||
|
self.delegate.onTrustStatusRemoved(args.publicKey)
|
||||||
|
|
||||||
self.events.on(SIGNAL_CONTACT_UPDATED) do(e: Args):
|
self.events.on(SIGNAL_CONTACT_UPDATED) do(e: Args):
|
||||||
var args = ContactArgs(e)
|
var args = ContactArgs(e)
|
||||||
|
@ -160,4 +161,4 @@ proc fetchProfileShowcaseAccountsByAddress*(self: Controller, address: string) =
|
||||||
self.contactsService.fetchProfileShowcaseAccountsByAddress(address)
|
self.contactsService.fetchProfileShowcaseAccountsByAddress(address)
|
||||||
|
|
||||||
proc getEnabledChainIds*(self: Controller): seq[int] =
|
proc getEnabledChainIds*(self: Controller): seq[int] =
|
||||||
return self.networkService.getEnabledChainIds()
|
return self.networkService.getEnabledChainIds()
|
||||||
|
|
|
@ -71,6 +71,9 @@ method contactNicknameChanged*(self: AccessInterface, publicKey: string) {.base.
|
||||||
method contactTrustStatusChanged*(self: AccessInterface, publicKey: string, trustStatus: TrustStatus) {.base.} =
|
method contactTrustStatusChanged*(self: AccessInterface, publicKey: string, trustStatus: TrustStatus) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method onTrustStatusRemoved*(self: AccessInterface, publicKey: string): void {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method contactsStatusUpdated*(self: AccessInterface, statusUpdates: seq[StatusUpdateDto]) {.base.} =
|
method contactsStatusUpdated*(self: AccessInterface, statusUpdates: seq[StatusUpdateDto]) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
@ -117,4 +120,4 @@ method getShowcaseCollectiblesModel*(self: AccessInterface): QVariant {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method isShowcaseForAContactLoading*(self: AccessInterface): bool {.base.} =
|
method isShowcaseForAContactLoading*(self: AccessInterface): bool {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
|
@ -203,6 +203,9 @@ method contactNicknameChanged*(self: Module, publicKey: string) =
|
||||||
method contactTrustStatusChanged*(self: Module, publicKey: string, trustStatus: TrustStatus) =
|
method contactTrustStatusChanged*(self: Module, publicKey: string, trustStatus: TrustStatus) =
|
||||||
self.view.contactsModel().updateTrustStatus(publicKey, trustStatus)
|
self.view.contactsModel().updateTrustStatus(publicKey, trustStatus)
|
||||||
|
|
||||||
|
method onTrustStatusRemoved(self: Module, publicKey: string) =
|
||||||
|
self.view.trustStatusRemoved(publicKey)
|
||||||
|
|
||||||
method markAsTrusted*(self: Module, publicKey: string): void =
|
method markAsTrusted*(self: Module, publicKey: string): void =
|
||||||
self.controller.markAsTrusted(publicKey)
|
self.controller.markAsTrusted(publicKey)
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,8 @@ QtObject:
|
||||||
proc removeTrustStatus*(self: View, publicKey: string) {.slot.} =
|
proc removeTrustStatus*(self: View, publicKey: string) {.slot.} =
|
||||||
self.delegate.removeTrustStatus(publicKey)
|
self.delegate.removeTrustStatus(publicKey)
|
||||||
|
|
||||||
|
proc trustStatusRemoved*(self: View, publicKey: string) {.signal.}
|
||||||
|
|
||||||
proc shareUserUrlWithData*(self: View, pubkey: string): string {.slot.} =
|
proc shareUserUrlWithData*(self: View, pubkey: string): string {.slot.} =
|
||||||
return self.delegate.shareUserUrlWithData(pubkey)
|
return self.delegate.shareUserUrlWithData(pubkey)
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ Item {
|
||||||
emojiHash: model.emojiHash,
|
emojiHash: model.emojiHash,
|
||||||
colorHash: model.colorHash,
|
colorHash: model.colorHash,
|
||||||
colorId: model.colorId,
|
colorId: model.colorId,
|
||||||
displayName: nickName || userName,
|
displayName: model.preferredDisplayName,
|
||||||
userIcon: model.icon,
|
userIcon: model.icon,
|
||||||
trustStatus: model.trustStatus,
|
trustStatus: model.trustStatus,
|
||||||
onlineStatus: model.onlineStatus,
|
onlineStatus: model.onlineStatus,
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
|
|
||||||
import StatusQ 0.1
|
import StatusQ 0.1
|
||||||
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
@ -15,6 +17,7 @@ QtObject {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
mainModuleInst.resolvedENS.connect(root.resolvedENS)
|
mainModuleInst.resolvedENS.connect(root.resolvedENS)
|
||||||
|
contactsModuleInst.trustStatusRemoved.connect(root.trustStatusRemoved)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +41,7 @@ QtObject {
|
||||||
readonly property var showcaseCollectiblesModel: d.contactsModuleInst.showcaseCollectiblesModel
|
readonly property var showcaseCollectiblesModel: d.contactsModuleInst.showcaseCollectiblesModel
|
||||||
|
|
||||||
signal resolvedENS(string resolvedPubKey, string resolvedAddress, string uuid)
|
signal resolvedENS(string resolvedPubKey, string resolvedAddress, string uuid)
|
||||||
|
signal trustStatusRemoved(string pubKey)
|
||||||
|
|
||||||
// Sets showcasePublicKey and updates showcase models with corresponding data
|
// Sets showcasePublicKey and updates showcase models with corresponding data
|
||||||
function requestProfileShowcase(publicKey) {
|
function requestProfileShowcase(publicKey) {
|
||||||
|
|
|
@ -458,8 +458,6 @@ QtObject {
|
||||||
utilsStore: root.utilsStore
|
utilsStore: root.utilsStore
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
rootStore.contactStore.removeTrustStatus(publicKey)
|
|
||||||
|
|
||||||
if (markAsUntrusted && removeContact) {
|
if (markAsUntrusted && removeContact) {
|
||||||
rootStore.contactStore.markUntrustworthy(publicKey)
|
rootStore.contactStore.markUntrustworthy(publicKey)
|
||||||
rootStore.contactStore.removeContact(publicKey)
|
rootStore.contactStore.removeContact(publicKey)
|
||||||
|
@ -471,7 +469,7 @@ QtObject {
|
||||||
rootStore.contactStore.removeContact(publicKey)
|
rootStore.contactStore.removeContact(publicKey)
|
||||||
Global.displaySuccessToastMessage(qsTr("%1 trust mark removed and removed from contacts").arg(mainDisplayName))
|
Global.displaySuccessToastMessage(qsTr("%1 trust mark removed and removed from contacts").arg(mainDisplayName))
|
||||||
} else {
|
} else {
|
||||||
Global.displaySuccessToastMessage(qsTr("%1 trust mark removed").arg(mainDisplayName))
|
rootStore.contactStore.removeTrustStatus(publicKey)
|
||||||
}
|
}
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
|
|
||||||
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
import AppLayouts.Wallet 1.0
|
import AppLayouts.Wallet 1.0
|
||||||
|
@ -230,6 +232,15 @@ QtObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly property Connections _contactStoreConnections: Connections {
|
||||||
|
target: root.rootStore.contactStore
|
||||||
|
|
||||||
|
function onTrustStatusRemoved(pubKey: string) {
|
||||||
|
const displayName = SQUtils.ModelUtils.getByKey(root.rootStore.contactStore.contactsModel, "pubKey", pubKey, "preferredDisplayName")
|
||||||
|
Global.displaySuccessToastMessage(qsTr("Trust mark removed for %1").arg(displayName))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// It will cover all specific actions (different than open external links) that can be done after clicking toast link text
|
// It will cover all specific actions (different than open external links) that can be done after clicking toast link text
|
||||||
function doAction(actionType, actionData) {
|
function doAction(actionType, actionData) {
|
||||||
switch(actionType) {
|
switch(actionType) {
|
||||||
|
|
Loading…
Reference in New Issue