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):
|
||||
var args = TrustArgs(e)
|
||||
self.delegate.contactTrustStatusChanged(args.publicKey, args.trustStatus)
|
||||
self.delegate.onTrustStatusRemoved(args.publicKey)
|
||||
|
||||
self.events.on(SIGNAL_CONTACT_UPDATED) do(e: Args):
|
||||
var args = ContactArgs(e)
|
||||
|
@ -160,4 +161,4 @@ proc fetchProfileShowcaseAccountsByAddress*(self: Controller, address: string) =
|
|||
self.contactsService.fetchProfileShowcaseAccountsByAddress(address)
|
||||
|
||||
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.} =
|
||||
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.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
@ -117,4 +120,4 @@ method getShowcaseCollectiblesModel*(self: AccessInterface): QVariant {.base.} =
|
|||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
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) =
|
||||
self.view.contactsModel().updateTrustStatus(publicKey, trustStatus)
|
||||
|
||||
method onTrustStatusRemoved(self: Module, publicKey: string) =
|
||||
self.view.trustStatusRemoved(publicKey)
|
||||
|
||||
method markAsTrusted*(self: Module, publicKey: string): void =
|
||||
self.controller.markAsTrusted(publicKey)
|
||||
|
||||
|
|
|
@ -108,6 +108,8 @@ QtObject:
|
|||
proc removeTrustStatus*(self: View, publicKey: string) {.slot.} =
|
||||
self.delegate.removeTrustStatus(publicKey)
|
||||
|
||||
proc trustStatusRemoved*(self: View, publicKey: string) {.signal.}
|
||||
|
||||
proc shareUserUrlWithData*(self: View, pubkey: string): string {.slot.} =
|
||||
return self.delegate.shareUserUrlWithData(pubkey)
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ Item {
|
|||
emojiHash: model.emojiHash,
|
||||
colorHash: model.colorHash,
|
||||
colorId: model.colorId,
|
||||
displayName: nickName || userName,
|
||||
displayName: model.preferredDisplayName,
|
||||
userIcon: model.icon,
|
||||
trustStatus: model.trustStatus,
|
||||
onlineStatus: model.onlineStatus,
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import QtQuick 2.15
|
||||
|
||||
import StatusQ 0.1
|
||||
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||
|
||||
import utils 1.0
|
||||
|
||||
QtObject {
|
||||
|
@ -15,6 +17,7 @@ QtObject {
|
|||
|
||||
Component.onCompleted: {
|
||||
mainModuleInst.resolvedENS.connect(root.resolvedENS)
|
||||
contactsModuleInst.trustStatusRemoved.connect(root.trustStatusRemoved)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +41,7 @@ QtObject {
|
|||
readonly property var showcaseCollectiblesModel: d.contactsModuleInst.showcaseCollectiblesModel
|
||||
|
||||
signal resolvedENS(string resolvedPubKey, string resolvedAddress, string uuid)
|
||||
signal trustStatusRemoved(string pubKey)
|
||||
|
||||
// Sets showcasePublicKey and updates showcase models with corresponding data
|
||||
function requestProfileShowcase(publicKey) {
|
||||
|
|
|
@ -458,8 +458,6 @@ QtObject {
|
|||
utilsStore: root.utilsStore
|
||||
|
||||
onAccepted: {
|
||||
rootStore.contactStore.removeTrustStatus(publicKey)
|
||||
|
||||
if (markAsUntrusted && removeContact) {
|
||||
rootStore.contactStore.markUntrustworthy(publicKey)
|
||||
rootStore.contactStore.removeContact(publicKey)
|
||||
|
@ -471,7 +469,7 @@ QtObject {
|
|||
rootStore.contactStore.removeContact(publicKey)
|
||||
Global.displaySuccessToastMessage(qsTr("%1 trust mark removed and removed from contacts").arg(mainDisplayName))
|
||||
} else {
|
||||
Global.displaySuccessToastMessage(qsTr("%1 trust mark removed").arg(mainDisplayName))
|
||||
rootStore.contactStore.removeTrustStatus(publicKey)
|
||||
}
|
||||
close()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import QtQuick 2.15
|
||||
|
||||
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||
|
||||
import utils 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
|
||||
function doAction(actionType, actionData) {
|
||||
switch(actionType) {
|
||||
|
|
Loading…
Reference in New Issue